You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/31 20:12:17 UTC
[GitHub] [spark] imback82 commented on a change in pull request #31405: [SPARK-34304][SQL] Remove view checks in v1 alter table commands
imback82 commented on a change in pull request #31405:
URL: https://github.com/apache/spark/pull/31405#discussion_r567477784
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/command/AlterTableDropPartitionSuiteBase.scala
##########
@@ -222,12 +222,46 @@ trait AlterTableDropPartitionSuiteBase extends QueryTest with DDLCommandTestUtil
}
val v2 = s"${spark.sharedState.globalTempViewManager.database}.v2"
- withGlobalTempView(v2) {
+ withGlobalTempView("v2") {
sql(s"CREATE GLOBAL TEMP VIEW v2 AS SELECT * FROM $t")
cacheRelation(v2)
sql(s"ALTER TABLE $t DROP PARTITION (part=3)")
checkCachedRelation(v2, Seq(Row(0, 0)))
}
}
}
+
+ test("SPARK-34304: dripping partitions from views is not allowed") {
+ withNamespaceAndTable("ns", "tbl") { t =>
+ sql(s"CREATE TABLE $t (id INT, part INT) $defaultUsing PARTITIONED BY (part)")
+ sql(s"INSERT INTO $t PARTITION (part=0) SELECT 0")
+ def checkViewAltering(createViewCmd: String, alterCmd: String): Unit = {
+ sql(createViewCmd)
+ val errMsg = intercept[AnalysisException] {
+ sql(alterCmd)
+ }.getMessage
+ assert(errMsg.contains("'ALTER TABLE ... DROP PARTITION ...' expects a table"))
+ checkPartitions(t, Map("part" -> "0"))
Review comment:
why do we need to check partitions inside `checkViewAltering`?
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org