rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714076692
##########
File path: datafusion/src/logical_plan/expr.rs
##########
@@ -2107,4 +2107,27 @@ mod tests {
assert!(exp2 < exp3);
assert!(exp3 > exp2);
}
+
+ #[test]
+ fn combine_zero_filters() {
+ let result = combine_filters(&[]);
+ assert_eq!(result, None);
+ }
+
+ #[test]
+ fn combine_one_filter() {
+ let filter = binary_expr(col("c1"), Operator::Lt, lit(1));
+ let result = combine_filters(&[filter.clone()]);
+ assert_eq!(result, Some(filter));
+ }
+
+ #[test]
+ fn combine_multiple_filters() {
+ let filter1 = binary_expr(col("c1"), Operator::Lt, lit(1));
+ let filter2 = binary_expr(col("c2"), Operator::Lt, lit(2));
+ let filter3 = binary_expr(col("c3"), Operator::Lt, lit(3));
+ let result =
+ combine_filters(&[filter1.clone(), filter2.clone(),
filter3.clone()]);
+ assert_eq!(result, Some(and(and(filter1, filter2), filter3)));
+ }
Review comment:
this tests were in the wrong place (`datasource::parquet.rs`), moving
them here to avoid losing them
##########
File path: datafusion/src/logical_plan/expr.rs
##########
@@ -2107,4 +2107,27 @@ mod tests {
assert!(exp2 < exp3);
assert!(exp3 > exp2);
}
+
+ #[test]
+ fn combine_zero_filters() {
+ let result = combine_filters(&[]);
+ assert_eq!(result, None);
+ }
+
+ #[test]
+ fn combine_one_filter() {
+ let filter = binary_expr(col("c1"), Operator::Lt, lit(1));
+ let result = combine_filters(&[filter.clone()]);
+ assert_eq!(result, Some(filter));
+ }
+
+ #[test]
+ fn combine_multiple_filters() {
+ let filter1 = binary_expr(col("c1"), Operator::Lt, lit(1));
+ let filter2 = binary_expr(col("c2"), Operator::Lt, lit(2));
+ let filter3 = binary_expr(col("c3"), Operator::Lt, lit(3));
+ let result =
+ combine_filters(&[filter1.clone(), filter2.clone(),
filter3.clone()]);
+ assert_eq!(result, Some(and(and(filter1, filter2), filter3)));
+ }
Review comment:
these tests were in the wrong place (`datasource::parquet.rs`), moving
them here to avoid losing them
--
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]