From 654a99783047a50ea1277f25206ae48adcd73f49 Mon Sep 17 00:00:00 2001 From: xuyu <11161569@vivo.com> Date: Mon, 12 Aug 2024 08:51:43 -0700 Subject: [PATCH] [SPARK-49078][SQL][FOLLOWUP] Clear unused showColumnsNotSupportedForV2TablesError in QueryCompilationErrors and add more uts ### What changes were proposed in this pull request? Clear unused error methods in QueryCompilationErrors. ### Why are the changes needed? Due to had support show columns in v2 table(https://github.com/apache/spark/pull/47568), so the check method is not needed any more. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? not need ### Was this patch authored or co-authored using generative AI tooling? Closes #47701 from xuzifu666/rm_showcolumnsv2. Lead-authored-by: xuyu <11161569@vivo.com> Co-authored-by: xuzifu666 <1206332514@qq.com> Signed-off-by: Dongjoon Hyun --- .../org/apache/spark/sql/errors/QueryCompilationErrors.scala | 4 ---- .../org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala | 2 ++ 2 files changed, 2 insertions(+), 4 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 09dfa6b3b603b..c422b32c5ec20 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 @@ -1593,10 +1593,6 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat notSupportedForV2TablesError("SHOW CREATE TABLE AS SERDE") } - def showColumnsNotSupportedForV2TablesError(): Throwable = { - notSupportedForV2TablesError("SHOW COLUMNS") - } - def repairTableNotSupportedForV2TablesError(): Throwable = { notSupportedForV2TablesError("MSCK REPAIR TABLE") } diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala index 294e4c715f1a6..7493f005ff320 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala @@ -2374,6 +2374,8 @@ class DataSourceV2SQLSuiteV1Filter val t = "testcat.ns1.ns2.tbl" withTable(t) { spark.sql(s"CREATE TABLE $t (id bigint, data string) USING foo") + checkAnswer(sql(s"SHOW COLUMNS FROM $t IN testcat.ns1.ns2"), Seq(Row("id"), Row("data"))) + checkAnswer(sql(s"SHOW COLUMNS in $t"), Seq(Row("id"), Row("data"))) checkAnswer(sql(s"SHOW COLUMNS FROM $t"), Seq(Row("id"), Row("data"))) } }