Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5542,6 +5542,12 @@
},
"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))
}

"message" : [
"Missing required clause(s) <clauses> for operation <operation>."
],
"sqlState" : "42601"
},
"MISSING_DATABASE_FOR_V1_SESSION_CATALOG" : {
"message" : [
"Database name is not specified in the v1 session catalog. Please ensure to provide a valid database name when interacting with the v1 catalog."
Expand Down