Skip to content

[SQL] Assign a name to the error condition _LEGACY_ERROR_TEMP_2033 - #58219

Open
dkling-it wants to merge 1 commit into
apache:masterfrom
dkling-it:name-legacy-error-2033
Open

[SQL] Assign a name to the error condition _LEGACY_ERROR_TEMP_2033#58219
dkling-it wants to merge 1 commit into
apache:masterfrom
dkling-it:name-legacy-error-2033

Conversation

@dkling-it

Copy link
Copy Markdown

What changes were proposed in this pull request?

Renames _LEGACY_ERROR_TEMP_2033 to UNABLE_TO_CREATE_DATABASE. It's raised by QueryExecutionErrors.unableToCreateDatabaseAsFailedToCreateDirectoryError when InMemoryCatalog.createDatabase can't create the database's backing directory. SQLSTATE 58030 follows the same convention as other filesystem I/O failures such as FAILED_CREATE_CHECKPOINT_DIRECTORY and UNABLE_TO_FETCH_HIVE_TABLES. Message text and parameters are unchanged.

Why are the changes needed?

Part of the SPARK-37935 effort to replace _LEGACY_ERROR_TEMP_* placeholders with proper error conditions.

Does this PR introduce any user-facing change?

Yes. The error condition name changes from _LEGACY_ERROR_TEMP_2033 to UNABLE_TO_CREATE_DATABASE and now carries SQLSTATE 58030. The rendered message is unchanged.

How was this patch tested?

Added a checkError test in InMemoryCatalogSuite that points createDatabase at a location nested under an existing regular file, so directory creation fails and the new condition fires. Ran InMemoryCatalogSuite and SparkThrowableSuite locally; both pass.

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

No.

Rename _LEGACY_ERROR_TEMP_2033 to UNABLE_TO_CREATE_DATABASE. It's raised
by QueryExecutionErrors.unableToCreateDatabaseAsFailedToCreateDirectoryError
when InMemoryCatalog.createDatabase can't create the database's backing
directory. SQLSTATE 58030 matches other filesystem I/O failures such as
FAILED_CREATE_CHECKPOINT_DIRECTORY and UNABLE_TO_FETCH_HIVE_TABLES.
Message text and parameters stay the same.

Added a checkError test in InMemoryCatalogSuite that triggers the error
by pointing createDatabase at a location nested under an existing file.

JIRA ticket pending; will fill in the SPARK-XXXXX id before merge.
@dkling-it
dkling-it force-pushed the name-legacy-error-2033 branch from 79dbba8 to 9b396be Compare August 22, 2026 07:56

@nchammas nchammas left a comment

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.

Thanks for working on this. Took a quick look. Will take a closer look during the week.

I think you need to create a sub-task on SPARK-37935 and use that new ticket number in the PR title.

dbDefinition: CatalogDatabase, e: IOException): Throwable = {
new SparkException(
errorClass = "_LEGACY_ERROR_TEMP_2033",
errorClass = "UNABLE_TO_CREATE_DATABASE",

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.

This error condition is more general than the actual failure path here. Why not UNABLE_TO_CREATE_DATABASE_DIRECTORY?

(Unfortunately, the code still uses "error class" in many places to refer to what is correctly called an "error condition".)

@nchammas
nchammas requested a review from MaxGekk August 23, 2026 15:23

@uros-b uros-b left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@dkling-it Pleaes file a Jira ID for this PR.

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