Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that NoSuchTableException is not used anywhere? We should probably get rid of it then. Though, I think I'd have a slight preference for keeping a special exception internally. The point of this extra control flow is so that we can attach line position information to this specific exception in the analyzer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marmbrus Shouldn't we have fixed this issue by marking the relation unresolved and let the analyzer generate a proper AnalysisException ? If we were to use the catalog interface for some other purpose like tooling etc keeping the generic catalog exceptions would have been better ?

}
val tableWithQualifiers = Subquery(tableName, table)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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") {
Expand All @@ -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"))
}

Expand Down