liukun4515 commented on code in PR #3324: URL: https://github.com/apache/arrow-datafusion/pull/3324#discussion_r962402998
########## datafusion/physical-expr/src/expressions/in_list.rs: ########## @@ -906,6 +918,66 @@ mod tests { Ok(()) } + #[test] + fn in_list_binary() -> Result<()> { + let schema = Schema::new(vec![Field::new("a", DataType::Binary, true)]); + let a = BinaryArray::from(vec![ + Some([1, 2, 3].as_slice()), + Some([1, 2, 2].as_slice()), + None, + ]); + let col_a = col("a", &schema)?; + let batch = RecordBatch::try_new(Arc::new(schema.clone()), vec![Arc::new(a)])?; + + // expression: "a in ([1, 2, 3], [4, 5, 6])" + let list = vec![lit([1, 2, 3].as_slice()), lit([4, 5, 6].as_slice())]; + in_list!( + batch, + list.clone(), + &false, + vec![Some(true), Some(false), None], + col_a.clone(), + &schema + ); + + // expression: "a not in ([1, 2, 3], [4, 5, 6])" + in_list!( + batch, + list, + &true, + vec![Some(false), Some(true), None], + col_a.clone(), + &schema + ); + + // expression: "a in ([1, 2, 3], [4, 5, 6], null)" + let list = vec![ + lit([1, 2, 3].as_slice()), + lit([4, 5, 6].as_slice()), + lit(ScalarValue::Binary(None)), + ]; + in_list!( + batch, + list.clone(), + &false, + vec![Some(true), None, None], + col_a.clone(), + &schema + ); + + // expression: "a in ([1, 2, 3], [4, 5, 6], null)" Review Comment: I think the comment should be ``` // expression: "a not in ([1, 2, 3], [4, 5, 6], null)" ``` cc @HaoYang670 -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org