voonhous commented on code in PR #19162:
URL: https://github.com/apache/hudi/pull/19162#discussion_r3885989269


##########
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:
   Same as the thread above; renamed in b0f65691.



##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/common/TestHoodieSqlCommonUtils.scala:
##########
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.hudi.common
+
+import org.apache.hudi.common.table.read.IncrementalQueryAnalyzer
+
+import org.apache.hadoop.conf.Configuration
+import org.apache.spark.sql.catalyst.TableIdentifier
+import org.apache.spark.sql.catalyst.analysis.caseInsensitiveResolution
+import org.apache.spark.sql.catalyst.catalog.{CatalogStorageFormat, 
CatalogTable, CatalogTableType}
+import org.apache.spark.sql.catalyst.expressions.AttributeReference
+import org.apache.spark.sql.hudi.HoodieSqlCommonUtils
+import org.apache.spark.sql.hudi.command.exception.HoodieAnalysisException
+import org.apache.spark.sql.types.{IntegerType, StringType, StructField, 
StructType}
+import org.junit.jupiter.api.Assertions.{assertEquals, assertFalse, assertTrue}
+import org.scalatest.funsuite.AnyFunSuite
+
+import java.net.URI
+import java.util.TimeZone
+
+/**
+ * Unit coverage for the pure helper methods in [[HoodieSqlCommonUtils]] that 
are otherwise
+ * only reached through heavier read/write code paths.
+ */
+class TestHoodieSqlCommonUtils extends AnyFunSuite {
+
+  // Instant formatting is timezone sensitive; pin to UTC to keep assertions 
deterministic.
+  TimeZone.setDefault(TimeZone.getTimeZone("UTC"))
+
+  private def partitionedTable(partitionCols: Seq[String]): CatalogTable = {

Review Comment:
   Moved into `beforeAll` in b0f65691. The original default is also captured 
there and restored in `afterAll`, so the pin no longer leaks into other suites 
in the same JVM.



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