-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-21745][SQL] Refactor ColumnVector hierarchy to make ColumnVector read-only and to introduce WritableColumnVector. #18958
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e4e2241
Refactor ColumnVector hierarchy to make ColumnVector read-only and to…
ueshin cd0de39
Modify VectorizedHashMapGenerator to use OnHeapColumnVector directly.
ueshin 05b1aa9
Add a private getter method.
ueshin 79eaecd
Address a comment about the RuntimeException constructor.
ueshin d2dda9c
Move initialization logics into the parent class.
ueshin 2769b39
Move reserveDictionaryIds logic into the parent class.
ueshin b6ab633
Add static util methods to create the on/off-heap vectors.
ueshin ae317f6
Use `rowId` instead of `row`.
ueshin de6a87d
Fix style.
ueshin 4cd9c77
Remove `reset()` from `ColumnVector`.
ueshin a52d717
Move `isConstant` to `MutableColumnVector`.
ueshin d7b77f7
Remove unneeded cast.
ueshin 4d94655
Rename `MutableColumnVector` to `WritableColumnVector`.
ueshin ccb2d59
Move `childColumns` to more concrete class.
ueshin 5782cc4
Move initializing child columns into constructor.
ueshin 9eb88a8
Make ArrowColumnVector reusable.
ueshin 65cd681
Cast ColumnVector to WritableColumnVector when initializing.
ueshin 8330870
Rename a method `getColumnAsWritable` to `getWritableColumn`.
ueshin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ | |
|
|
||
| import org.apache.spark.sql.catalyst.util.DateTimeUtils; | ||
| import org.apache.spark.sql.execution.vectorized.ColumnVector; | ||
| import org.apache.spark.sql.execution.vectorized.MutableColumnVector; | ||
| import org.apache.spark.sql.types.DataTypes; | ||
| import org.apache.spark.sql.types.DecimalType; | ||
|
|
||
|
|
@@ -135,9 +136,9 @@ private boolean next() throws IOException { | |
| /** | ||
| * Reads `total` values from this columnReader into column. | ||
| */ | ||
| void readBatch(int total, ColumnVector column) throws IOException { | ||
| void readBatch(int total, MutableColumnVector column) throws IOException { | ||
| int rowId = 0; | ||
| ColumnVector dictionaryIds = null; | ||
| MutableColumnVector dictionaryIds = null; | ||
| if (dictionary != null) { | ||
| // SPARK-16334: We only maintain a single dictionary per row batch, so that it can be used to | ||
| // decode all previous dictionary encoded pages if we ever encounter a non-dictionary encoded | ||
|
|
@@ -219,7 +220,7 @@ void readBatch(int total, ColumnVector column) throws IOException { | |
| /** | ||
| * Reads `num` values into column, decoding the values from `dictionaryIds` and `dictionary`. | ||
| */ | ||
| private void decodeDictionaryIds(int rowId, int num, ColumnVector column, | ||
| private void decodeDictionaryIds(int rowId, int num, MutableColumnVector column, | ||
| ColumnVector dictionaryIds) { | ||
| switch (descriptor.getType()) { | ||
| case INT32: | ||
|
|
@@ -346,13 +347,13 @@ private void decodeDictionaryIds(int rowId, int num, ColumnVector column, | |
| * is guaranteed that num is smaller than the number of values left in the current page. | ||
| */ | ||
|
|
||
| private void readBooleanBatch(int rowId, int num, ColumnVector column) throws IOException { | ||
| private void readBooleanBatch(int rowId, int num, MutableColumnVector column) throws IOException { | ||
| assert(column.dataType() == DataTypes.BooleanType); | ||
| defColumn.readBooleans( | ||
| num, column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn); | ||
| } | ||
|
|
||
| private void readIntBatch(int rowId, int num, ColumnVector column) throws IOException { | ||
| private void readIntBatch(int rowId, int num, MutableColumnVector column) throws IOException { | ||
| // This is where we implement support for the valid type conversions. | ||
| // TODO: implement remaining type conversions | ||
| if (column.dataType() == DataTypes.IntegerType || column.dataType() == DataTypes.DateType || | ||
|
|
@@ -370,7 +371,7 @@ private void readIntBatch(int rowId, int num, ColumnVector column) throws IOExce | |
| } | ||
| } | ||
|
|
||
| private void readLongBatch(int rowId, int num, ColumnVector column) throws IOException { | ||
| private void readLongBatch(int rowId, int num, MutableColumnVector column) throws IOException { | ||
| // This is where we implement support for the valid type conversions. | ||
| if (column.dataType() == DataTypes.LongType || | ||
| DecimalType.is64BitDecimalType(column.dataType())) { | ||
|
|
@@ -389,7 +390,7 @@ private void readLongBatch(int rowId, int num, ColumnVector column) throws IOExc | |
| } | ||
| } | ||
|
|
||
| private void readFloatBatch(int rowId, int num, ColumnVector column) throws IOException { | ||
| private void readFloatBatch(int rowId, int num, MutableColumnVector column) throws IOException { | ||
| // This is where we implement support for the valid type conversions. | ||
| // TODO: support implicit cast to double? | ||
| if (column.dataType() == DataTypes.FloatType) { | ||
|
|
@@ -400,7 +401,7 @@ private void readFloatBatch(int rowId, int num, ColumnVector column) throws IOEx | |
| } | ||
| } | ||
|
|
||
| private void readDoubleBatch(int rowId, int num, ColumnVector column) throws IOException { | ||
| private void readDoubleBatch(int rowId, int num, MutableColumnVector column) throws IOException { | ||
| // This is where we implement support for the valid type conversions. | ||
| // TODO: implement remaining type conversions | ||
| if (column.dataType() == DataTypes.DoubleType) { | ||
|
|
@@ -411,7 +412,7 @@ private void readDoubleBatch(int rowId, int num, ColumnVector column) throws IOE | |
| } | ||
| } | ||
|
|
||
| private void readBinaryBatch(int rowId, int num, ColumnVector column) throws IOException { | ||
| private void readBinaryBatch(int rowId, int num, MutableColumnVector column) throws IOException { | ||
| // This is where we implement support for the valid type conversions. | ||
| // TODO: implement remaining type conversions | ||
| VectorizedValuesReader data = (VectorizedValuesReader) dataColumn; | ||
|
|
@@ -433,7 +434,8 @@ private void readBinaryBatch(int rowId, int num, ColumnVector column) throws IOE | |
| } | ||
|
|
||
| private void readFixedLenByteArrayBatch(int rowId, int num, | ||
| ColumnVector column, int arrayLen) throws IOException { | ||
| MutableColumnVector column, | ||
| int arrayLen) throws IOException { | ||
|
Contributor
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. nit: |
||
| VectorizedValuesReader data = (VectorizedValuesReader) dataColumn; | ||
| // This is where we implement support for the valid type conversions. | ||
| // TODO: implement remaining type conversions | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
row->rowId