Skip to content

[SPARK-52156][SQL] Put legacy CREATE TEMPORARY TABLE ... USING provider under the flag #50902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mihailom-db
Copy link
Contributor

What changes were proposed in this pull request?

Blocking legacy feature of CREATE TEMPORARY TABLE ... USING under the flag. The default keeps it enabled.

Why are the changes needed?

CREATE TEMPORARY TABLE ... USING provider uses legacy path which creates views with LogicalPlan for storage instead of sqlText. This could pose a problem for systems that rely on sqlText being present and we want to provide users with the option to disable it.

Does this PR introduce any user-facing change?

No, just a guard for a legacy feature.

How was this patch tested?

Test added to the relevant suite.

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

No.

@github-actions github-actions bot added the SQL label May 15, 2025
@@ -361,6 +361,11 @@ class SparkSqlAstBuilder extends AstBuilder {
invalidStatement("CREATE TEMPORARY TABLE IF NOT EXISTS", ctx)
}

if (ctx.tableProvider != null
&& conf.getConf(SQLConf.BLOCK_CREATE_TEMP_TABLE_WITH_PROVIDER)) {
throw invalidStatement("CREATE TEMPORARY TABLE ... USING", ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

shall have customize the error message to say that they can do CREATE TEMP VIEW ... USING instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we just move the check under the logWarning which is already there or create separate error?

@mihailom-db mihailom-db requested a review from cloud-fan May 15, 2025 12:53
@@ -250,6 +250,13 @@ object SQLConf {
.booleanConf
.createWithDefault(true)

val BLOCK_CREATE_TEMP_TABLE_USING_PROVIDER =
buildConf("spark.sql.blockCreateTempTableUsingProvider")
Copy link
Member

Choose a reason for hiding this comment

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

should the conf under spark.sql.legacy. namespace? e.g. spark.sql.legacy.allowCreateTempTableUsingProvider, and don't forget the .version("4.1.0") though it's an internal conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants