yihua commented on code in PR #13615:
URL: https://github.com/apache/hudi/pull/13615#discussion_r2277633785
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieWriterUtils.scala:
##########
@@ -216,6 +217,34 @@ object HoodieWriterUtils {
validateTableConfig(spark, params, tableConfig, false)
}
+ /**
+ * This function adds specific rules to choose the right config key for
payload class for version 9 tables.
+ *
+ * RULE 1: When
+ * 1. table version is 9,
+ * 2. writer key is a payload class key, and
+ * 3. table config has legacy payload class configured,
+ * then
+ * return legacy payload class key.
+ *
+ * Basic rule:
+ * return writer key.
+ */
+ def getPayloadClassConfigKeyFromTableConfig(key: String, tableConfig:
HoodieConfig): String = {
+ if (tableConfig == null) {
+ key
+ } else {
+ if (tableConfig.getInt(HoodieTableConfig.VERSION) ==
HoodieTableVersion.NINE.versionCode()
+ && key.equals(HoodieTableConfig.PAYLOAD_CLASS_NAME.key)
Review Comment:
Caller already checks this equality
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieWriterUtils.scala:
##########
@@ -216,6 +217,34 @@ object HoodieWriterUtils {
validateTableConfig(spark, params, tableConfig, false)
}
+ /**
+ * This function adds specific rules to choose the right config key for
payload class for version 9 tables.
+ *
+ * RULE 1: When
+ * 1. table version is 9,
+ * 2. writer key is a payload class key, and
+ * 3. table config has legacy payload class configured,
+ * then
+ * return legacy payload class key.
+ *
+ * Basic rule:
+ * return writer key.
+ */
+ def getPayloadClassConfigKeyFromTableConfig(key: String, tableConfig:
HoodieConfig): String = {
Review Comment:
The tests on this method does not really match what's expected from the
method. I've fixed the tests.
--
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]