JingsongLi commented on code in PR #8374:
URL: https://github.com/apache/paimon/pull/8374#discussion_r3519469859
##########
paimon-core/src/test/java/org/apache/paimon/mergetree/compact/aggregate/FieldAggregatorTest.java:
##########
@@ -795,6 +799,116 @@ public void testFieldNestedAppendAgg() {
.containsExactlyInAnyOrderElementsOf(Collections.singletonList(row(0, 1, "B")));
}
+ @Test
+ public void testFieldNestedUpdateAggFactoryWithSequenceFieldPrerequisite()
{
+ DataType elementRowType =
+ DataTypes.ROW(
+ DataTypes.FIELD(0, "k0", DataTypes.INT()),
+ DataTypes.FIELD(1, "k1", DataTypes.INT()),
+ DataTypes.FIELD(2, "v", DataTypes.STRING()),
+ DataTypes.FIELD(3, "seq", DataTypes.INT()));
+
+ org.assertj.core.api.Assertions.assertThatThrownBy(
+ () ->
+ new FieldNestedUpdateAggFactory()
+ .create(
+
DataTypes.ARRAY(elementRowType),
+ CoreOptions.fromMap(
+ ImmutableMap.of(
+
"fields.fieldName.nested-sequence-field",
+ "seq")),
+ "fieldName"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage(
+ "Option 'fields.<field-name>.nested-sequence-field'
requires "
+ + "'fields.<field-name>.nested-key' to be
configured.");
+
+ FieldNestedUpdateAgg agg1 =
+ new FieldNestedUpdateAggFactory()
+ .create(
+ DataTypes.ARRAY(elementRowType),
+ CoreOptions.fromMap(new HashMap<>()),
+ "fieldName");
+ org.assertj.core.api.Assertions.assertThat(agg1).isNotNull();
+
+ FieldNestedUpdateAgg agg2 =
+ new FieldNestedUpdateAggFactory()
+ .create(
+ DataTypes.ARRAY(elementRowType),
+ CoreOptions.fromMap(
+
ImmutableMap.of("fields.filedName.nested-key", "k0,k1")),
Review Comment:
These positive factory cases use `fields.filedName...` while `create(...,
"fieldName")` reads options under `fields.fieldName...`, so the configured
`nested-key`, `nested-sequence-field`, and `nested-key-null-strategy` values
are ignored. The assertions still pass with the default empty configuration,
which means the tests do not cover the successful configured paths or lowercase
enum parsing. Please fix the option key typo and assert behavior that depends
on the configured options.
--
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]