Skip to content

Commit fb47ea9

Browse files
committed
fix tests
1 parent 4fe3e69 commit fb47ea9

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -900,22 +900,15 @@ case class ShowTablePropertiesCommand(table: TableIdentifier, propertyKey: Optio
900900
}
901901

902902
override def run(sparkSession: SparkSession): Seq[Row] = {
903-
val catalog = sparkSession.sessionState.catalog
904-
905-
if (catalog.isTemporaryTable(table)) {
906-
Seq.empty[Row]
907-
} else {
908-
val catalogTable = sparkSession.sessionState.catalog.getTableMetadata(table)
909-
910-
propertyKey match {
911-
case Some(p) =>
912-
val propValue = catalogTable
913-
.properties
914-
.getOrElse(p, s"Table ${catalogTable.qualifiedName} does not have property: $p")
915-
Seq(Row(propValue))
916-
case None =>
917-
catalogTable.properties.map(p => Row(p._1, p._2)).toSeq
918-
}
903+
val catalogTable = sparkSession.sessionState.catalog.getTableMetadata(table)
904+
propertyKey match {
905+
case Some(p) =>
906+
val propValue = catalogTable
907+
.properties
908+
.getOrElse(p, s"Table ${catalogTable.qualifiedName} does not have property: $p")
909+
Seq(Row(propValue))
910+
case None =>
911+
catalogTable.properties.map(p => Row(p._1, p._2)).toSeq
919912
}
920913
}
921914
}

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ class HiveCommandSuite extends QueryTest with SQLTestUtils with TestHiveSingleto
130130
}
131131

132132
test("show tblproperties for datasource table - errors") {
133-
val message1 = intercept[NoSuchTableException] {
133+
val message = intercept[AnalysisException] {
134134
sql("SHOW TBLPROPERTIES badtable")
135135
}.getMessage
136-
assert(message1.contains("Table or view 'badtable' not found in database 'default'"))
136+
assert(message.contains("Table not found: badtable"))
137137

138138
// When key is not found, a row containing the error is returned.
139139
checkAnswer(
@@ -156,7 +156,10 @@ class HiveCommandSuite extends QueryTest with SQLTestUtils with TestHiveSingleto
156156
""".stripMargin)
157157

158158
// An empty sequence of row is returned for session temporary table.
159-
checkAnswer(sql("SHOW TBLPROPERTIES parquet_temp"), Nil)
159+
val message = intercept[AnalysisException] {
160+
sql("SHOW TBLPROPERTIES parquet_temp")
161+
}.getMessage
162+
assert(message.contains("parquet_temp is a temp view not table"))
160163
}
161164
}
162165

0 commit comments

Comments
 (0)