pan3793 commented on code in PR #54411:
URL: https://github.com/apache/spark/pull/54411#discussion_r2835933050


##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSessionCatalogSuite.scala:
##########
@@ -86,4 +86,28 @@ class DataSourceV2SQLSessionCatalogSuite
       sql("SELECT char_length('Hello') as v1, ns.strlen('Spark') as v2"),
       Row(5, 5))
   }
+
+  test("SPARK-55024: metadata tables like Iceberg work with multi-part 
identifiers") {
+    // This test simulates Iceberg's metadata table pattern where you can query
+    // db.table.snapshots to get table snapshot/commit information.
+    // The identifier for "default.table.snapshots" is:
+    //   namespace = ["default", "table"], name = "snapshots"
+    val t1 = "metadata_test_tbl"
+    withTable(t1) {
+      sql(s"CREATE TABLE $t1 (id bigint, data string) USING $v2Format")
+      sql(s"INSERT INTO $t1 VALUES (1, 'first')")
+      sql(s"INSERT INTO $t1 VALUES (2, 'second')")
+      sql(s"INSERT INTO $t1 VALUES (3, 'third')")
+
+      // Query the metadata table using multi-part identifier
+      val snapshots = sql(s"SELECT * FROM default.$t1.snapshots")

Review Comment:
   do you also want to test
   
   ```
   SELECT * FROM $t1.snapshots;
   SELECT * FROM spark_catalog.default.$t1.snapshots
   ```
   ?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to