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 @@ -102,7 +102,7 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog {
u.failAnalysis(s"Namespace not found: ${u.multipartIdentifier.quoted}")

case u: UnresolvedTable =>
u.failAnalysis(s"Table not found for '${u.commandName}': ${u.multipartIdentifier.quoted}")
u.failAnalysis(s"Table not found: ${u.multipartIdentifier.quoted}")

case u @ UnresolvedView(NonSessionCatalogAndIdentifier(catalog, ident), cmd, _, _) =>
u.failAnalysis(
Expand All @@ -111,12 +111,12 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog {
s"$cmd expects a view.")

case u: UnresolvedView =>
u.failAnalysis(s"View not found for '${u.commandName}': ${u.multipartIdentifier.quoted}")
u.failAnalysis(s"View not found: ${u.multipartIdentifier.quoted}")

case u: UnresolvedTableOrView =>
val viewStr = if (u.allowTempView) "view" else "permanent view"
u.failAnalysis(
s"Table or $viewStr not found for '${u.commandName}': ${u.multipartIdentifier.quoted}")
s"Table or $viewStr not found: ${u.multipartIdentifier.quoted}")

case u: UnresolvedRelation =>
u.failAnalysis(s"Table or view not found: ${u.multipartIdentifier.quoted}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ SHOW COLUMNS IN badtable FROM showdb
struct<>
-- !query output
org.apache.spark.sql.AnalysisException
Table or view not found for 'SHOW COLUMNS': showdb.badtable; line 1 pos 0
Table or view not found: showdb.badtable; line 1 pos 0


-- !query
Expand Down Expand Up @@ -130,7 +130,7 @@ SHOW COLUMNS IN showdb.showcolumn3
struct<>
-- !query output
org.apache.spark.sql.AnalysisException
Table or view not found for 'SHOW COLUMNS': showdb.showcolumn3; line 1 pos 0
Table or view not found: showdb.showcolumn3; line 1 pos 0


-- !query
Expand All @@ -139,7 +139,7 @@ SHOW COLUMNS IN showcolumn3 FROM showdb
struct<>
-- !query output
org.apache.spark.sql.AnalysisException
Table or view not found for 'SHOW COLUMNS': showdb.showcolumn3; line 1 pos 0
Table or view not found: showdb.showcolumn3; line 1 pos 0


-- !query
Expand All @@ -148,7 +148,7 @@ SHOW COLUMNS IN showcolumn4
struct<>
-- !query output
org.apache.spark.sql.AnalysisException
Table or view not found for 'SHOW COLUMNS': showcolumn4; line 1 pos 0
Table or view not found: showcolumn4; line 1 pos 0


-- !query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ class StatisticsCollectionSuite extends StatisticsCollectionTestBase with Shared
val errMsg1 = intercept[AnalysisException] {
sql(s"ANALYZE TABLE $globalTempDB.gTempView COMPUTE STATISTICS FOR COLUMNS id")
}.getMessage
assert(errMsg1.contains("Table or view not found for 'ANALYZE TABLE ... FOR COLUMNS ...': " +
assert(errMsg1.contains("Table or view not found: " +
s"$globalTempDB.gTempView"))
// Analyzes in a global temporary view
sql("CREATE GLOBAL TEMP VIEW gTempView AS SELECT * FROM range(1, 30)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ class DataSourceV2SQLSuite
val ex = intercept[AnalysisException] {
sql("DROP TABLE testcat.db.notbl")
}
assert(ex.getMessage.contains("Table or view not found for 'DROP TABLE': testcat.db.notbl"))
assert(ex.getMessage.contains("Table or view not found: testcat.db.notbl"))
sql("DROP TABLE IF EXISTS testcat.db.notbl")
}

Expand Down Expand Up @@ -2015,7 +2015,7 @@ class DataSourceV2SQLSuite
sql(s"ALTER VIEW testcat.ns.tbl RENAME TO ns.view")
}
assert(e.getMessage.contains(
"Table or view not found for 'ALTER VIEW ... RENAME TO': testcat.ns.tbl"))
"Table or view not found: testcat.ns.tbl"))
}

test("ANALYZE TABLE") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,11 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {
test("should not allow ALTER VIEW AS when the view does not exist") {
assertAnalysisError(
"ALTER VIEW testView AS SELECT 1, 2",
"View not found for 'ALTER VIEW ... AS': testView")
"View not found: testView")

assertAnalysisError(
"ALTER VIEW default.testView AS SELECT 1, 2",
"View not found for 'ALTER VIEW ... AS': default.testView")
"View not found: default.testView")
}

test("ALTER VIEW AS should try to alter temp view first if view name has no database part") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class JDBCTableCatalogSuite extends QueryTest with SharedSparkSession {
checkAnswer(sql("SHOW TABLES IN h2.test"), Seq(Row("test", "people")))
Seq(
"h2.test.not_existing_table" ->
"Table or view not found for 'DROP TABLE': h2.test.not_existing_table",
"Table or view not found: h2.test.not_existing_table",
"h2.bad_test.not_existing_table" ->
"Table or view not found for 'DROP TABLE': h2.bad_test.not_existing_table"
"Table or view not found: h2.bad_test.not_existing_table"
).foreach { case (table, expectedMsg) =>
val msg = intercept[AnalysisException] {
sql(s"DROP TABLE $table")
Expand All @@ -110,12 +110,12 @@ class JDBCTableCatalogSuite extends QueryTest with SharedSparkSession {
sql("ALTER TABLE h2.test.not_existing_table RENAME TO test.dst_table")
}
assert(exp1.getMessage.contains(
"Table or view not found for 'ALTER TABLE ... RENAME TO': h2.test.not_existing_table"))
"Table or view not found: h2.test.not_existing_table"))
val exp2 = intercept[AnalysisException] {
sql("ALTER TABLE h2.bad_test.not_existing_table RENAME TO test.dst_table")
}
assert(exp2.getMessage.contains(
"Table or view not found for 'ALTER TABLE ... RENAME TO': h2.bad_test.not_existing_table"))
"Table or view not found: h2.bad_test.not_existing_table"))
// Rename to an existing table
withTable("h2.test.dst_table") {
withConnection { conn =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class HiveCommandSuite extends QueryTest with SQLTestUtils with TestHiveSingleto
val message = intercept[AnalysisException] {
sql("SHOW TBLPROPERTIES badtable")
}.getMessage
assert(message.contains("Table or view not found for 'SHOW TBLPROPERTIES': badtable"))
assert(message.contains("Table or view not found: badtable"))

// When key is not found, a row containing the error is returned.
checkAnswer(
Expand Down