-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21046][SQL] simplify the array offset and length in ColumnVector #18260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
d4267b7
a61ba71
368c346
1dae660
e6e60e0
fdc0870
04790bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,8 @@ public final class OnHeapColumnVector extends ColumnVector { | |
| // Array for each type. Only 1 is populated for any type. | ||
| private byte[] byteData; | ||
| private short[] shortData; | ||
| // This is not used used to store data for int column vector, but also can store offsets and | ||
|
||
| // lengths for array column vector. | ||
| private int[] intData; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One question I just have is, the capacity of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. Is it possible to use
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Even we pass this check, we still face problem when allocating
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kiszk Do you meant we store a pair of offset/length together as an element in |
||
| private long[] longData; | ||
| private float[] floatData; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -631,7 +631,7 @@ class ColumnarBatchSuite extends SparkFunSuite { | |
| assert(column.arrayData().elementsAppended == 17) | ||
|
|
||
| // Put the same "ll" at offset. This should not allocate more memory in the column. | ||
| column.arrayWriteEnd(idx, offset, 2) | ||
| column.putArrayOffsetAndLength(idx, offset, 2) | ||
| reference += "ll" | ||
| idx += 1 | ||
| assert(column.arrayData().elementsAppended == 17) | ||
|
|
@@ -667,10 +667,10 @@ class ColumnarBatchSuite extends SparkFunSuite { | |
| } | ||
|
|
||
| // Populate it with arrays [0], [1, 2], [], [3, 4, 5] | ||
| column.arrayWriteEnd(0, 0, 1) | ||
| column.arrayWriteEnd(1, 1, 2) | ||
| column.arrayWriteEnd(2, 2, 0) | ||
| column.arrayWriteEnd(3, 3, 3) | ||
| column.putArrayOffsetAndLength(0, 0, 1) | ||
| column.putArrayOffsetAndLength(1, 1, 2) | ||
| column.putArrayOffsetAndLength(2, 2, 0) | ||
|
||
| column.putArrayOffsetAndLength(3, 3, 3) | ||
|
|
||
| val a1 = ColumnVectorUtils.toPrimitiveJavaArray(column.getArray(0)).asInstanceOf[Array[Int]] | ||
| val a2 = ColumnVectorUtils.toPrimitiveJavaArray(column.getArray(1)).asInstanceOf[Array[Int]] | ||
|
|
@@ -703,7 +703,7 @@ class ColumnarBatchSuite extends SparkFunSuite { | |
| data.reserve(array.length) | ||
| assert(data.capacity == array.length * 2) | ||
| data.putInts(0, array.length, array, 0) | ||
| column.arrayWriteEnd(0, 0, array.length) | ||
| column.putArrayOffsetAndLength(0, 0, array.length) | ||
| assert(ColumnVectorUtils.toPrimitiveJavaArray(column.getArray(0)).asInstanceOf[Array[Int]] | ||
| === array) | ||
| }} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
will be store->will be stored?