danny0405 commented on code in PR #19205:
URL: https://github.com/apache/hudi/pull/19205#discussion_r3670304175


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/NineToTenUpgradeHandler.java:
##########
@@ -34,6 +46,12 @@ public UpgradeDowngrade.TableConfigChangeSet upgrade(
       HoodieEngineContext context,
       String instantTime,
       SupportsUpgradeDowngrade upgradeDowngradeHelper) {
-    return new UpgradeDowngrade.TableConfigChangeSet();
+    HoodieTableConfig tableConfig =
+        upgradeDowngradeHelper.getTable(config, 
context).getMetaClient().getTableConfig();
+    // Resolves from the legacy boolean for a version 9 table, since the mode 
property is absent.
+    MetaFieldsMode metaFieldsMode = tableConfig.getMetaFieldsMode();
+    Map<ConfigProperty, String> propertiesToUpdate = Collections.singletonMap(
+        HoodieTableConfig.META_FIELDS_MODE, metaFieldsMode.name());
+    return new UpgradeDowngrade.TableConfigChangeSet(propertiesToUpdate, 
Collections.emptySet());

Review Comment:
   > So if the upgrade removed the boolean and the table were later downgraded, 
a v9 reader would find neither property and resolve to ALL
   
   Didn't get it, for upgrade, the `POPULATE_META_FIELDS` would be translated 
into `ALL` or `NONE` mode, and for downgrade the `ALL` or `NONE` would be 
translated back into `POPULATE_META_FIELDS` true or false right? For default 
value that is not declared explicitly, we can skip the translation since both 
options have the same default value, for explicit options, let's just keep one 
of them to avoid ambiguties.



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