-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-41319][CONNECT][PYTHON] Implement Column.{when, otherwise} and Function when with UnresolvedFunction
#38956
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
Conversation
...talyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala
Outdated
Show resolved
Hide resolved
6d6b17c to
467b524
Compare
|
it keep failing in the invocation of constructor, I print the constructor as well as expressions in the error message, and they looks fine I also check in the shell: |
|
@hvanhovell I add the new constructor, but it kept failing in the invocation of constructor. I manually check the constructor and it seems fine. Do you have any ideas about it? |
|
@zhengruifeng let's check how the constructor resolution works in the FunctionRegistry. Alternatively we can use |
467b524 to
8317aa0
Compare
when with UnresolvedFunction
|
Fixed, the root cause is the previous constructor copied from https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala#L388-L395 failed due 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.
Does this need an additional test?
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.
let me see
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 we use the CaseWhen.createFromParser? You will need to register an ExpressionBuilder for this. The upside of this is that it is less messy in the constructor, and that there is ample testing for this from the parser.
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.
@hvanhovell what about we create CaseWhen in the connect planner , then we don't need to change sql side at all.
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 it is better to keep the connect planner as generic as possible. If we can use an unresolved function then it is better.
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.
oh, I mean we still use an unresolved function, and we can call CaseWhen.createFromParser in connect planner
grundprinzip
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 with one comment.
afde0de to
abe49da
Compare
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.
createFromParser was never used
make this change, since it causes MatchError
amaliujia
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
abe49da to
0e9ecb5
Compare
|
merged into master, thanks for the reviews |
HyukjinKwon
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, thx.
What changes were proposed in this pull request?
1, Implement
Column.{when, otherwise}and FunctionwhenWhy are the changes needed?
For API coverage
Does this PR introduce any user-facing change?
yes
How was this patch tested?
added UT