yihua commented on code in PR #11777:
URL: https://github.com/apache/hudi/pull/11777#discussion_r1744677973


##########
hudi-spark-datasource/hudi-spark-common/src/test/scala/org/apache/spark/sql/hudi/TestProvidesHoodieConfig.scala:
##########
@@ -66,6 +69,25 @@ class TestProvidesHoodieConfig {
         classOf[CustomKeyGenerator].getName, partitionFieldNames, mockTable))
   }
 
+  @Test
+  def testInferPrecombineFieldFromTableConfig(): Unit = {
+    // ProvidesHoodieConfig should be able to infer precombine field from 
table config
+    val mockCatalog = Mockito.mock(classOf[HoodieCatalogTable])
+    when(mockCatalog.catalogProperties).thenReturn(Map.empty[String, String])
+
+    val props = new TypedProperties()
+    props.setProperty(HoodieTableConfig.PRECOMBINE_FIELD.key, "segment")
+    val mockTableConfig = Mockito.mock(classOf[HoodieTableConfig])
+    when(mockTableConfig.getProps).thenReturn(props)
+    val mockSqlConf = Mockito.mock(classOf[SQLConf])
+    when(mockSqlConf.getAllConfs).thenReturn(Map.empty[String, String])
+
+    assertEquals(
+      "segment",
+      ProvidesHoodieConfig.combineOptions(mockCatalog, mockTableConfig, 
mockSqlConf, Map.empty)

Review Comment:
   Should this cover `buildHoodieInsertConfig` instead?  Does this test fail 
without the fix in this PR?



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