wangyum commented on code in PR #42033:
URL: https://github.com/apache/spark/pull/42033#discussion_r1272965017


##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala:
##########
@@ -1634,8 +1634,21 @@ private[client] class Shim_v2_3 extends Shim_v2_1 {
       pattern: String,
       tableType: TableType): Seq[String] = {
     recordHiveCall()
-    getTablesByTypeMethod.invoke(hive, dbName, pattern, tableType)
-      .asInstanceOf[JList[String]].asScala.toSeq
+    try {
+      getTablesByTypeMethod.invoke(hive, dbName, pattern, tableType)
+        .asInstanceOf[JList[String]].asScala.toSeq
+    } catch {
+      case ex: InvocationTargetException if 
ex.getCause.isInstanceOf[HiveException] =>
+        val cause = ex.getCause.getCause
+        if (cause != null && cause.isInstanceOf[MetaException] &&
+          cause.getMessage != null &&
+          cause.getMessage.contains("Invalid method name: 
'get_tables_by_type'")) {
+          throw 
QueryExecutionErrors.getTablesByTypeUnsupportedByHiveVersionError()

Review Comment:
   Could you add a comment here? The exception should be align with 
https://github.com/apache/spark/blob/c5a23e9c23f7bd7066060d0791f290ad38fca76f/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala#L835



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to