PyRSA commented on code in PR #1406:
URL: https://github.com/apache/paimon-rust/pull/1406#discussion_r4583048885
##########
docs/src/sql.md:
##########
@@ -3556,9 +3556,14 @@ Field-scoped options used by these functions:
- `fields.<field>.ts-field` selects the key-time field for
`merge_map_with_keytime` (defaults to the last ROW field).
- `fields.<field>.nested-key`, `fields.<field>.nested-sequence-field`,
+ `fields.<field>.nested-sequence-overwrite-on-equal` (default `true`;
+ requires `nested-sequence-field`),
`fields.<field>.nested-key-null-strategy`, and `fields.<field>.count-limit`
for nested array aggregators. `nested_partial_update` requires
- `nested-key`.
+ `nested-key`. When `nested-sequence-field` is set, a nested ROW overwrites
Review Comment:
Updated the documentation to clarify that this option applies only to
`nested_update`. `nested_partial_update` retains its existing behavior and does
not provide stale-event protection through this option.
##########
crates/paimon/src/table/aggregator/nested.rs:
##########
@@ -293,6 +316,18 @@ impl NestedAgg {
Ok(Ordering::Equal)
}
+ /// Whether `new` may replace `old` for `nested_update` (Java
`shouldUpdate`).
+ fn should_update(&self, new: &StructArray, old: &StructArray) ->
crate::Result<bool> {
+ if self.sequence_indices.is_empty() {
+ return Ok(true);
+ }
+ match self.compare_sequence(new, old)? {
+ Ordering::Greater => Ok(true),
+ Ordering::Equal => Ok(self.overwrite_on_equal_sequence),
Review Comment:
Fixed. Reject `nested_update` with
`nested-sequence-overwrite-on-equal=false` when the field participates in a
partial-update sequence-group. Added regression tests for the rejected
configuration and supported cases.
--
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]