-
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] Implement getChild for a few remaining column vectors #2133
[Kernel] Implement getChild for a few remaining column vectors #2133
Conversation
c87daed
to
dd3a925
Compare
dd3a925
to
a468fab
Compare
@@ -120,4 +123,16 @@ public Row getStruct(int rowId) { | |||
public ArrayValue getArray(int rowId) { | |||
return (ArrayValue) value; | |||
} | |||
|
|||
@Override |
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.
Seems incomplete to ignore DefaultConstantVector but this should never be used. I think possible options
- Restrict DefaultConstantVector to only allow StructType for null values (for
NonExistentColumnConverter
) - Provide this implementation and add a test somewhere (not sure where to put this?)
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.
Option 1 + restrict it for Map and Array types for non-null values only?
kernel/kernel-api/src/test/java/io/delta/kernel/internal/types/JsonHandlerTestImpl.java
Outdated
Show resolved
Hide resolved
@@ -120,4 +123,16 @@ public Row getStruct(int rowId) { | |||
public ArrayValue getArray(int rowId) { | |||
return (ArrayValue) value; | |||
} | |||
|
|||
@Override |
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.
Option 1 + restrict it for Map and Array types for non-null values only?
@@ -136,6 +137,17 @@ public MapValue getMap(int rowId) { | |||
return (MapValue) values[rowId]; | |||
} | |||
|
|||
@Override |
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.
Can DefaultConstantVector
be derived from DefaultGenericVector
? If yes, then we can reduce the code size bit.
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.
We could combine them and use a function like "value accessor" possibly? Then all the class does really is cast
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.
Can't restrict the types then though
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.
You can add the type checks in DefaultConstantVector
constructor (this will just have the constructor)
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.
Combined them here instead
/** | ||
* {@link ColumnVector} wrapper on top of {@link Row} objects. This wrapper allows referencing | ||
* any nested level column vector from a set of rows. | ||
* TODO: We should change the {@link io.delta.kernel.defaults.client.DefaultJsonHandler} to |
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.
is this TODO still needed?
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.
yes I think so we're still just wrapping rows in DefaultRowBasedColumnarBatch
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.
Moving the todo to a more appropriate spot
## 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.
…-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.
Which Delta project/connector is this regarding?
Description
Provides implementations for
getChild
for column vectors that are missing them.How was this patch tested?
Adds simple tests for
DefaultViewVector
andDefaultGenericVector
(used by complex types in the JSON handler).#2131 also is based off these changes and uses
getChild
instead ofgetStruct
everywhere in the code.