szehon-ho commented on a change in pull request #2240:
URL: https://github.com/apache/iceberg/pull/2240#discussion_r688300136



##########
File path: core/src/main/java/org/apache/iceberg/MetricsConfig.java
##########
@@ -95,16 +118,32 @@ public static MetricsConfig fromProperties(Map<String, 
String> props) {
           try {
             mode = MetricsModes.fromString(props.get(key));
           } catch (IllegalArgumentException err) {
-            // Mode was invalid, log the error and use the default
+            // Mode was invalid, log the error and use the default (or default 
for sorted columns)
             LOG.warn("Ignoring invalid metrics mode for column {}: {}", 
columnAlias, props.get(key), err);
-            mode = spec.defaultMode;
+            if (sortedCols.contains(columnAlias)) {

Review comment:
       The purpose of this if,  if it's an invalid metric for a sorted column, 
we pick the sorted default instead of the normal default.
   
   It's probably over-engineering though?  I reverted this and edited the test 
that was asserting this

##########
File path: core/src/main/java/org/apache/iceberg/MetricsConfig.java
##########
@@ -95,16 +118,32 @@ public static MetricsConfig fromProperties(Map<String, 
String> props) {
           try {
             mode = MetricsModes.fromString(props.get(key));
           } catch (IllegalArgumentException err) {
-            // Mode was invalid, log the error and use the default
+            // Mode was invalid, log the error and use the default (or default 
for sorted columns)
             LOG.warn("Ignoring invalid metrics mode for column {}: {}", 
columnAlias, props.get(key), err);
-            mode = spec.defaultMode;
+            if (sortedCols.contains(columnAlias)) {
+              mode = sortedColDefaultMode;
+            } else {
+              mode = spec.defaultMode;
+            }
           }
           spec.columnModes.put(columnAlias, mode);
         });
-
     return spec;
   }
 
+  /**
+   * Auto promote sorted columns to truncate(16) if default is set at Counts 
or None.
+   * @param defaultMode default mode
+   * @return mode to use
+   */
+  private static MetricsMode promoteSortedColumnDefault(MetricsMode 
defaultMode) {

Review comment:
       done




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to