-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Kernel] Remove the ColumnVector::getStruct API #2131
[Kernel] Remove the ColumnVector::getStruct API #2131
Conversation
ec680ff
to
9e25ae4
Compare
## Description Provides implementations for `getChild` for column vectors that are missing them. ## How was this patch tested? Adds simple tests for `DefaultViewVector` and `DefaultGenericVector` (used by complex types in the JSON handler). #2131 also is based off these changes and uses `getChild` instead of `getStruct` everywhere in the code.
## Description Provides implementations for `getChild` for column vectors that are missing them. ## How was this patch tested? Adds simple tests for `DefaultViewVector` and `DefaultGenericVector` (used by complex types in the JSON handler). #2131 also is based off these changes and uses `getChild` instead of `getStruct` everywhere in the code.
9e25ae4
to
330e9f3
Compare
/** | ||
* Wrapper around list of {@link Row}s to expose the rows as a column vector | ||
*/ | ||
private static class RowBasedVector implements ColumnVector { |
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.
had to add this until/if we decide to remove JsonHandlerTestImpl
kernel/kernel-api/src/main/java/io/delta/kernel/internal/actions/Format.java
Show resolved
Hide resolved
Format.fromRow(requireNonNull(row, 0, "id").getStruct(3)), | ||
requireNonNull(vector.getChild(0), rowId, "id").getString(rowId), | ||
Optional.ofNullable(vector.getChild(1).isNullAt(rowId) ? null : | ||
vector.getChild(1).getString(rowId)), |
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.
what is the cost of getChild
? Wondering with this approach are we creating too many objects?
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.
I think depends on the implementation; some create wrapper objects, we can update those implementations to only create the child vectors once.
It's no more object creation than the row API (and often less) since we'd create a wrapper row each getStruct
call
kernel/kernel-api/src/main/java/io/delta/kernel/utils/Utils.java
Outdated
Show resolved
Hide resolved
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.
lgtm
## Description Removes the `getStruct` API from `ColumnVector`. We will use a wrapper to convert to rows only for the ColumnarBatch/FilteredColumnarBatch row-based processing APIs. ## How was this patch tested? Existing tests should suffice.
…-io#2133) ## Description Provides implementations for `getChild` for column vectors that are missing them. ## How was this patch tested? Adds simple tests for `DefaultViewVector` and `DefaultGenericVector` (used by complex types in the JSON handler). delta-io#2131 also is based off these changes and uses `getChild` instead of `getStruct` everywhere in the code.
## Description Removes the `getStruct` API from `ColumnVector`. We will use a wrapper to convert to rows only for the ColumnarBatch/FilteredColumnarBatch row-based processing APIs. ## How was this patch tested? Existing tests should suffice.
Which Delta project/connector is this regarding?
Description
Removes the
getStruct
API fromColumnVector
. We will use a wrapper to convert to rows only for the ColumnarBatch/FilteredColumnarBatch row-based processing APIs.How was this patch tested?
Existing tests should suffice.