arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jul...@apache.org
Subject arrow git commit: ARROW-278: [Format] Rename Tuple to Struct_ in flatbuffers IDL
Date Wed, 07 Sep 2016 21:15:27 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 214b861ae -> 270ab4e94


ARROW-278: [Format] Rename Tuple to Struct_ in flatbuffers IDL

"Struct" is a reserved keyword in generated bindings for C++. We had used "Tuple" to sidestep
this but we discussed and decided to mangle "Struct" instead in the Flatbuffers.

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #130 from wesm/ARROW-278 and squashes the following commits:

841a721 [Wes McKinney] Rename Tuple to Struct_ in flatbuffers IDL


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/270ab4e9
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/270ab4e9
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/270ab4e9

Branch: refs/heads/master
Commit: 270ab4e94dba3ec45cfd2297d4f901d51d4a053b
Parents: 214b861
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Wed Sep 7 14:15:16 2016 -0700
Committer: Julien Le Dem <julien@dremio.com>
Committed: Wed Sep 7 14:15:16 2016 -0700

----------------------------------------------------------------------
 cpp/src/arrow/ipc/metadata-internal.cc                    |  6 +++---
 format/Message.fbs                                        | 10 +++++-----
 java/vector/src/main/codegen/data/ArrowTypes.tdd          |  2 +-
 .../java/org/apache/arrow/vector/complex/MapVector.java   |  4 ++--
 .../java/org/apache/arrow/vector/schema/TypeLayout.java   |  6 +++---
 .../main/java/org/apache/arrow/vector/types/Types.java    |  4 ++--
 .../java/org/apache/arrow/vector/pojo/TestConvert.java    |  6 +++---
 7 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/270ab4e9/cpp/src/arrow/ipc/metadata-internal.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/metadata-internal.cc b/cpp/src/arrow/ipc/metadata-internal.cc
index c921e4d..1c15218 100644
--- a/cpp/src/arrow/ipc/metadata-internal.cc
+++ b/cpp/src/arrow/ipc/metadata-internal.cc
@@ -115,7 +115,7 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
       }
       *out = std::make_shared<ListType>(children[0]);
       return Status::OK();
-    case flatbuf::Type_Tuple:
+    case flatbuf::Type_Struct_:
       *out = std::make_shared<StructType>(children);
       return Status::OK();
     case flatbuf::Type_Union:
@@ -153,7 +153,7 @@ static Status StructToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>&
type
     RETURN_NOT_OK(FieldToFlatbuffer(fbb, type->child(i), &field));
     out_children->push_back(field);
   }
-  *offset = flatbuf::CreateTuple(fbb).Union();
+  *offset = flatbuf::CreateStruct_(fbb).Union();
   return Status::OK();
 }
 
@@ -197,7 +197,7 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>&
type,
       *out_type = flatbuf::Type_List;
       return ListToFlatbuffer(fbb, type, children, offset);
     case Type::STRUCT:
-      *out_type = flatbuf::Type_Tuple;
+      *out_type = flatbuf::Type_Struct_;
       return StructToFlatbuffer(fbb, type, children, offset);
     default:
       *out_type = flatbuf::Type_NONE;  // Make clang-tidy happy

http://git-wip-us.apache.org/repos/asf/arrow/blob/270ab4e9/format/Message.fbs
----------------------------------------------------------------------
diff --git a/format/Message.fbs b/format/Message.fbs
index 9c95724..78bdaeb 100644
--- a/format/Message.fbs
+++ b/format/Message.fbs
@@ -8,10 +8,10 @@ namespace org.apache.arrow.flatbuf;
 table Null {
 }
 
-/// A Tuple in the flatbuffer metadata is the same as an Arrow Struct
-/// (according to the physical memory layout). We used Tuple here as Struct is
-/// a reserved word in Flatbuffers
-table Tuple {
+/// A Struct_ in the flatbuffer metadata is the same as an Arrow Struct
+/// (according to the physical memory layout). We used Struct_ here as
+/// Struct is a reserved word in Flatbuffers
+table Struct_ {
 }
 
 table List {
@@ -87,7 +87,7 @@ union Type {
   IntervalDay,
   IntervalYear,
   List,
-  Tuple,
+  Struct_,
   Union,
   JSONScalar
 }

http://git-wip-us.apache.org/repos/asf/arrow/blob/270ab4e9/java/vector/src/main/codegen/data/ArrowTypes.tdd
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/data/ArrowTypes.tdd b/java/vector/src/main/codegen/data/ArrowTypes.tdd
index 2ecad3d..5cb43be 100644
--- a/java/vector/src/main/codegen/data/ArrowTypes.tdd
+++ b/java/vector/src/main/codegen/data/ArrowTypes.tdd
@@ -21,7 +21,7 @@
       fields: []
     },
     {
-      name: "Tuple",
+      name: "Struct_",
       fields: []
     },
     {

http://git-wip-us.apache.org/repos/asf/arrow/blob/270ab4e9/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java
index 1b8483a..aaecb95 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java
@@ -34,7 +34,7 @@ import org.apache.arrow.vector.complex.reader.FieldReader;
 import org.apache.arrow.vector.holders.ComplexHolder;
 import org.apache.arrow.vector.types.Types;
 import org.apache.arrow.vector.types.Types.MinorType;
-import org.apache.arrow.vector.types.pojo.ArrowType.Tuple;
+import org.apache.arrow.vector.types.pojo.ArrowType.Struct_;
 import org.apache.arrow.vector.types.pojo.Field;
 import org.apache.arrow.vector.util.CallBack;
 import org.apache.arrow.vector.util.JsonStringHashMap;
@@ -290,7 +290,7 @@ public class MapVector extends AbstractMapVector {
     for (ValueVector child : getChildren()) {
       children.add(child.getField());
     }
-    return new Field(name, false, Tuple.INSTANCE, children);
+    return new Field(name, false, Struct_.INSTANCE, children);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/arrow/blob/270ab4e9/java/vector/src/main/java/org/apache/arrow/vector/schema/TypeLayout.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/schema/TypeLayout.java b/java/vector/src/main/java/org/apache/arrow/vector/schema/TypeLayout.java
index 9f1efd0..885ac2a 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/schema/TypeLayout.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/schema/TypeLayout.java
@@ -45,7 +45,7 @@ import org.apache.arrow.vector.types.pojo.ArrowType.IntervalYear;
 import org.apache.arrow.vector.types.pojo.ArrowType.Null;
 import org.apache.arrow.vector.types.pojo.ArrowType.Time;
 import org.apache.arrow.vector.types.pojo.ArrowType.Timestamp;
-import org.apache.arrow.vector.types.pojo.ArrowType.Tuple;
+import org.apache.arrow.vector.types.pojo.ArrowType.Struct_;
 import org.apache.arrow.vector.types.pojo.ArrowType.Union;
 import org.apache.arrow.vector.types.pojo.ArrowType.Utf8;
 
@@ -54,7 +54,7 @@ import com.google.common.base.Preconditions;
 /**
  * The layout of vectors for a given type
  * It defines its own vectors followed by the vectors for the children
- * if it is a nested type (Tuple, List, Union)
+ * if it is a nested type (Struct_, List, Union)
  */
 public class TypeLayout {
 
@@ -88,7 +88,7 @@ public class TypeLayout {
         return new TypeLayout(vectors);
       }
 
-      @Override public TypeLayout visit(Tuple type) {
+      @Override public TypeLayout visit(Struct_ type) {
         List<VectorLayout> vectors = asList(
             validityVector()
             );

http://git-wip-us.apache.org/repos/asf/arrow/blob/270ab4e9/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java b/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
index 5eef8a0..66ef756 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
@@ -84,7 +84,7 @@ import org.apache.arrow.vector.types.pojo.ArrowType.List;
 import org.apache.arrow.vector.types.pojo.ArrowType.Null;
 import org.apache.arrow.vector.types.pojo.ArrowType.Time;
 import org.apache.arrow.vector.types.pojo.ArrowType.Timestamp;
-import org.apache.arrow.vector.types.pojo.ArrowType.Tuple;
+import org.apache.arrow.vector.types.pojo.ArrowType.Struct_;
 import org.apache.arrow.vector.types.pojo.ArrowType.Union;
 import org.apache.arrow.vector.types.pojo.ArrowType.Utf8;
 import org.apache.arrow.vector.types.pojo.Field;
@@ -131,7 +131,7 @@ public class Types {
         return null;
       }
     },
-    MAP(Tuple.INSTANCE) {
+    MAP(Struct_.INSTANCE) {
       @Override
       public Field getField() {
         throw new UnsupportedOperationException("Cannot get simple field for Map type");

http://git-wip-us.apache.org/repos/asf/arrow/blob/270ab4e9/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java
----------------------------------------------------------------------
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java b/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java
index 61327f1..448117d 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/pojo/TestConvert.java
@@ -26,7 +26,7 @@ import org.apache.arrow.vector.types.pojo.ArrowType.FloatingPoint;
 import org.apache.arrow.vector.types.pojo.ArrowType.Int;
 import org.apache.arrow.vector.types.pojo.ArrowType.List;
 import org.apache.arrow.vector.types.pojo.ArrowType.Timestamp;
-import org.apache.arrow.vector.types.pojo.ArrowType.Tuple;
+import org.apache.arrow.vector.types.pojo.ArrowType.Struct_;
 import org.apache.arrow.vector.types.pojo.ArrowType.Union;
 import org.apache.arrow.vector.types.pojo.ArrowType.Utf8;
 import org.apache.arrow.vector.types.pojo.Field;
@@ -53,7 +53,7 @@ public class TestConvert {
     childrenBuilder.add(new Field("child1", true, Utf8.INSTANCE, null));
     childrenBuilder.add(new Field("child2", true, new FloatingPoint(SINGLE), ImmutableList.<Field>of()));
 
-    Field initialField = new Field("a", true, Tuple.INSTANCE, childrenBuilder.build());
+    Field initialField = new Field("a", true, Struct_.INSTANCE, childrenBuilder.build());
     run(initialField);
   }
 
@@ -71,7 +71,7 @@ public class TestConvert {
     ImmutableList.Builder<Field> childrenBuilder = ImmutableList.builder();
     childrenBuilder.add(new Field("child1", true, Utf8.INSTANCE, null));
     childrenBuilder.add(new Field("child2", true, new FloatingPoint(SINGLE), ImmutableList.<Field>of()));
-    childrenBuilder.add(new Field("child3", true, new Tuple(), ImmutableList.<Field>of(
+    childrenBuilder.add(new Field("child3", true, new Struct_(), ImmutableList.<Field>of(
         new Field("child3.1", true, Utf8.INSTANCE, null),
         new Field("child3.2", true, new FloatingPoint(DOUBLE), ImmutableList.<Field>of())
         )));


Mime
View raw message