Skip to content
Snippets Groups Projects
Commit c82924d5 authored by thomastechs's avatar thomastechs Committed by Reynold Xin
Browse files

[SPARK-12533][SQL] hiveContext.table() throws the wrong exception

Avoiding the the No such table exception and throwing analysis exception as per the bug: SPARK-12533

Author: thomastechs <thomas.sebastian@tcs.com>

Closes #10529 from thomastechs/topic-branch.
parent c3d50560
No related branches found
No related tags found
No related merge requests found
......@@ -104,7 +104,7 @@ class SimpleCatalog(val conf: CatalystConf) extends Catalog {
val tableName = getTableName(tableIdent)
val table = tables.get(tableName)
if (table == null) {
throw new NoSuchTableException
throw new AnalysisException("Table not found: " + tableName)
}
val tableWithQualifiers = Subquery(tableName, table)
......
......@@ -17,7 +17,7 @@
package org.apache.spark.sql
import org.apache.spark.sql.catalyst.analysis.NoSuchTableException
import org.apache.spark.sql.execution.Exchange
import org.apache.spark.sql.execution.PhysicalRDD
......@@ -289,7 +289,7 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with SharedSQLContext
testData.select('key).registerTempTable("t1")
sqlContext.table("t1")
sqlContext.dropTempTable("t1")
intercept[NoSuchTableException](sqlContext.table("t1"))
intercept[AnalysisException](sqlContext.table("t1"))
}
test("Drops cached temporary table") {
......@@ -301,7 +301,7 @@ class CachedTableSuite extends QueryTest with SQLTestUtils with SharedSQLContext
assert(sqlContext.isCached("t2"))
sqlContext.dropTempTable("t1")
intercept[NoSuchTableException](sqlContext.table("t1"))
intercept[AnalysisException](sqlContext.table("t1"))
assert(!sqlContext.isCached("t2"))
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment