xudong963 commented on code in PR #23738:
URL: https://github.com/apache/datafusion/pull/23738#discussion_r3620742907


##########
datafusion/sql/src/unparser/plan.rs:
##########
@@ -1436,6 +1434,156 @@ impl Unparser<'_> {
 
                 Ok(())
             }
+            LogicalPlan::AsOfJoin(join) => {

Review Comment:
   This increases that function’s stack frame for every recursive call—even 
calls that never encounter an ASOF join.



##########
datafusion/optimizer/src/push_down_filter.rs:
##########
@@ -1104,6 +1104,32 @@ impl OptimizerRule for PushDownFilter {
                 result.map_data(|plan| Ok(with_filters(keep_predicates, plan)))
             }
             LogicalPlan::Join(join) => push_down_join(join, 
Some(filter.predicate)),
+            LogicalPlan::AsOfJoin(mut join) => {
+                let (push, keep): (Vec<_>, Vec<_>) =
+                    split_conjunction_owned(filter.predicate)
+                        .into_iter()
+                        .partition(|predicate| {
+                            !predicate.is_volatile()
+                                && predicate.column_refs().iter().all(|column| 
{
+                                    
join.left.schema().is_column_from_schema(column)
+                                })
+                        });
+                if push.is_empty() {
+                    filter.predicate =
+                        conjunction(keep).expect("filter predicates are not 
empty");
+                    filter.input = Arc::new(LogicalPlan::AsOfJoin(join));
+                    Ok(Transformed::no(LogicalPlan::Filter(filter)))
+                } else {
+                    join.left = Arc::new(LogicalPlan::Filter(Filter::new(
+                        conjunction(push).expect("push predicates are not 
empty"),

Review Comment:
   How about returning an error instead of expect.``



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