Skip to content

[SPARK-57724][SQL] Add missing error class MISSING_CLAUSES_FOR_OPERATION#56827

Open
anew wants to merge 1 commit into
apache:masterfrom
anew:SPARK-57724
Open

[SPARK-57724][SQL] Add missing error class MISSING_CLAUSES_FOR_OPERATION#56827
anew wants to merge 1 commit into
apache:masterfrom
anew:SPARK-57724

Conversation

@anew

@anew anew commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

SPARK-54405 (METRIC VIEW) introduced error handling that throws the MISSING_CLAUSES_FOR_OPERATION error class from QueryParsingErrors.missingClausesForOperation, but never registered it in error-conditions.json. Register the error condition so the error class resolves correctly through the error-handling framework.

Why are the changes needed?

This error class was used but not declared.

Does this PR introduce any user-facing change?

No

How was this patch tested?

No tests

Generated-by: Opus 4.8

SPARK-54405 (METRIC VIEW) introduced error handling that throws the
`MISSING_CLAUSES_FOR_OPERATION` error class from
`QueryParsingErrors.missingClausesForOperation`, but never registered it
in `error-conditions.json`. Register the error condition so the error
class resolves correctly through the error-handling framework.

Co-authored-by: Isaac
@szehon-ho

Copy link
Copy Markdown
Member

@linhongliu-db

},
"sqlState" : "0A000"
},
"MISSING_CLAUSES_FOR_OPERATION" : {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for fixing. can you please add a test case for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how to test this... can you point me to an example of a test for one of the other error classes?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you try sql/core/src/test/scala/org/apache/spark/sql/errors/QueryParsingErrorsSuite.scala and add

test("xxx") {
  val query =
    """CREATE VIEW mv
      |LANGUAGE YAML
      |AS
      |$$
      |version: 0.1
      |$$""".stripMargin

  checkError(
    exception = parseException(query),
    condition = "MISSING_CLAUSES_FOR_OPERATION",
    sqlState = "42601",
    parameters = Map(
      "clauses" -> "WITH METRICS",
      "operation" -> "METRIC VIEW CREATION"),
    context = ExpectedContext(
      fragment = query,
      start = 0,
      stop = query.length - 1))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants