-
- Downloads
[SPARK-12854][SQL] Implement complex types support in ColumnarBatch
This patch adds support for complex types for ColumnarBatch. ColumnarBatch supports structs and arrays. There is a simple mapping between the richer catalyst types to these two. Strings are treated as an array of bytes. ColumnarBatch will contain a column for each node of the schema. Non-complex schemas consists of just leaf nodes. Structs represent an internal node with one child for each field. Arrays are internal nodes with one child. Structs just contain nullability. Arrays contain offsets and lengths into the child array. This structure is able to handle arbitrary nesting. It has the key property that we maintain columnar throughout and that primitive types are only stored in the leaf nodes and contiguous across rows. For example, if the schema is ``` array<array<int>> ``` There are three columns in the schema. The internal nodes each have one children. The leaf node contains all the int data stored consecutively. As part of this, this patch adds append APIs in addition to the Put APIs (e.g. putLong(rowid, v) vs appendLong(v)). These APIs are necessary when the batch contains variable length elements. The vectors are not fixed length and will grow as necessary. This should make the usage a lot simpler for the writer. Author: Nong Li <nong@databricks.com> Closes #10820 from nongli/spark-12854.
Showing
- sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java 5 additions, 2 deletions.../org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SpecificMutableRow.scala 2 additions, 1 deletion...e/spark/sql/catalyst/expressions/SpecificMutableRow.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGenerator.scala 81 additions, 13 deletions...test/scala/org/apache/spark/sql/RandomDataGenerator.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGeneratorSuite.scala 3 additions, 1 deletion...scala/org/apache/spark/sql/RandomDataGeneratorSuite.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeRowJoinerSuite.scala 3 additions, 2 deletions...st/expressions/codegen/GenerateUnsafeRowJoinerSuite.scala
- sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java 621 additions, 9 deletions...g/apache/spark/sql/execution/vectorized/ColumnVector.java
- sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVectorUtils.java 126 additions, 0 deletions...che/spark/sql/execution/vectorized/ColumnVectorUtils.java
- sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnarBatch.java 49 additions, 21 deletions.../apache/spark/sql/execution/vectorized/ColumnarBatch.java
- sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OffHeapColumnVector.java 147 additions, 10 deletions...e/spark/sql/execution/vectorized/OffHeapColumnVector.java
- sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/OnHeapColumnVector.java 155 additions, 14 deletions...he/spark/sql/execution/vectorized/OnHeapColumnVector.java
- sql/core/src/test/scala/org/apache/spark/sql/execution/UnsafeKVExternalSorterSuite.scala 2 additions, 2 deletions...che/spark/sql/execution/UnsafeKVExternalSorterSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchBenchmark.scala 77 additions, 1 deletion...ark/sql/execution/vectorized/ColumnarBatchBenchmark.scala
- sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchSuite.scala 385 additions, 12 deletions...e/spark/sql/execution/vectorized/ColumnarBatchSuite.scala
- sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala 2 additions, 1 deletion...ache/spark/sql/hive/execution/AggregationQuerySuite.scala
- sql/hive/src/test/scala/org/apache/spark/sql/sources/hadoopFsRelationSuites.scala 2 additions, 1 deletion...org/apache/spark/sql/sources/hadoopFsRelationSuites.scala
- unsafe/src/main/java/org/apache/spark/unsafe/Platform.java 11 additions, 0 deletionsunsafe/src/main/java/org/apache/spark/unsafe/Platform.java
Loading
Please register or sign in to comment