rdblue commented on a change in pull request #25601: [SPARK-28856][SQL]
Implement SHOW DATABASES for Data Source V2 Tables
URL: https://github.com/apache/spark/pull/25601#discussion_r320992619
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/sources/v2/DataSourceV2SQLSuite.scala
##########
@@ -747,6 +747,81 @@ class DataSourceV2SQLSuite
assert(expected === df.collect())
}
+ test("ShowNamespaces: show root namespaces with default v2 catalog") {
+ spark.conf.set("spark.sql.default.catalog", "testcat")
+
+ testShowNamespaces("SHOW NAMESPACES", Seq())
+
+ spark.sql("CREATE TABLE testcat.ns1.table (id bigint) USING foo")
+ spark.sql("CREATE TABLE testcat.ns1.ns1_1.table (id bigint) USING foo")
+ spark.sql("CREATE TABLE testcat.ns2.table (id bigint) USING foo")
+
+ testShowNamespaces("SHOW NAMESPACES", Seq("ns1", "ns2"))
+ testShowNamespaces("SHOW NAMESPACES LIKE '*1*'", Seq("ns1"))
+
+ // Try to look up only with catalog name, which should list root
namespaces.
+ testShowNamespaces("SHOW NAMESPACES IN testcat", Seq("ns1", "ns2"))
Review comment:
I think this assertion should be in a separate test case that doesn't set
`testcat` as the default catalog, to test that it actually loads the correct
catalog.
----------------------------------------------------------------
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]