jayzhan211 commented on code in PR #15685: URL: https://github.com/apache/datafusion/pull/15685#discussion_r2040504133
########## datafusion/physical-expr/src/expressions/dynamic_filters.rs: ########## @@ -335,22 +313,12 @@ mod test { ])); // Each ParquetExec calls `with_new_children` on the DynamicFilterPhysicalExpr // and remaps the children to the file schema. - let dynamic_filter_1 = reassign_predicate_columns( - Arc::clone(&dynamic_filter) as Arc<dyn PhysicalExpr>, - &filter_schema_1, - false, - ) - .unwrap(); - let snap = dynamic_filter_1.snapshot().unwrap().unwrap(); - insta::assert_snapshot!(format!("{snap:?}"), @r#"BinaryExpr { left: Column { name: "a", index: 0 }, op: Eq, right: Literal { value: Int32(42) }, fail_on_overflow: false }"#); - let dynamic_filter_2 = reassign_predicate_columns( - Arc::clone(&dynamic_filter) as Arc<dyn PhysicalExpr>, - &filter_schema_2, - false, - ) - .unwrap(); - let snap = dynamic_filter_2.snapshot().unwrap().unwrap(); - insta::assert_snapshot!(format!("{snap:?}"), @r#"BinaryExpr { left: Column { name: "a", index: 1 }, op: Eq, right: Literal { value: Int32(42) }, fail_on_overflow: false }"#); + let dynamic_filter_1 = dynamic_filter.with_schema(Arc::clone(&filter_schema_1)); + let snap_1 = dynamic_filter_1.snapshot().unwrap().unwrap(); + insta::assert_snapshot!(format!("{snap_1:?}"), @r#"BinaryExpr { left: Column { name: "a", index: 0 }, op: Eq, right: Literal { value: Int32(42) }, fail_on_overflow: false }"#); + let dynamic_filter_2 = dynamic_filter.with_schema(Arc::clone(&filter_schema_2)); Review Comment: > otherwise that's a ton of API churn. We only use in `DatafusionArrowPredicate`, is there any other places we need to change? The main point is that `with_new_children` in the main branch isn't doing the right thing, it should update the source filter instead, but you only update the remapped filter schema. I think the filter schema is "parameters" for remapping column indexes, it doesn't need to be part of the filter expressions at all. -- 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...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org