This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new a9a05bb8d9 [docs] Clarify sequence-group behavior when combined with 
aggregate functions (#7420)
a9a05bb8d9 is described below

commit a9a05bb8d9af2afc1902e69c62c3d9013c9cbd51
Author: EnzoDeng <[email protected]>
AuthorDate: Fri Mar 20 09:54:47 2026 +0800

    [docs] Clarify sequence-group behavior when combined with aggregate 
functions (#7420)
---
 .../primary-key-table/merge-engine/partial-update.md  | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/docs/content/primary-key-table/merge-engine/partial-update.md 
b/docs/content/primary-key-table/merge-engine/partial-update.md
index 31b2adc70b..e85dac6074 100644
--- a/docs/content/primary-key-table/merge-engine/partial-update.md
+++ b/docs/content/primary-key-table/merge-engine/partial-update.md
@@ -152,6 +152,22 @@ FROM SG;
 You can specify aggregation function for the input field, all the functions in 
the
 [Aggregation]({{< ref "primary-key-table/merge-engine/aggregation" >}}) are 
supported.
 
+{{< hint info >}}
+**Sequence-group behavior changes when aggregate functions are involved.**
+
+Without aggregate functions, a sequence-group field acts as a **version 
filter**: incoming records whose
+sequence value does not exceed the stored value are ignored for the associated 
columns.
+
+With aggregate functions, the sequence-group field acts as an **ordering 
key**: every incoming record with
+a non-NULL sequence value participates in the aggregation, regardless of 
whether its sequence value is
+larger or smaller than the stored one. The stored sequence value is only 
advanced when the incoming value
+is larger. For order-independent functions (`sum`, `product`, `max`, `min`) 
the ordering has no effect on
+the result; for order-dependent functions (`last_non_null_value`, 
`first_value`, `listagg`) the
+sequence-group value determines which record's contribution is considered 
"last" or "first".
+
+Records with a NULL sequence-group value are always skipped.
+{{< /hint >}}
+
 See example:
 
 ```sql
@@ -219,7 +235,8 @@ SELECT *
 FROM AGG;
 -- output 1, 3, 2, 2, "1", 1, 2
 
--- g_1, g_3 are smaller, a should not be updated
+-- (g_1, g_3) = (2, 1) is smaller than stored (2, 2), so the stored sequence 
values are not advanced,
+-- but the sum aggregate for a still applies: a = 3 + 3 = 6
 INSERT INTO AGG
 VALUES (1, 3, 3, 2, '3', 3, 1);
 

Reply via email to