-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-32512][SQL][TESTS][FOLLOWUP] Remove duplicate tests for ALTER TABLE .. PARTITIONS from DataSourceV2SQLSuite #30444
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
Conversation
test("ALTER TABLE RECOVER PARTITIONS") { | ||
val t = "testcat.ns1.ns2.tbl" | ||
withTable(t) { | ||
spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo") | ||
val e = intercept[AnalysisException] { | ||
sql(s"ALTER TABLE $t RECOVER PARTITIONS") | ||
} | ||
assert(e.message.contains("ALTER TABLE RECOVER PARTITIONS is only supported with v1 tables")) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spark/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala
Lines 32 to 41 in 1eb236b
test("ALTER TABLE RECOVER PARTITIONS") { | |
val t = "testcat.ns1.ns2.tbl" | |
withTable(t) { | |
spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo") | |
val e = intercept[AnalysisException] { | |
sql(s"ALTER TABLE $t RECOVER PARTITIONS") | |
} | |
assert(e.message.contains("ALTER TABLE RECOVER PARTITIONS is only supported with v1 tables")) | |
} | |
} |
test("ALTER TABLE ADD PARTITION") { | ||
val t = "testpart.ns1.ns2.tbl" | ||
withTable(t) { | ||
spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo PARTITIONED BY (id)") | ||
spark.sql(s"ALTER TABLE $t ADD PARTITION (id=1) LOCATION 'loc'") | ||
|
||
val partTable = catalog("testpart").asTableCatalog | ||
.loadTable(Identifier.of(Array("ns1", "ns2"), "tbl")).asInstanceOf[InMemoryPartitionTable] | ||
assert(partTable.partitionExists(InternalRow.fromSeq(Seq(1)))) | ||
|
||
val partMetadata = partTable.loadPartitionMetadata(InternalRow.fromSeq(Seq(1))) | ||
assert(partMetadata.containsKey("location")) | ||
assert(partMetadata.get("location") == "loc") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spark/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala
Lines 43 to 57 in 1eb236b
test("ALTER TABLE ADD PARTITION") { | |
val t = "testpart.ns1.ns2.tbl" | |
withTable(t) { | |
spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo PARTITIONED BY (id)") | |
spark.sql(s"ALTER TABLE $t ADD PARTITION (id=1) LOCATION 'loc'") | |
val partTable = catalog("testpart").asTableCatalog | |
.loadTable(Identifier.of(Array("ns1", "ns2"), "tbl")).asInstanceOf[InMemoryPartitionTable] | |
assert(partTable.partitionExists(InternalRow.fromSeq(Seq(1)))) | |
val partMetadata = partTable.loadPartitionMetadata(InternalRow.fromSeq(Seq(1))) | |
assert(partMetadata.containsKey("location")) | |
assert(partMetadata.get("location") == "loc") | |
} | |
} |
test("ALTER TABLE RENAME PARTITION") { | ||
val t = "testcat.ns1.ns2.tbl" | ||
withTable(t) { | ||
spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo PARTITIONED BY (id)") | ||
val e = intercept[AnalysisException] { | ||
sql(s"ALTER TABLE $t PARTITION (id=1) RENAME TO PARTITION (id=2)") | ||
} | ||
assert(e.message.contains("ALTER TABLE RENAME PARTITION is only supported with v1 tables")) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spark/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala
Lines 103 to 112 in 1eb236b
test("ALTER TABLE RENAME PARTITION") { | |
val t = "testcat.ns1.ns2.tbl" | |
withTable(t) { | |
spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo PARTITIONED BY (id)") | |
val e = intercept[AnalysisException] { | |
sql(s"ALTER TABLE $t PARTITION (id=1) RENAME TO PARTITION (id=2)") | |
} | |
assert(e.message.contains("ALTER TABLE RENAME PARTITION is only supported with v1 tables")) | |
} | |
} |
test("ALTER TABLE DROP PARTITION") { | ||
val t = "testpart.ns1.ns2.tbl" | ||
withTable(t) { | ||
spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo PARTITIONED BY (id)") | ||
spark.sql(s"ALTER TABLE $t ADD PARTITION (id=1) LOCATION 'loc'") | ||
spark.sql(s"ALTER TABLE $t DROP PARTITION (id=1)") | ||
|
||
val partTable = | ||
catalog("testpart").asTableCatalog.loadTable(Identifier.of(Array("ns1", "ns2"), "tbl")) | ||
assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(1)))) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spark/sql/core/src/test/scala/org/apache/spark/sql/connector/AlterTablePartitionV2SQLSuite.scala
Lines 114 to 125 in 1eb236b
test("ALTER TABLE DROP PARTITION") { | |
val t = "testpart.ns1.ns2.tbl" | |
withTable(t) { | |
spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo PARTITIONED BY (id)") | |
spark.sql(s"ALTER TABLE $t ADD PARTITION (id=1) LOCATION 'loc'") | |
spark.sql(s"ALTER TABLE $t DROP PARTITION (id=1)") | |
val partTable = | |
catalog("testpart").asTableCatalog.loadTable(Identifier.of(Array("ns1", "ns2"), "tbl")) | |
assert(!partTable.asPartitionable.partitionExists(InternalRow.fromSeq(Seq(1)))) | |
} | |
} |
Kubernetes integration test starting |
GA passed, merging to master, thanks! |
Kubernetes integration test status success |
Test build #131422 has finished for PR 30444 at commit
|
What changes were proposed in this pull request?
Remove tests from
DataSourceV2SQLSuite
that were copied toAlterTablePartitionV2SQLSuite
by #29339.Why are the changes needed?
Does this PR introduce any user-facing change?
No
How was this patch tested?
By running the modified tests: