cloud-fan commented on code in PR #37588: URL: https://github.com/apache/spark/pull/37588#discussion_r1375784149
########## sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala: ########## @@ -165,4 +154,222 @@ class ShowTablesSuite extends ShowTablesSuiteBase with CommandSuiteBase { } } } + + test("show table extended in non-partitioned table") { + val namespace = "ns1" + val table = "tbl" + withNamespaceAndTable(namespace, table, catalog) { tbl => + sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing") + val e = intercept[AnalysisException] { + sql(s"SHOW TABLE EXTENDED IN $catalog.$namespace LIKE '$table' PARTITION(id = 1)") + } + checkError( + exception = e, + errorClass = "_LEGACY_ERROR_TEMP_1251", + parameters = Map("action" -> "SHOW TABLE EXTENDED", "tableName" -> table) + ) + } + } + + test("show table extended in multi partition key - " + + "the command's partition parameters are complete") { + val namespace = "ns1" + val table = "tbl" + withNamespaceAndTable(namespace, table, catalog) { tbl => + sql(s"CREATE TABLE $tbl (id1 bigint, id2 bigint, data string) " + + s"$defaultUsing PARTITIONED BY (id1, id2)") + sql(s"ALTER TABLE $tbl ADD PARTITION (id1 = 1, id2 = 2)") + + val result = sql(s"SHOW TABLE EXTENDED FROM $catalog.$namespace " + + s"LIKE '$table' PARTITION(id1 = 1, id2 = 2)") + assert(result.schema.fieldNames === + Seq("namespace", "tableName", "isTemporary", "information")) + + val resultCollect = result.collect() + assert(resultCollect(0).length == 4) + assert(resultCollect(0)(0) === namespace) + assert(resultCollect(0)(1) === table) + assert(resultCollect(0)(2) === false) + val actualResult = exclude(resultCollect(0)(3).toString) + val expectedResult = "Partition Values: [id1=1, id2=2]" + assert(actualResult === expectedResult) + } + } + + test("show table extended in multi tables") { Review Comment: ditto -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org