amaliujia commented on code in PR #37982:
URL: https://github.com/apache/spark/pull/37982#discussion_r979051951


##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala:
##########
@@ -698,7 +710,10 @@ private[hive] class HiveClientImpl(
     val original = state.getCurrentDatabase
     try {
       setCurrentDatabaseRaw(db)
-      val hiveTable = toHiveTable(getTable(db, table), Some(userName))
+      val hiveTable = withHiveState {
+        getRawTableOption(db, table).getOrElse(throw new 
NoSuchTableException(db, table))

Review Comment:
   I was thinking about if we need to throw such NoTable exception as the hive 
client will do that. 
   
   Later I realized that there is a boolean flag to control if we throw such 
exception from there or not so this code is fine
   
   ```
     private def getRawTableOption(dbName: String, tableName: String): 
Option[HiveTable] = {
       Option(shim.getTable(client, dbName, tableName, false /* do not throw 
exception */))
     }
     ```



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