File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed
catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis
core/src/test/scala/org/apache/spark/sql/execution Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -617,18 +617,18 @@ class Analyzer(
617617 private def lookupTableFromCatalog (
618618 u : UnresolvedRelation ,
619619 defaultDatabase : Option [String ] = None ): LogicalPlan = {
620- val db = u.tableIdentifier.database.orElse(defaultDatabase)
621- val tableIdentWithDb = u.tableIdentifier.copy(database = db )
620+ val tableIdentWithDb = u.tableIdentifier.copy( database = u.tableIdentifier.database
621+ .orElse(defaultDatabase) )
622622 try {
623623 catalog.lookupRelation(tableIdentWithDb, u.alias)
624624 } catch {
625625 case _ : NoSuchTableException =>
626626 u.failAnalysis(s " Table or view not found: ${tableIdentWithDb.unquotedString}" )
627627 // If the database is defined and that database is not found, throw an AnalysisException.
628628 // Note that if the database is not defined, it is possible we are looking up a temp view.
629- case _ : NoSuchDatabaseException if db.isDefined =>
629+ case e : NoSuchDatabaseException =>
630630 u.failAnalysis(s " Table or view not found: ${tableIdentWithDb.unquotedString}, the " +
631- s " database ${db.get } doesn't exsits. " )
631+ s " database ${e.db } doesn't exsits. " )
632632 }
633633 }
634634
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import org.apache.spark.sql.catalyst.catalog.CatalogTypes.TablePartitionSpec
2525 * Thrown by a catalog when an item cannot be found. The analyzer will rethrow the exception
2626 * as an [[org.apache.spark.sql.AnalysisException ]] with the correct position information.
2727 */
28- class NoSuchDatabaseException (db : String ) extends AnalysisException (s " Database ' $db' not found " )
28+ class NoSuchDatabaseException (val db : String ) extends AnalysisException (s " Database ' $db' not found " )
2929
3030class NoSuchTableException (db : String , table : String )
3131 extends AnalysisException (s " Table or view ' $table' not found in database ' $db' " )
Original file line number Diff line number Diff line change @@ -22,8 +22,7 @@ import org.apache.spark.sql.catalyst.TableIdentifier
2222import org .apache .spark .sql .catalyst .analysis .NoSuchTableException
2323import org .apache .spark .sql .test .{SharedSQLContext , SQLTestUtils }
2424
25- class SimpleSQLViewSuite extends SQLViewSuite with SharedSQLContext {
26- }
25+ class SimpleSQLViewSuite extends SQLViewSuite with SharedSQLContext
2726
2827/**
2928 * A suite for testing view related functionality.
You can’t perform that action at this time.
0 commit comments