[GitHub] [spark] cloud-fan commented on a change in pull request #29167: [SPARK-32374][SQL] Disallow setting properties when creating temporary views
cloud-fan commented on a change in pull request #29167: URL: https://github.com/apache/spark/pull/29167#discussion_r459210115 ## File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ## @@ -266,6 +266,16 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils { } } + test("SPARK-32374: disallow setting properties for CREATE TEMPORARY VIEW") { +withTempView("myabcdview") { + val e = intercept[AnalysisException] { Review comment: interesting, the tests pass. Do you know why? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29167: [SPARK-32374][SQL] Disallow setting properties when creating temporary views
cloud-fan commented on a change in pull request #29167: URL: https://github.com/apache/spark/pull/29167#discussion_r459209763 ## File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ## @@ -266,6 +266,16 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils { } } + test("SPARK-32374: disallow setting properties for CREATE TEMPORARY VIEW") { +withTempView("myabcdview") { + val e = intercept[AnalysisException] { Review comment: parser exception? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29167: [SPARK-32374][SQL] Disallow setting properties when creating temporary views
cloud-fan commented on a change in pull request #29167: URL: https://github.com/apache/spark/pull/29167#discussion_r457834146 ## File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewSuite.scala ## @@ -266,6 +266,17 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils { } } + test("SPARK-32374: disallow setting properties for CREATE TEMPORARY VIEW") { +withTempView("myabcdview") { + val e = intercept[AnalysisException] { +sql("CREATE TEMPORARY VIEW myabcdview TBLPROPERTIES ('a' = 'b') AS SELECT * FROM jt") + } + assert(e.message.contains( +"Operation not allowed: CREATE TEMPORARY VIEW ... " + + "TBLPROPERTIES (property_name = property_value, ...)")) Review comment: how about: `Operation not allowed: TBLPROPERTIES can't coexist with CREATE TEMPORARY VIEW` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #29167: [SPARK-32374][SQL] Disallow setting properties when creating temporary views
cloud-fan commented on a change in pull request #29167: URL: https://github.com/apache/spark/pull/29167#discussion_r457833897 ## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala ## @@ -3515,6 +3515,13 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging } } +val properties = ctx.tablePropertyList.asScala.headOption.map(visitPropertyKeyValues) + .getOrElse(Map.empty) +if (ctx.TEMPORARY != null && !properties.isEmpty) { + operationNotAllowed( +"CREATE TEMPORARY VIEW ... TBLPROPERTIES (property_name = property_value, ...)", ctx) Review 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. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org