alexanderbianchi commented on code in PR #3739:
URL: https://github.com/apache/iceberg-rust/pull/3739#discussion_r4648476666


##########
crates/iceberg/src/arrow/reader/predicate_visitor.rs:
##########
@@ -791,6 +825,85 @@ mod tests {
         predicate_fn(batch).unwrap()
     }
 
+    fn check_set_filter(column: ArrayRef, ty: PrimitiveType, literals: 
Vec<Datum>) {

Review Comment:
   followed up cleanup in 
https://github.com/apache/iceberg-rust/commit/25daa58277177674f939fca86df4359d466cd878



##########
crates/iceberg/src/expr/predicate.rs:
##########
@@ -820,9 +889,27 @@ mod tests {
     use std::sync::Arc;
 
     use crate::expr::Predicate::{AlwaysFalse, AlwaysTrue};
-    use crate::expr::{Bind, BoundPredicate, Reference};
+    use crate::expr::{Bind, BoundPredicate, Predicate, Reference};
     use crate::spec::{Datum, NestedField, PrimitiveType, Schema, SchemaRef, 
Type};
 
+    #[test]
+    fn cloned_set_predicates_share_the_index_and_serialize_as_literals() {
+        let predicate = Reference::new("key").is_in((0..64).map(Datum::int));
+        let encoded = serde_json::to_value(&predicate).unwrap();
+        assert_eq!(encoded["Set"]["literals"].as_array().unwrap().len(), 64);
+        let restored: Predicate = 
serde_json::from_value(encoded.clone()).unwrap();
+        let clone = predicate.clone().not().rewrite_not();
+        let (Predicate::Set(original), Predicate::Set(negated)) = (&predicate, 
&clone) else {
+            panic!("expected set predicates");
+        };
+        assert!(Arc::ptr_eq(
+            &original.membership_index().unwrap(),
+            &negated.membership_index().unwrap()
+        ));
+        assert_eq!(predicate, restored);
+        assert_eq!(serde_json::to_value(&predicate).unwrap(), encoded);
+    }
+

Review Comment:
   followed up cleanup in 
https://github.com/apache/iceberg-rust/commit/5c7d3f6afb7227b49b575629d926d3a7d3f5e84b



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to