rdblue commented on code in PR #13039:
URL: https://github.com/apache/iceberg/pull/13039#discussion_r2254732190
##########
core/src/main/java/org/apache/iceberg/MetricsConfig.java:
##########
@@ -123,23 +226,26 @@ 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);
+
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 {
+ Schema subSchema = limitSchema(schema, maxInferredDefaultColumns);
+ for (Integer id : TypeUtil.getProjectedIds(subSchema)) {
Review Comment:
Why is this limiting to an ID set, then creating a schema, and finally
calling `getProjectedIds` to recover the ID set? Couldn't this just call the ID
set method directly?
--
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]