PyRSA commented on code in PR #8374:
URL: https://github.com/apache/paimon/pull/8374#discussion_r3520149808
##########
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:
Thanks for pointing this out! Fixed the option key typo and updated the
tests to cover the configured paths and option behaviors.
--
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]