Apache DataFusion SQL Query Engine
ARROW-1785: [Format/C++/Java] Remove VectorLayout from serialized schemas
Li Jinda1c1da04fde
diff --git a/format/Schema.fbs b/format/Schema.fbsindex 6021e92b84..3d739342b8 100644--- a/format/Schema.fbs+++ b/format/Schema.fbs@@ -211,32 +211,6 @@ union Type {Map}-/// -----------------------------------------------------------------------/// The possible types of a vector--enum VectorType: short {- /// used in List type, Dense Union and variable length primitive types (String, Binary)- OFFSET,- /// actual data, either wixed width primitive types in slots or variable width delimited by an OFFSET vector- DATA,- /// Bit vector indicating if each value is null- VALIDITY,- /// Type vector used in Union type- TYPE-}--/// -----------------------------------------------------------------------/// represents the physical layout of a buffer-/// buffers have fixed width slots of a given type--table VectorLayout {- /// the width of a slot in the buffer (typically 1, 8, 16, 32 or 64)- bit_width: short;- /// the purpose of the vector- type: VectorType;-}--/// ----------------------------------------------------------------------/// user defined key value pairs to add custom metadata to arrow/// key namespacing is the responsibility of the user@@ -285,10 +259,7 @@ table Field {// children apply only to Nested data types like Struct, List and Unionchildren: [Field];- /// layout of buffers produced for this type (as derived from the Type)- /// does not include children- /// each recordbatch will return instances of those Buffers.- layout: [ VectorLayout ];+// User-defined metadatacustom_metadata: [ KeyValue ];}diff --git a/integration/data/simple.json b/integration/data/simple.jsonindex bc8949912a..6634729193 100644--- a/integration/data/simple.json+++ b/integration/data/simple.json@@ -4,36 +4,20 @@{"name": "foo","type": {"name": "int", "isSigned": true, "bitWidth": 32},- "nullable": true, "children": [],- "typeLayout": {- "vectors": [- {"type": "VALIDITY", "typeBitWidth": 1},- {"type": "DATA", "typeBitWidth": 32}- ]- }+ "nullable": true,+ "children": []},{"name": "bar","type": {"name": "floatingpoint", "precision": "DOUBLE"},- "nullable": true, "children": [],- "typeLayout": {- "vectors": [- {"type": "VALIDITY", "typeBitWidth": 1},- {"type": "DATA", "typeBitWidth": 64}- ]- }+ "nullable": true,+ "children": []},{"name": "baz","type": {"name": "utf8"},- "nullable": true, "children": [],- "typeLayout": {- "vectors": [- {"type": "VALIDITY", "typeBitWidth": 1},- {"type": "OFFSET", "typeBitWidth": 32},- {"type": "DATA", "typeBitWidth": 8}- ]- }+ "nullable": true,+ "children": []}]},diff --git a/integration/data/struct_example.json b/integration/data/struct_example.jsonindex 3ea062db7b..4e6cc774e3 100644--- a/integration/data/struct_example.json+++ b/integration/data/struct_example.json@@ -16,19 +16,7 @@"bitWidth": 32},"nullable": true,- "children": [],- "typeLayout": {- "vectors": [- {- "type": "VALIDITY",- "typeBitWidth": 1- },- {- "type": "DATA",- "typeBitWidth": 32- }- ]- }+ "children": []},{"name": "f2",@@ -36,33 +24,9 @@"name": "utf8"},"nullable": true,- "children": [],- "typeLayout": {- "vectors": [- {- "type": "VALIDITY",- "typeBitWidth": 1- },- {- "type": "OFFSET",- "typeBitWidth": 32- },- {- "type": "DATA",- "typeBitWidth": 8- }- ]- }+ "children": []}- ],- "typeLayout": {- "vectors": [- {- "type": "VALIDITY",- "typeBitWidth": 1- }- ]- }+ ]}]},@@ -234,4 +198,4 @@]}]-}\ No newline at end of file+}diff --git a/integration/integration_test.py b/integration/integration_test.pyindex a063fb36f4..5468ab19de 100644--- a/integration/integration_test.py+++ b/integration/integration_test.py@@ -111,8 +111,7 @@ class DataType(object):('name', self.name),('type', self._get_type()),('nullable', self.nullable),- ('children', self._get_children()),- ('typeLayout', self._get_type_layout())+ ('children', self._get_children())])def _make_is_valid(self, size):@@ -158,14 +157,6 @@ class PrimitiveType(DataType):def _get_children(self):return []- def _get_type_layout(self):- return OrderedDict([- ('vectors',- [OrderedDict([('type', 'VALIDITY'),- ('typeBitWidth', 1)]),- OrderedDict([('type', 'DATA'),- ('typeBitWidth', self.bit_width)])])])-class PrimitiveColumn(Column):@@ -402,14 +393,6 @@ class DecimalType(PrimitiveType):('scale', self.scale),])- def _get_type_layout(self):- return OrderedDict([- ('vectors',- [OrderedDict([('type', 'VALIDITY'),- ('typeBitWidth', 1)]),- OrderedDict([('type', 'DATA'),- ('typeBitWidth', self.bit_width)])])])-def generate_column(self, size, name=None):min_value, max_value = decimal_range_from_precision(self.precision)values = [random.randint(min_value, max_value) for _ in range(size)]@@ -461,16 +444,6 @@ class BinaryType(PrimitiveType):def _get_type(self):return OrderedDict([('name', 'binary')])- def _get_type_layout(self):- return OrderedDict([- ('vectors',- [OrderedDict([('type', 'VALIDITY'),- ('typeBitWidth', 1)]),- OrderedDict([('type', 'OFFSET'),- ('typeBitWidth', 32)]),- OrderedDict([('type', 'DATA'),- ('typeBitWidth', 8)])])])-def generate_column(self, size, name=None):K = 7is_valid = self._make_is_valid(size)@@ -572,14 +545,6 @@ class ListType(DataType):def _get_children(self):return [self.value_type.get_json()]- def _get_type_layout(self):- return OrderedDict([- ('vectors',- [OrderedDict([('type', 'VALIDITY'),- ('typeBitWidth', 1)]),- OrderedDict([('type', 'OFFSET'),- ('typeBitWidth', 32)])])])-def generate_column(self, size, name=None):MAX_LIST_SIZE = 4@@ -633,12 +598,6 @@ class StructType(DataType):def _get_children(self):return [type_.get_json() for type_ in self.field_types]- def _get_type_layout(self):- return OrderedDict([- ('vectors',- [OrderedDict([('type', 'VALIDITY'),- ('typeBitWidth', 1)])])])-def generate_column(self, size, name=None):is_valid = self._make_is_valid(size)@@ -689,13 +648,9 @@ class DictionaryType(DataType):('id', self.dictionary.id_),('indexType', self.index_type._get_type()),('isOrdered', self.dictionary.ordered)- ])),- ('typeLayout', self.index_type._get_type_layout())+ ]))])- def _get_type_layout(self):- return self.index_type._get_type_layout()-def generate_column(self, size, name=None):if name is None:name = self.name