-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-54240] Translate get array item catalyst expression to connector expression #52940
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
base: master
Are you sure you want to change the base?
[SPARK-54240] Translate get array item catalyst expression to connector expression #52940
Conversation
milastdbx
left a comment
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
| case _: StringRPad => generateExpressionWithName("RPAD", expr, isPredicate) | ||
| case GetArrayItem(_, _, failOnError) if failOnError => | ||
| // Pushdown only if ANSI is enabled (fail on error) to be compatible with remote systems. | ||
| generateExpressionWithName("GET_ARRAY_ITEM", expr, isPredicate) |
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 can make new v2 expression as well to be able to pass failOnError argument, since get method in spark returns 0-indexed element of array, but it does not fail for index out of bounds, so it would be beneficial to pass failOnError to be able to support get method pushdown beside bracket access. WDYT @srielau @cloud-fan ?
| "Failed to encode a value of the expressions: <expressions> to a row." | ||
| ], | ||
| "sqlState" : "42846" | ||
| }, |
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 did not find we have similar non legacy error. Legacy errors are usually too specific, e.g. unsupported function.
|
|
||
| public Expression getChildArray() { return this.childArray; } | ||
| public Expression getOrdinal() { return this.ordinal; } | ||
| public boolean getFailOnError() { return this.failOnError; } |
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 don't see the get prefix in other v2 expressions such as Cast. Can we be consistent here?
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, makes sense 😄
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.
Done
What changes were proposed in this pull request?
Why are the changes needed?
Does this PR introduce any user-facing change?
No
How was this patch tested?
No testing needed, since we did not implement pushdowns yet
Was this patch authored or co-authored using generative AI tooling?
No