Skip to content

Commit

Permalink
[SPARK-50015][SQL] Assign appropriate error condition for `_LEGACY_ER…
Browse files Browse the repository at this point in the history
…ROR_TEMP_1125`: `MISSING_DATABASE_FOR_V1_SESSION_CATALOG`

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

This PR proposes to assign proper error condition & sqlstate for `_LEGACY_ERROR_TEMP_1125`: `MISSING_DATABASE_FOR_V1_SESSION_CATALOG`

### Why are the changes needed?

To improve the error message by assigning proper error condition and SQLSTATE

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

No, only user-facing error message improved

### How was this patch tested?

Updated the existing tests

### Was this patch authored or co-authored using generative AI tooling?

No

Closes #48652 from itholic/LEGACY_1125.

Authored-by: Haejoon Lee <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
  • Loading branch information
itholic authored and MaxGekk committed Oct 25, 2024
1 parent 413a65b commit 3da8f70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3477,6 +3477,12 @@
},
"sqlState" : "XX000"
},
"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."
],
"sqlState" : "3F000"
},
"MISSING_GROUP_BY" : {
"message" : [
"The query does not include a GROUP BY clause. Add GROUP BY or turn it into the window functions using OVER clauses."
Expand Down Expand Up @@ -6157,11 +6163,6 @@
"Cannot rename a table with ALTER VIEW. Please use ALTER TABLE instead."
]
},
"_LEGACY_ERROR_TEMP_1125" : {
"message" : [
"Database from v1 session catalog is not specified."
]
},
"_LEGACY_ERROR_TEMP_1126" : {
"message" : [
"Nested databases are not supported by v1 session catalog: <catalog>."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat

def databaseFromV1SessionCatalogNotSpecifiedError(): Throwable = {
new AnalysisException(
errorClass = "_LEGACY_ERROR_TEMP_1125",
errorClass = "MISSING_DATABASE_FOR_V1_SESSION_CATALOG",
messageParameters = Map.empty)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ trait ShowTablesSuiteBase extends command.ShowTablesSuiteBase with command.Tests
exception = intercept[AnalysisException] {
sql(showTableCmd)
},
condition = "_LEGACY_ERROR_TEMP_1125",
condition = "MISSING_DATABASE_FOR_V1_SESSION_CATALOG",
parameters = Map.empty
)
}
Expand Down

0 comments on commit 3da8f70

Please sign in to comment.