Skip to content

Commit

Permalink
[3.4][SPARK-42239][SQL] Integrate `MUST_AGGREGATE_CORRELATED_SCALAR_S…
Browse files Browse the repository at this point in the history
…UBQUERY`

### What changes were proposed in this pull request?

backport for apache#39806

### Why are the changes needed?

We should want to include PRs related to error classes into Spark 3.4.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

The CI should pass.

Closes apache#39831 from itholic/42239-3.4.

Authored-by: itholic <haejoon.lee@databricks.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
  • Loading branch information
itholic authored and dongjoon-hyun committed Feb 1, 2023
1 parent 7272b3d commit 87ed98f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions core/src/main/resources/error/error-classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1675,11 +1675,6 @@
"Correlated scalar subqueries must be aggregated to return at most one row."
]
},
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY_OUTPUT" : {
"message" : [
"The output of a correlated scalar subquery must be aggregated."
]
},
"NON_CORRELATED_COLUMNS_IN_GROUP_BY" : {
"message" : [
"A GROUP BY clause in a scalar correlated subquery cannot contain non-correlated columns: <value>."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog with QueryErrorsB
if (aggregates.isEmpty) {
expr.failAnalysis(
errorClass = "UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY." +
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY_OUTPUT",
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY",
messageParameters = Map.empty)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ class SubquerySuite extends QueryTest
checkErrorMatchPVals(
exception2,
errorClass = "UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY." +
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY_OUTPUT",
"MUST_AGGREGATE_CORRELATED_SCALAR_SUBQUERY",
parameters = Map.empty[String, String],
sqlState = None,
context = ExpectedContext(
Expand Down

0 comments on commit 87ed98f

Please sign in to comment.