rdblue commented on code in PR #13039: URL: https://github.com/apache/iceberg/pull/13039#discussion_r2127446491
########## core/src/main/java/org/apache/iceberg/MetricsConfig.java: ########## @@ -123,23 +223,31 @@ private static MetricsConfig from(Map<String, String> props, Schema schema, Sort // Handle user override of default mode MetricsMode defaultMode; String configuredDefault = props.get(DEFAULT_WRITE_METRICS_MODE); + + // TODO: Verify this is correct with user supplied default or not, why shouldn't it be bounded. + // why was it not before? if (configuredDefault != null) { // a user-configured default mode is applied for all columns defaultMode = parseMode(configuredDefault, DEFAULT_MODE, "default"); - - } else if (schema == null || schema.columns().size() <= maxInferredDefaultColumns) { - // there are less than the inferred limit, so the default is used everywhere + } else if (schema == null) { defaultMode = DEFAULT_MODE; - } else { - // an inferred default mode is applied to the first few columns, up to the limit - Schema subSchema = new Schema(schema.columns().subList(0, maxInferredDefaultColumns)); - for (Integer id : TypeUtil.getProjectedIds(subSchema)) { - columnModes.put(subSchema.findColumnName(id), DEFAULT_MODE); - } + if (TypeUtil.getProjectedIds(schema).size() <= maxInferredDefaultColumns) { + // there are less than the inferred limit (including structs), so the default is used + // everywhere + defaultMode = DEFAULT_MODE; + } else { + // + BreadthFirstFieldPriority breadthFirstFieldPriority = new BreadthFirstFieldPriority(); + Schema subSchema = + breadthFirstFieldPriority.subSchemaMetricPriority(schema, maxInferredDefaultColumns); Review Comment: Why is there still a priority class and implementation? Why not a more direct implementation? -- 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: issues-unsubscr...@iceberg.apache.org 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