Uh oh!
There was an error while loading. Please reload this page.
[SPARK-28441][SQL][Python] Fix error when non-foldable expression is used in correlated scalar subquery - #25204
Closed
viirya wants to merge 11 commits into
Closed
[SPARK-28441][SQL][Python] Fix error when non-foldable expression is used in correlated scalar subquery#25204viirya wants to merge 11 commits into
viirya wants to merge 11 commits into
Conversation
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
In SPARK-15370, We checked the expression at the root of the correlated subquery, in order to fix count bug. If a
PythonUDFin in the checking path, evaluating it causes the failure as we can't statically evaluatePythonUDF. The Python UDF test added at SPARK-28277 shows this issue.If we can statically evaluate the expression, we intercept NULL values coming from the outer join and replace them with the value that the subquery's expression like before, if it is not, we replace them with the
PythonUDFexpression, with statically evaluated parameters.After this, the last query in
udf-except.sqlwhich throwsjava.lang.UnsupportedOperationExceptioncan be run:Note that this issue is also for other non-foldable expressions, like rand. As like PythonUDF, we can't call
evalon this kind of expressions in optimization. The evaluation needs to defer to query runtime.How was this patch tested?
Added tests.