nsivabalan commented on code in PR #12623: URL: https://github.com/apache/hudi/pull/12623#discussion_r1919531138
########## hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java: ########## @@ -1541,39 +1533,38 @@ private static List<String> getColumnsToIndex(HoodieTableConfig tableConfig, * required meta cols * * @param metadataConfig metadata config - * @param tableSchema either a list of the columns in the table, or a lazy option of the table schema + * @param tableSchemaLazyOpt lazy option of the table schema * @param isTableInitializing true if table is being initialized. * @param recordType Option of record type. Used to determine which types are valid to index * @return list of columns that should be indexed */ private static Stream<String> getColumnsToIndexWithoutRequiredMetaFields(HoodieMetadataConfig metadataConfig, - Either<List<String>, Lazy<Option<Schema>>> tableSchema, + Lazy<Option<Schema>> tableSchemaLazyOpt, boolean isTableInitializing, Option<HoodieRecordType> recordType) { List<String> columnsToIndex = metadataConfig.getColumnsEnabledForColumnStatsIndex(); if (!columnsToIndex.isEmpty()) { if (isTableInitializing) { return columnsToIndex.stream(); } - // filter for top level fields here. - List<String> topLevelEligibleFields = tableSchema.isLeft() ? tableSchema.asLeft() : - (tableSchema.asRight().get().map(schema -> schema.getFields().stream() - .filter(field -> isColumnTypeSupported(field.schema(), recordType)) - .map(field -> field.name()).collect(toList())) - .orElse(new ArrayList<String>())); - return columnsToIndex.stream().filter(fieldName -> !META_COL_SET_TO_INDEX.contains(fieldName) && !fieldName.contains(".") - && (topLevelEligibleFields.isEmpty() || topLevelEligibleFields.contains(fieldName))); - } - if (tableSchema.isLeft()) { - return getFirstNFieldNames(tableSchema.asLeft().stream(), metadataConfig.maxColumnsToIndexForColStats()); + // filter for eligible fields + Option<Schema> tableSchema = tableSchemaLazyOpt.get(); + return columnsToIndex.stream().filter(fieldName -> !META_COL_SET_TO_INDEX.contains(fieldName)) + .filter(fieldName -> { + if (tableSchema.isPresent()) { + return isColumnTypeSupported(getSchemaForField(tableSchema.get(), fieldName).getValue().schema(), recordType); + } else { + return true; Review Comment: Made minor fixes here. -- 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: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org