[SPARK-32374][SQL] Disallow setting properties when creating temporary views#29167
[SPARK-32374][SQL] Disallow setting properties when creating temporary views#29167imback82 wants to merge 7 commits intoapache:masterfrom
Conversation
| .getOrElse(Map.empty) | ||
| if (ctx.TEMPORARY != null && !properties.isEmpty) { | ||
| operationNotAllowed( | ||
| "CREATE TEMPORARY VIEW ... TBLPROPERTIES (property_name = property_value, ...)", ctx) |
There was a problem hiding this comment.
This can be moved to CreateViewCommand if that is a better place to check this:
There was a problem hiding this comment.
I think we should move that check to the parser as well (in a separate PR). If we support view in DS v2, we shouldn't duplicated the check in both v1 and v2 commands.
|
Test build #126196 has finished for PR 29167 at commit
|
|
Could you fix the UT failure? |
| intercept(sql2, "Found duplicate clauses: TBLPROPERTIES") | ||
| } | ||
|
|
||
| test("create temporary view with properties not allowed") { |
There was a problem hiding this comment.
It would be great if we can have a JIRA ID prefix like SPARK-32374: .
|
Hmm, does it mean the specified properties are not used by Spark currently? If users possibly already use it? |
Correct, they are not being used for temporary views. Thus, if you run Btw, properties are used for |
|
Test build #126202 has finished for PR 29167 at commit
|
|
cc @cloud-fan |
| } | ||
| assert(e.message.contains( | ||
| "Operation not allowed: CREATE TEMPORARY VIEW ... " + | ||
| "TBLPROPERTIES (property_name = property_value, ...)")) |
There was a problem hiding this comment.
how about: Operation not allowed: TBLPROPERTIES can't coexist with CREATE TEMPORARY VIEW
|
Test build #126268 has finished for PR 29167 at commit
|
|
Test build #126269 has finished for PR 29167 at commit
|
|
|
||
| test("SPARK-32374: disallow setting properties for CREATE TEMPORARY VIEW") { | ||
| withTempView("myabcdview") { | ||
| val e = intercept[AnalysisException] { |
There was a problem hiding this comment.
interesting, the tests pass. Do you know why?
There was a problem hiding this comment.
Oh because ParseException extends AnalysisException. I will update this.
|
Test build #126380 has finished for PR 29167 at commit
|
|
retest this please |
|
Test build #126395 has finished for PR 29167 at commit
|
|
thanks, merging to master! |
What changes were proposed in this pull request?
Currently, you can specify properties when creating a temporary view. However, the specified properties are not used and can be misleading.
This PR propose to disallow specifying properties when creating temporary views.
Why are the changes needed?
To avoid confusion by disallowing specifying unused properties.
Does this PR introduce any user-facing change?
Yes, now if you create a temporary view with properties, the operation will fail:
How was this patch tested?
Added tests