ZZZxDong commented on code in PR #10983:
URL: https://github.com/apache/paimon/pull/10983#discussion_r4480949794
##########
paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java:
##########
@@ -1378,19 +1380,61 @@ private static void
validateMergeFunctionFactory(TableSchema schema) {
default:
}
- for (int i = 0; i < schema.logicalRowType().getFieldNames().size();
i++) {
- String fieldName = schema.logicalRowType().getFieldNames().get(i);
- String aggFuncName = options.fieldAggFunc(fieldName);
- aggFuncName = aggFuncName == null ? options.fieldsDefaultFunc() :
aggFuncName;
- if (aggFuncName != null) {
- FactoryUtil.discoverFactory(
- FieldAggregator.class.getClassLoader(),
- FieldAggregatorFactory.class,
- aggFuncName);
+ RowType rowType = schema.logicalRowType();
+ List<String> primaryKeys = schema.primaryKeys();
+ List<String> sequenceFields = options.sequenceField();
+ List<String> orderingFields = new ArrayList<>();
+ List<String> protectedFields = new ArrayList<>();
+ for (Map.Entry<String, String> entry : options.toMap().entrySet()) {
+ if (isSequenceGroupOption(entry.getKey())) {
+
orderingFields.addAll(sequenceGroupOrderingFields(entry.getKey()));
+
protectedFields.addAll(sequenceGroupProtectedFields(entry.getValue()));
+ }
+ }
+
+ for (int i = 0; i < rowType.getFieldNames().size(); i++) {
+ String fieldName = rowType.getFieldNames().get(i);
+ String aggFuncName =
+ resolveAggFuncName(
+ options,
+ fieldName,
+ primaryKeys,
+ sequenceFields,
+ orderingFields,
+ protectedFields);
+ if (aggFuncName == null) {
+ continue;
}
+ // Instantiate once so that type-incompatible configurations (e.g.
'collect' on a
+ // non-array column) are rejected at DDL time instead of at
read/write time.
+ FieldAggregatorFactory.create(
Review Comment:
Agreed — I'll restrict the eager check to the CREATE/ALTER schema-commit
path so reads of stored schemas keep the previous projection-scoped behavior,
and add a regression test for the time-travel projection you described.
--
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]