Skip to content

Commit 29e5e55

Browse files
committed
[SPARK-4943][SQL] fix failed Hive CTAS tests
1 parent 6ae77ce commit 29e5e55

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import org.apache.hadoop.hive.metastore.TableType
3030
import org.apache.hadoop.hive.metastore.api.FieldSchema
3131
import org.apache.hadoop.hive.metastore.api.{Table => TTable, Partition => TPartition}
3232
import org.apache.hadoop.hive.ql.metadata.{Hive, Partition, Table, HiveException}
33+
import org.apache.hadoop.hive.ql.metadata.InvalidTableException
3334
import org.apache.hadoop.hive.ql.plan.CreateTableDesc
3435
import org.apache.hadoop.hive.serde.serdeConstants
3536
import org.apache.hadoop.hive.serde2.{Deserializer, SerDeException}
@@ -61,7 +62,11 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
6162
val tableIdent = processTableIdentifier(tableIdentifier)
6263
val (databaseName, tblName) =
6364
(tableIdent.lift(1).getOrElse(hive.sessionState.getCurrentDatabase), tableIdent.head)
64-
client.getTable(databaseName, tblName) != null
65+
try {
66+
client.getTable(databaseName, tblName) != null
67+
} catch {
68+
case ie: InvalidTableException => false
69+
}
6570
}
6671

6772
def lookupRelation(

0 commit comments

Comments
 (0)