From 0c002d9d1083843d6c69cb11e73c1d588c370428 Mon Sep 17 00:00:00 2001 From: Wei Guo Date: Tue, 28 May 2024 16:06:06 +0800 Subject: [PATCH] fix test cases in /HiveSQLViewSuite --- .../apache/spark/sql/errors/QueryCompilationErrors.scala | 4 ++-- .../org/apache/spark/sql/execution/command/tables.scala | 4 ++-- .../apache/spark/sql/hive/execution/HiveSQLViewSuite.scala | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala index a23b1ed2358fb..1afcd9877f4a3 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala @@ -2924,12 +2924,12 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat def showCreateTableOrViewFailToExecuteUnsupportedFeatureError( table: CatalogTable, - features: Seq[String]): Throwable = { + unsupportedFeatures: Seq[String]): Throwable = { new AnalysisException( errorClass = "UNSUPPORTED_SHOW_CREATE_TABLE.WITH_UNSUPPORTED_FEATURE", messageParameters = Map( "table" -> table.identifier.toString, - "features" -> features.map(" - " + _).mkString("\n"))) + "unsupportedFeatures" -> unsupportedFeatures.map(" - " + _).mkString("\n"))) } def logicalPlanForViewNotAnalyzedError(): Throwable = { diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala index d3c2ff4098ab0..8f5afc0c5bc90 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala @@ -1325,9 +1325,9 @@ case class ShowCreateTableAsSerdeCommand( } private def showCreateHiveTable(metadata: CatalogTable): String = { - def reportUnsupportedError(features: Seq[String]): Unit = { + def reportUnsupportedError(unsupportedFeatures: Seq[String]): Unit = { throw QueryCompilationErrors.showCreateTableOrViewFailToExecuteUnsupportedFeatureError( - metadata, features) + metadata, unsupportedFeatures) } if (metadata.unsupportedFeatures.nonEmpty) { diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveSQLViewSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveSQLViewSuite.scala index 79d255cec502b..fcbfff90d57f9 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveSQLViewSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveSQLViewSuite.scala @@ -213,10 +213,11 @@ class HiveSQLViewSuite extends SQLViewSuite with TestHiveSingleton { exception = intercept[AnalysisException] { sql("SHOW CREATE TABLE v1") }, - errorClass = "UNSUPPORTED_SHOW_CREATE_TABLE.WITH_UNSUPPORTED_FEATURE", + errorClass = "UNSUPPORTED_SHOW_CREATE_TABLE." + + "", parameters = Map( "table" -> s"`$SESSION_CATALOG_NAME`.`default`.`v1`", - "features" -> " - partitioned view" + "unsupportedFeatures" -> " - partitioned view" ) ) checkError( @@ -226,7 +227,7 @@ class HiveSQLViewSuite extends SQLViewSuite with TestHiveSingleton { errorClass = "UNSUPPORTED_SHOW_CREATE_TABLE.WITH_UNSUPPORTED_FEATURE", parameters = Map( "table" -> s"`$SESSION_CATALOG_NAME`.`default`.`v1`", - "features" -> " - partitioned view" + "unsupportedFeatures" -> " - partitioned view" ) ) }