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

JingsongLi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new 16a60fcb [test] add nested update count-limit config compatibility 
tests (#1399)
16a60fcb is described below

commit 16a60fcb2f5745436f9faa0f6a8af9ddb5900824
Author: AuroraVoyage <[email protected]>
AuthorDate: Mon Nov 16 13:22:55 2026 +0800

    [test] add nested update count-limit config compatibility tests (#1399)
---
 crates/paimon/src/table/aggregator/nested.rs | 41 ++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/crates/paimon/src/table/aggregator/nested.rs 
b/crates/paimon/src/table/aggregator/nested.rs
index 4c339053..0eb4e3d7 100644
--- a/crates/paimon/src/table/aggregator/nested.rs
+++ b/crates/paimon/src/table/aggregator/nested.rs
@@ -743,6 +743,47 @@ mod tests {
         );
     }
 
+    /// Java `CoreOptions.fieldNestedUpdateAggCountLimit` defaults to
+    /// `Integer.MAX_VALUE`, accepts any `int` (including 0 / negative), and
+    /// rejects non-int strings / out-of-range values. NestedUpdate treats a
+    /// non-positive limit as "admit no rows" (`size < limit` / `count >=
+    /// remainSize`), so Rust's `max(0)` clamp matches Java results without
+    /// adopting CollectAgg's negative-limit semantics.
+    #[test]
+    fn nested_update_count_limit_config_matches_java_int_option() {
+        let (data_type, input) = input();
+
+        let mut unlimited =
+            NestedAgg::new("nested_update", "items", &data_type, 
&HashMap::new()).unwrap();
+        unlimited.agg(&input, 0).unwrap();
+        assert_eq!(result_rows(&unlimited).0, vec![Some(1), Some(2)]);
+
+        for limit in ["0", "-1", "-3"] {
+            let options = HashMap::from([("fields.items.count-limit".into(), 
limit.into())]);
+            let mut agg = NestedAgg::new("nested_update", "items", &data_type, 
&options)
+                .unwrap_or_else(|err| panic!("count-limit={limit} should 
construct: {err:?}"));
+            agg.agg(&input, 0).unwrap();
+            assert_eq!(
+                result_rows(&agg).0,
+                Vec::<Option<i32>>::new(),
+                "count-limit={limit} must admit no nested rows"
+            );
+        }
+
+        for invalid in ["abc", "1.5", "", " 2 ", "2147483648", "-2147483649"] {
+            let options = HashMap::from([("fields.items.count-limit".into(), 
invalid.into())]);
+            let err = NestedAgg::new("nested_update", "items", &data_type, 
&options).unwrap_err();
+            assert!(
+                matches!(
+                    err,
+                    Error::ConfigInvalid { ref message }
+                        if message.contains("count-limit") && 
message.contains(invalid)
+                ),
+                "count-limit={invalid:?} should be ConfigInvalid, got {err:?}"
+            );
+        }
+    }
+
     #[test]
     fn nested_reverse_keeps_raw_older_accumulator_beyond_count_limit() {
         let (data_type, input) = input();

Reply via email to