This is an automated email from the ASF dual-hosted git repository.
srowen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 8b3ad2fc329 [SPARK-45389][SQL][HIVE] Correct MetaException matching
rule on getting partition metadata
8b3ad2fc329 is described below
commit 8b3ad2fc329e1813366430df7189d27b17133283
Author: Cheng Pan <[email protected]>
AuthorDate: Mon Oct 2 08:25:51 2023 -0500
[SPARK-45389][SQL][HIVE] Correct MetaException matching rule on getting
partition metadata
### What changes were proposed in this pull request?
This PR aims to fix the HMS call fallback logic introduced in SPARK-35437.
```patch
try {
...
hive.getPartitionNames
...
hive.getPartitionsByNames
} catch {
- case ex: InvocationTargetException if
ex.getCause.isInstanceOf[MetaException] =>
+ case ex: HiveException if ex.getCause.isInstanceOf[MetaException] =>
...
}
```
### Why are the changes needed?
Directly method call won't throw `InvocationTargetException`, and check the
code of `hive.getPartitionNames` and `hive.getPartitionsByNames`, both of them
will wrap a `HiveException` if `MetaException` throws.
### Does this PR introduce _any_ user-facing change?
Yes, it should be a bug fix.
### How was this patch tested?
Pass GA and code review. (I'm not sure how to construct/simulate a
MetaException during the HMS thrift call with the current HMS testing
infrastructure)
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #43191 from pan3793/SPARK-45389.
Authored-by: Cheng Pan <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
---
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
index 64aa7d2d6fa..9943c0178fc 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
@@ -438,7 +438,7 @@ private[client] class Shim_v2_0 extends Shim with Logging {
recordHiveCall()
hive.getPartitionsByNames(table, partNames.asJava)
} catch {
- case ex: InvocationTargetException if
ex.getCause.isInstanceOf[MetaException] =>
+ case ex: HiveException if ex.getCause.isInstanceOf[MetaException] =>
logWarning("Caught Hive MetaException attempting to get partition
metadata by " +
"filter from client side. Falling back to fetching all partition
metadata", ex)
recordHiveCall()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]