hudi-agent commented on code in PR #19162:
URL: https://github.com/apache/hudi/pull/19162#discussion_r3535502847


##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hive/TestSparkCatalogMetaStoreClient.scala:
##########
@@ -203,6 +203,202 @@ class TestSparkCatalogMetaStoreClient extends FunSuite 
with BeforeAndAfterAll {
     }
   }
 
+  test("supported client edge cases: empty partitions, no-op setMetaConf, 
default database location") {
+    val client = newClient()
+
+    // add_partitions with an empty list is a no-op that returns an empty 
result.
+    assertTrue(client.add_partitions(new util.ArrayList[Partition](), false, 
true).isEmpty)
+
+    // setMetaConf is intentionally a silent no-op, while getMetaConf stays 
unsupported.
+    client.setMetaConf("hive.metastore.callerContext", "hudi")
+    
assertThrows[UnsupportedOperationException](client.getMetaConf("hive.metastore.callerContext"))
+
+    // createDatabase without an explicit location falls back to the warehouse 
path.
+    val databaseName = generateName("db")
+    client.createDatabase(new Database(databaseName, "no-location db", null, 
new util.HashMap[String, String]()))
+    assertNotNull(client.getDatabase(databaseName).getLocationUri)
+    assertFalse(client.tableExists(databaseName, "missing_table"))
+  }
+
+  test("unsupported IMetaStoreClient operations throw 
UnsupportedOperationException") {
+    // SparkCatalogMetaStoreClient only implements the subset of 
IMetaStoreClient exercised by
+    // HoodieHiveSyncClient/HMSDDLExecutor. Every other method must fail fast 
rather than return
+    // a misleading default. This locks in that contract across the delegated 
surface.
+    val c = newClient()

Review Comment:
   🤖 nit: the sibling test above names this `client` — could you use `client` 
here too instead of `c` for consistency?
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



-- 
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]

Reply via email to