timothyw553 commented on code in PR #19133:
URL: https://github.com/apache/iceberg/pull/19133#discussion_r4704488566


##########
core/src/main/java/org/apache/iceberg/MetricsConfig.java:
##########
@@ -260,7 +260,17 @@ public static MetricsConfig from(Map<String, String> 
props, Schema schema, SortO
     return from(props, schema, order, null);
   }
 
-  private static MetricsConfig from(
+  /**
+   * Generate a MetricsConfig for all columns based on overrides, schema, and 
sort order.
+   *
+   * @param props will be read for metrics overrides 
(write.metadata.metrics.column.*) and default
+   *     (write.metadata.metrics.default)
+   * @param schema table schema
+   * @param order sort order columns, will be promoted to truncate(16)
+   * @param spec partition spec
+   * @return metrics configuration
+   */
+  public static MetricsConfig from(

Review Comment:
   now that this is public, callers can pass an older `PartitionSpec` whose 
source column was dropped. in `partitionColumnModes`, 
`spec.schema().findColumnName(field.sourceId())` returns `null` for that case, 
which throws a `NullPointerException` in `builder.put(name, ...)` — should we 
guard for `null` there and add a test calling this 4-arg `from` directly?
   
   ```diff
    String name = spec.schema().findColumnName(field.sourceId());
    // truncate[W] could use stats truncated to at least W, but full is used 
for simplicity
   -builder.put(name, MetricsModes.Full.get());
   +if (name != null) {
   +  builder.put(name, MetricsModes.Full.get());
   +}
   ```



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