imback82 commented on a change in pull request #26540: [SPARK-29829][SQL] SHOW
TABLE EXTENDED should do multi-catalog resolution
URL: https://github.com/apache/spark/pull/26540#discussion_r346935208
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
##########
@@ -766,6 +766,43 @@ class DataSourceV2SQLSuite
assert(expected === df.collect())
}
+ test("SHOW TABLE EXTENDED not valid v1 database") {
+ val namespace = "testcat.ns1.ns2"
+ val table = "tbl"
+ withTable(s"$namespace.$table") {
+ spark.sql(s"CREATE TABLE $namespace.$table (id bigint, data string) " +
+ s"USING foo PARTITIONED BY (id)")
+
+ testV1CommandNamespace(s"SHOW TABLE EXTENDED FROM $namespace LIKE 'tb*'",
+ namespace)
+ testV1CommandNamespace(s"SHOW TABLE EXTENDED IN $namespace LIKE 'tb*'",
+ namespace)
+ testV1CommandNamespace("SHOW TABLE EXTENDED " +
+ s"FROM $namespace LIKE 'tb*' PARTITION(id=1)",
+ namespace)
+ testV1CommandNamespace("SHOW TABLE EXTENDED " +
+ s"IN $namespace LIKE 'tb*' PARTITION(id=1)",
+ namespace)
+ }
+ }
+
+ test("SHOW TABLE EXTENDED valid v1") {
+ val expected = Seq(Row("", "source", true), Row("", "source2", true))
+ val schema = new StructType()
+ .add("database", StringType, nullable = false)
+ .add("tableName", StringType, nullable = false)
+ .add("isTemporary", BooleanType, nullable = false)
+ .add("information", StringType, nullable = false)
+
+ val df = spark.sql("SHOW TABLE EXTENDED FROM default LIKE '*source*'")
+ val result = df.collect()
+ val resultWithoutInfo = result.map{ case Row(db, table, temp, _) =>
Row(db, table, temp)}
+
+ assert(df.schema === schema)
+ assert(resultWithoutInfo === expected)
+ result.foreach{ case Row(_, _, _, info: String) => assert(info.length > 0)}
Review comment:
nit: `assert(info.nonEmpty)`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]