-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-33742][SQL] Throw PartitionsAlreadyExistException from HiveExternalCatalog.createPartitions() #30711
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
| var cause = e | ||
| var found = false | ||
| while (!found && depth < maxDepth && cause != null) { | ||
| found = cause.getClass.getCanonicalName == classOf[AlreadyExistsException].getCanonicalName |
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.
I had to compare exceptions by their names because pattern matching and isInstanceOf don't work as we could expect. See the comment:
spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala
Lines 83 to 84 in 781e19c
| * Due to classloader isolation issues, pattern matching won't work here so we need | |
| * to compare the canonical names of the exceptions, which we assume to be stable. |
| } | ||
|
|
||
| private def isAlreadyExistsException(e: Throwable): Boolean = { | ||
| val maxDepth = 4 |
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.
did you test with different hive versions? one idea is to re-throw the exception in HiveClientImpl, and we can test it in VersionsSuite.
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.
done. Added a test to VersionsSuite.
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #132583 has finished for PR 30711 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #132590 has finished for PR 30711 at commit
|
|
Retest this please |
dongjoon-hyun
left a comment
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.
+1, LGTM.
Merged to master for Apache Spark 3.2.0.
Could you make backporting PRs for the older release branches to pass the tests?
|
Test build #132606 has finished for PR 30711 at commit
|
…ernalCatalog.createPartitions() Throw `PartitionsAlreadyExistException` from `createPartitions()` in Hive external catalog when a partition exists. Currently, `HiveExternalCatalog.createPartitions()` throws `AlreadyExistsException` wrapped by `AnalysisException`. In the PR, I propose to catch `AlreadyExistsException` in `HiveClientImpl` and replace it by `PartitionsAlreadyExistException`. The behaviour of Hive external catalog deviates from V1/V2 in-memory catalogs that throw `PartitionsAlreadyExistException`. To improve user experience with Spark SQL, it would be better to throw the same exception. Yes By running existing test suites: ``` $ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *AlterTableAddPartitionSuite" ``` Closes apache#30711 from MaxGekk/hive-partition-exception. Authored-by: Max Gekk <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit fab2995) Signed-off-by: Max Gekk <[email protected]>
…ernalCatalog.createPartitions() Throw `PartitionsAlreadyExistException` from `createPartitions()` in Hive external catalog when a partition exists. Currently, `HiveExternalCatalog.createPartitions()` throws `AlreadyExistsException` wrapped by `AnalysisException`. In the PR, I propose to catch `AlreadyExistsException` in `HiveClientImpl` and replace it by `PartitionsAlreadyExistException`. The behaviour of Hive external catalog deviates from V1/V2 in-memory catalogs that throw `PartitionsAlreadyExistException`. To improve user experience with Spark SQL, it would be better to throw the same exception. Yes By running existing test suites: ``` $ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *AlterTableAddPartitionSuite" ``` Closes apache#30711 from MaxGekk/hive-partition-exception. Authored-by: Max Gekk <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit fab2995) Signed-off-by: Max Gekk <[email protected]> (cherry picked from commit b284ea3) Signed-off-by: Max Gekk <[email protected]>
…ernalCatalog.createPartitions() Throw `PartitionsAlreadyExistException` from `createPartitions()` in Hive external catalog when a partition exists. Currently, `HiveExternalCatalog.createPartitions()` throws `AlreadyExistsException` wrapped by `AnalysisException`. In the PR, I propose to catch `AlreadyExistsException` in `HiveClientImpl` and replace it by `PartitionsAlreadyExistException`. The behaviour of Hive external catalog deviates from V1/V2 in-memory catalogs that throw `PartitionsAlreadyExistException`. To improve user experience with Spark SQL, it would be better to throw the same exception. Yes By running existing test suites: ``` $ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *AlterTableAddPartitionSuite" ``` Closes apache#30711 from MaxGekk/hive-partition-exception. Authored-by: Max Gekk <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit fab2995) Signed-off-by: Max Gekk <[email protected]> (cherry picked from commit b284ea3) Signed-off-by: Max Gekk <[email protected]> (cherry picked from commit 0226cfd) Signed-off-by: Max Gekk <[email protected]>
… in `HiveClientImpl` ### What changes were proposed in this pull request? Update the SQL migration guide about the changes made by: - #30778 - #30711 - #30866 ### Why are the changes needed? To inform users about the recent changes in the upcoming releases. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? N/A Closes #30925 from MaxGekk/sql-migr-guide-hiveclientimpl. Authored-by: Max Gekk <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
…anges in `HiveClientImpl` ### What changes were proposed in this pull request? Update the SQL migration guide about the changes made by: - #30778 - #30711 ### Why are the changes needed? To inform users about the recent changes in the upcoming releases. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? N/A Closes #30931 from MaxGekk/sql-migr-guide-hiveclientimpl-3.1. Authored-by: Max Gekk <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
…anges in `HiveClientImpl` ### What changes were proposed in this pull request? Update the SQL migration guide about the changes made by: - #30778 - #30711 ### Why are the changes needed? To inform users about the recent changes in the upcoming releases. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? N/A Closes #30932 from MaxGekk/sql-migr-guide-hiveclientimpl-3.0. Authored-by: Max Gekk <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
…anges in `HiveClientImpl` ### What changes were proposed in this pull request? Update the SQL migration guide about the changes made by: - #30778 - #30711 ### Why are the changes needed? To inform users about the recent changes in the upcoming releases. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? N/A Closes #30933 from MaxGekk/sql-migr-guide-hiveclientimpl-2.4. Authored-by: Max Gekk <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
What changes were proposed in this pull request?
Throw
PartitionsAlreadyExistExceptionfromcreatePartitions()in Hive external catalog when a partition exists. Currently,HiveExternalCatalog.createPartitions()throwsAlreadyExistsExceptionwrapped byAnalysisException.In the PR, I propose to catch
AlreadyExistsExceptioninHiveClientImpland replace it byPartitionsAlreadyExistException.Why are the changes needed?
The behaviour of Hive external catalog deviates from V1/V2 in-memory catalogs that throw
PartitionsAlreadyExistException. To improve user experience with Spark SQL, it would be better to throw the same exception.Does this PR introduce any user-facing change?
Yes
How was this patch tested?
By running existing test suites: