You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "Aitozi (via GitHub)" <gi...@apache.org> on 2024/03/27 04:27:10 UTC
[PR] [core] Fix the incorrect aggregation result due to the sequence number [paimon]
Aitozi opened a new pull request, #3101:
URL: https://github.com/apache/paimon/pull/3101
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
<!-- Linking this pull request to the issue -->
Linked issue: close #3020
This pr is meant to fix the incorrect aggregation result for `first`, `first_not_null`, `last_not_null`
<!-- What is the purpose of the change -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Fix the incorrect aggregation result due to the sequence number [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #3101:
URL: https://github.com/apache/paimon/pull/3101#discussion_r1540671730
##########
paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/PartialUpdateITCase.java:
##########
@@ -322,12 +322,57 @@ public void testFirstValuePartialUpdate() {
sql("INSERT INTO AGG VALUES (1, 1, 1), (1, 2, 2)");
- assertThat(sql("SELECT * FROM AGG")).containsExactlyInAnyOrder(Row.of(1, 1, 2));
+ assertThat(sql("SELECT * FROM AGG")).containsExactlyInAnyOrder(Row.of(1, 1, 1));
// old sequence
sql("INSERT INTO AGG VALUES (1, 0, 0)");
- assertThat(sql("SELECT * FROM AGG")).containsExactlyInAnyOrder(Row.of(1, 0, 2));
+ assertThat(sql("SELECT * FROM AGG")).containsExactlyInAnyOrder(Row.of(1, 0, 0));
+ }
+
+ @Test
+ public void testRequiredSequenceAggregator() {
+ sql(
+ "CREATE TABLE AGG ("
+ + "k INT, a varchar, b varchar, c varchar, g_1 bigINT, g_2 INT, g_3 INT, "
+ + " PRIMARY KEY (k) NOT ENFORCED)"
+ + " WITH ("
+ + "'merge-engine'='partial-update', "
+ + "'fields.g_1.sequence-group'='a', "
+ + "'fields.g_2.sequence-group'='b', "
+ + "'fields.g_3.sequence-group'='c', "
+ + "'fields.a.aggregate-function'='first_non_null_value',"
+ + "'fields.b.aggregate-function'='last_non_null_value',"
+ + "'fields.c.aggregate-function'='last_value');");
+ sql("INSERT INTO AGG VALUES (1, cast(null as varchar), '1', '1', 1, 1, 1)");
+ sql(
+ "INSERT INTO AGG VALUES (1, '1', cast(null as varchar), cast(null as varchar), 4, 4, 4)");
+ assertThat(sql("SELECT * FROM AGG"))
+ .containsExactlyInAnyOrder(Row.of(1, "1", "1", null, 4L, 1, 4));
Review Comment:
Because it is `last_non_null_value`, its corresponding sequence_field should not be updated? I feel like we need to introduce a new option prefix, otherwise there may be some semantic issues. Here, we need an exclusive sequence_group.
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Fix the incorrect aggregation result due to the sequence number [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi closed pull request #3101: [core] Fix the incorrect aggregation result due to the sequence number
URL: https://github.com/apache/paimon/pull/3101
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org