Skip to content

Commit 3aa92fb

Browse files
itholicMaxGekk
authored andcommitted
[SPARK-42239][SQL] Integrate MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY
### What changes were proposed in this pull request? This is raised from https://github.com/apache/spark/pull/39543/files#r1082159637, to integrate the `MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY` and `MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY_OUTPUT` ### Why are the changes needed? Logically, `MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY` and `MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY_OUTPUT` are exactly the same. We should deduplicate the error classes when possible. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Updated the existing UT. Closes #39806 from itholic/MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY1. Authored-by: itholic <[email protected]> Signed-off-by: Max Gekk <[email protected]>
1 parent c1bee10 commit 3aa92fb

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

core/src/main/resources/error/error-classes.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,11 +1703,6 @@
17031703
"Correlated scalar subqueries must be aggregated to return at most one row."
17041704
]
17051705
},
1706-
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY_OUTPUT" : {
1707-
"message" : [
1708-
"The output of a correlated scalar subquery must be aggregated."
1709-
]
1710-
},
17111706
"NON_CORRELATED_COLUMNS_IN_GROUP_BY" : {
17121707
"message" : [
17131708
"A GROUP BY clause in a scalar correlated subquery cannot contain non-correlated columns: <value>."

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog with QueryErrorsB
868868
if (aggregates.isEmpty) {
869869
expr.failAnalysis(
870870
errorClass = "UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY." +
871-
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY_OUTPUT",
871+
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY",
872872
messageParameters = Map.empty)
873873
}
874874

sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ class SubquerySuite extends QueryTest
558558
checkErrorMatchPVals(
559559
exception2,
560560
errorClass = "UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY." +
561-
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY_OUTPUT",
561+
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY",
562562
parameters = Map.empty[String, String],
563563
sqlState = None,
564564
context = ExpectedContext(

0 commit comments

Comments
 (0)