aokolnychyi commented on a change in pull request #2257:
URL: https://github.com/apache/iceberg/pull/2257#discussion_r588760049



##########
File path: core/src/main/java/org/apache/iceberg/MetricsConfig.java
##########
@@ -46,6 +47,35 @@ public static MetricsConfig getDefault() {
     return spec;
   }
 
+  public static Map<String, String> updateProperties(Map<String, String> 
props, List<String> deletes,
+                                                     Map<String, String> 
renames) {
+    if (!props.keySet().stream().anyMatch(key -> 
key.startsWith(TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX))) {
+      return props;
+    } else {
+      Map<String, String> updatedProperties = Maps.newHashMap();
+      // Put all of the non metrics columns we aren't modifying
+      props.keySet().stream().forEach(key -> {
+        if (key.startsWith(TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX)) {
+          String columnAlias = 
key.replaceFirst(TableProperties.METRICS_MODE_COLUMN_CONF_PREFIX, "");
+          if (deletes.contains(columnAlias)) {

Review comment:
       I think we can reduce the number of branches here:
   
   ```
   if (renames.containsKey(columnAlias)) {
     // the name has changed
     ...
    } else if (!deletes.contains(columnAlias)) {
      // copy over the config as it has not changed
     ...
   }
   ```




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to