@@ -36,16 +36,18 @@ use crate::execution_plan::{
3636 boundedness_from_children, check_default_invariants, emission_type_from_children,
3737 InvariantLevel ,
3838} ;
39+ use crate :: filter_pushdown:: { FilterDescription , FilterPushdownPhase } ;
3940use crate :: metrics:: BaselineMetrics ;
4041use crate :: projection:: { make_with_child, ProjectionExec } ;
4142use crate :: stream:: ObservedStream ;
4243
4344use arrow:: datatypes:: { Field , Schema , SchemaRef } ;
4445use arrow:: record_batch:: RecordBatch ;
46+ use datafusion_common:: config:: ConfigOptions ;
4547use datafusion_common:: stats:: Precision ;
4648use datafusion_common:: { exec_err, internal_datafusion_err, internal_err, Result } ;
4749use datafusion_execution:: TaskContext ;
48- use datafusion_physical_expr:: { calculate_union, EquivalenceProperties } ;
50+ use datafusion_physical_expr:: { calculate_union, EquivalenceProperties , PhysicalExpr } ;
4951
5052use futures:: Stream ;
5153use itertools:: Itertools ;
@@ -218,10 +220,6 @@ impl ExecutionPlan for UnionExec {
218220 } )
219221 }
220222
221- fn children ( & self ) -> Vec < & Arc < dyn ExecutionPlan > > {
222- self . inputs . iter ( ) . collect ( )
223- }
224-
225223 fn maintains_input_order ( & self ) -> Vec < bool > {
226224 // If the Union has an output ordering, it maintains at least one
227225 // child's ordering (i.e. the meet).
@@ -247,6 +245,14 @@ impl ExecutionPlan for UnionExec {
247245 }
248246 }
249247
248+ fn benefits_from_input_partitioning ( & self ) -> Vec < bool > {
249+ vec ! [ false ; self . children( ) . len( ) ]
250+ }
251+
252+ fn children ( & self ) -> Vec < & Arc < dyn ExecutionPlan > > {
253+ self . inputs . iter ( ) . collect ( )
254+ }
255+
250256 fn with_new_children (
251257 self : Arc < Self > ,
252258 children : Vec < Arc < dyn ExecutionPlan > > ,
@@ -324,10 +330,6 @@ impl ExecutionPlan for UnionExec {
324330 }
325331 }
326332
327- fn benefits_from_input_partitioning ( & self ) -> Vec < bool > {
328- vec ! [ false ; self . children( ) . len( ) ]
329- }
330-
331333 fn supports_limit_pushdown ( & self ) -> bool {
332334 true
333335 }
@@ -352,6 +354,15 @@ impl ExecutionPlan for UnionExec {
352354
353355 Ok ( Some ( UnionExec :: try_new ( new_children. clone ( ) ) ?) )
354356 }
357+
358+ fn gather_filters_for_pushdown (
359+ & self ,
360+ _phase : FilterPushdownPhase ,
361+ parent_filters : Vec < Arc < dyn PhysicalExpr > > ,
362+ _config : & ConfigOptions ,
363+ ) -> Result < FilterDescription > {
364+ FilterDescription :: from_children ( parent_filters, & self . children ( ) )
365+ }
355366}
356367
357368/// Combines multiple input streams by interleaving them.
0 commit comments