@@ -52,6 +52,7 @@ use datafusion::physical_plan::limit::{GlobalLimitExec, LocalLimitExec};
52
52
use datafusion:: physical_plan:: projection:: ProjectionExec ;
53
53
use datafusion:: physical_plan:: repartition:: RepartitionExec ;
54
54
use datafusion:: physical_plan:: sorts:: sort:: SortExec ;
55
+ use datafusion:: physical_plan:: union:: UnionExec ;
55
56
use datafusion:: physical_plan:: windows:: { create_window_expr, WindowAggExec } ;
56
57
use datafusion:: physical_plan:: {
57
58
AggregateExpr , ExecutionPlan , Partitioning , PhysicalExpr , WindowExpr ,
@@ -382,6 +383,13 @@ impl AsExecutionPlan for PhysicalPlanNode {
382
383
& hashjoin. null_equals_null ,
383
384
) ?) )
384
385
}
386
+ PhysicalPlanType :: Union ( union) => {
387
+ let mut inputs: Vec < Arc < dyn ExecutionPlan > > = vec ! [ ] ;
388
+ for input in & union. inputs {
389
+ inputs. push ( input. try_into_physical_plan ( ctx, extension_codec) ?) ;
390
+ }
391
+ Ok ( Arc :: new ( UnionExec :: new ( inputs) ) )
392
+ }
385
393
PhysicalPlanType :: CrossJoin ( crossjoin) => {
386
394
let left: Arc < dyn ExecutionPlan > =
387
395
into_physical_plan ! ( crossjoin. left, ctx, extension_codec) ?;
@@ -866,6 +874,19 @@ impl AsExecutionPlan for PhysicalPlanNode {
866
874
} ,
867
875
) ) ,
868
876
} )
877
+ } else if let Some ( union) = plan. downcast_ref :: < UnionExec > ( ) {
878
+ let mut inputs: Vec < PhysicalPlanNode > = vec ! [ ] ;
879
+ for input in union. inputs ( ) {
880
+ inputs. push ( protobuf:: PhysicalPlanNode :: try_from_physical_plan (
881
+ input. to_owned ( ) ,
882
+ extension_codec,
883
+ ) ?) ;
884
+ }
885
+ Ok ( protobuf:: PhysicalPlanNode {
886
+ physical_plan_type : Some ( PhysicalPlanType :: Union (
887
+ protobuf:: UnionExecNode { inputs } ,
888
+ ) ) ,
889
+ } )
869
890
} else {
870
891
let mut buf: Vec < u8 > = vec ! [ ] ;
871
892
extension_codec. try_encode ( plan_clone. clone ( ) , & mut buf) ?;
0 commit comments