-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-33558][SQL][TESTS] Unify v1 and v2 ALTER TABLE .. ADD PARTITION tests #30685
[SPARK-33558][SQL][TESTS] Unify v1 and v2 ALTER TABLE .. ADD PARTITION tests #30685
Conversation
"part6" -> "abc", | ||
"part7" -> "true", | ||
"part8" -> "2020-11-23", | ||
"part9" -> s"2020-11-23${if (version == "V2") " " else "T"}22:13:10.123456") |
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.
Here is the behavior diff between V1 and V2 in showing partitions.
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.
Actually, V1 doesn't care of correctness of partition values. We can create partitions with any garbage like 2020-11-23 --22:13:10.123456
. V1 takes the string AS IS, and creates partition. No checks that partition value matches partition field type.
sql(s"CREATE TABLE $t (id bigint, data string) $defaultUsing PARTITIONED BY (id)") | ||
sql(s"ALTER TABLE $t ADD PARTITION (id=2) LOCATION 'loc1'") | ||
|
||
val errMsg = intercept[AnalysisException] { |
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.
Here is one more difference: Hive's exception is not handled, and propagated to the upper layer. Comparing to V1 (in-memory) and V2, where PartitionsAlreadyExistException
is thrown.
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.
We should try-catch the hive exception and throw PartitionsAlreadyExistException
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.
Sure, I will open JIRA for that, and fix separately since this PR is about test changes.
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.
Here is the fix #30711
.set(s"spark.sql.catalog.$catalog", classOf[InMemoryPartitionTableCatalog].getName) | ||
.set(s"spark.sql.catalog.non_part_$catalog", classOf[InMemoryTableCatalog].getName) | ||
|
||
override protected def checkLocation( |
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.
We will remove this after SPARK-33393
@cloud-fan @HyukjinKwon Please, have a look at this PR. |
Kubernetes integration test starting |
Kubernetes integration test status failure |
Test build #132493 has finished for PR 30685 at commit
|
protected def withNsTable(ns: String, tableName: String)(f: String => Unit): Unit = { | ||
withNamespace(ns) { | ||
sql(s"CREATE NAMESPACE $ns") | ||
val t = s"$ns.$tableName" |
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.
nit: the caller side can just pass in the namespace, and here we return $catalog.$ns.$tableName
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.
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.
an alternative is: def withNsTable(ns: String, tableName: String, cat: String = catalog)
...rc/test/scala/org/apache/spark/sql/execution/command/AlterTableAddPartitionParserSuite.scala
Outdated
Show resolved
Hide resolved
Kubernetes integration test starting |
Kubernetes integration test status failure |
Test build #132509 has finished for PR 30685 at commit
|
Test build #132513 has finished for PR 30685 at commit
|
thanks, merging to master/3.1! (since it's test only) |
…N tests ### What changes were proposed in this pull request? 1. Move the `ALTER TABLE .. ADD PARTITION` parsing tests to `AlterTableAddPartitionParserSuite` 2. Place v1 tests for `ALTER TABLE .. ADD PARTITION` from `DDLSuite` and v2 tests from `AlterTablePartitionV2SQLSuite` to the common trait `AlterTableAddPartitionSuiteBase`, so, the tests will run for V1, Hive V1 and V2 DS. ### Why are the changes needed? - The unification will allow to run common `ALTER TABLE .. ADD PARTITION` tests for both DSv1 and Hive DSv1, DSv2 - We can detect missing features and differences between DSv1 and DSv2 implementations. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? By running new test suites: ``` $ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *AlterTableAddPartitionSuite" ``` Closes #30685 from MaxGekk/unify-alter-table-add-partition-tests. Authored-by: Max Gekk <max.gekk@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit af37c7f) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
I've reverted it from 3.1, as the tests failed. It's probably because some v2 PRs go to master only. |
What changes were proposed in this pull request?
ALTER TABLE .. ADD PARTITION
parsing tests toAlterTableAddPartitionParserSuite
ALTER TABLE .. ADD PARTITION
fromDDLSuite
and v2 tests fromAlterTablePartitionV2SQLSuite
to the common traitAlterTableAddPartitionSuiteBase
, so, the tests will run for V1, Hive V1 and V2 DS.Why are the changes needed?
ALTER TABLE .. ADD PARTITION
tests for both DSv1 and Hive DSv1, DSv2Does this PR introduce any user-facing change?
No
How was this patch tested?
By running new test suites: