Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-37716][SQL] Improve error messages when a LateralJoin has non-…
…deterministic expressions ### What changes were proposed in this pull request? This PR allows the LateralJoin node's lateral subquery field to host non-deterministic expressions when the outer relation can produce at most one row. It also improves the error messages when a lateral join contains non-deterministic expressions that are not currently supported. ### Why are the changes needed? SPARK-37199 changes PlanExpression's `deterministic` field definition: both the children and the plan itself have to be deterministic for the plan expression to be deterministic. So users can no longer use lateral join with non-deterministic lateral subqueries. This PR is to improve the error messages and allows a special case when the outer query only produces at most one row. ### Does this PR introduce _any_ user-facing change? Yes. Improve error messages: Before: ``` org.apache.spark.sql.AnalysisException: nondeterministic expressions are only allowed in Project, Filter, Aggregate or Window ``` After ``` Non-deterministic lateral subqueries are not supported when joining with outer relations that produce more than one row -- Or Lateral join condition cannot be non-deterministic: ``` ### How was this patch tested? SQL query tests. Closes #34987 from allisonwang-db/spark-37716-lateral-join. Authored-by: allisonwang-db <allison.wang@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
- Loading branch information
1 parent
780cf3c
commit 67c39a0
Showing
3 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters