@@ -27,7 +27,7 @@ use datafusion::arrow::datatypes::{
27
27
use datafusion:: common:: Result as DFResult ;
28
28
use datafusion:: error:: DataFusionError ;
29
29
use datafusion:: execution:: { SendableRecordBatchStream , TaskContext } ;
30
- use datafusion:: physical_expr:: EquivalenceProperties ;
30
+ use datafusion:: physical_expr:: { EquivalenceProperties , Partitioning } ;
31
31
use datafusion:: physical_plan:: stream:: RecordBatchStreamAdapter ;
32
32
use datafusion:: physical_plan:: {
33
33
DisplayAs , DisplayFormatType , ExecutionPlan , ExecutionPlanProperties , PlanProperties ,
@@ -61,7 +61,7 @@ pub(crate) struct IcebergWriteExec {
61
61
62
62
impl IcebergWriteExec {
63
63
pub fn new ( table : Table , input : Arc < dyn ExecutionPlan > , schema : ArrowSchemaRef ) -> Self {
64
- let plan_properties = Self :: compute_properties ( & input, schema. clone ( ) ) ;
64
+ let plan_properties = Self :: compute_properties ( & input, schema) ;
65
65
66
66
Self {
67
67
table,
@@ -77,7 +77,7 @@ impl IcebergWriteExec {
77
77
) -> PlanProperties {
78
78
PlanProperties :: new (
79
79
EquivalenceProperties :: new ( schema) ,
80
- input. output_partitioning ( ) . clone ( ) ,
80
+ Partitioning :: UnknownPartitioning ( input. output_partitioning ( ) . partition_count ( ) ) ,
81
81
input. pipeline_behavior ( ) ,
82
82
input. boundedness ( ) ,
83
83
)
@@ -147,14 +147,24 @@ impl ExecutionPlan for IcebergWriteExec {
147
147
}
148
148
149
149
fn children ( & self ) -> Vec < & Arc < dyn ExecutionPlan > > {
150
- vec ! [ ]
150
+ vec ! [ & self . input ]
151
151
}
152
152
153
153
fn with_new_children (
154
154
self : Arc < Self > ,
155
- _children : Vec < Arc < dyn ExecutionPlan > > ,
155
+ children : Vec < Arc < dyn ExecutionPlan > > ,
156
156
) -> DFResult < Arc < dyn ExecutionPlan > > {
157
- Ok ( self )
157
+ if children. len ( ) != 1 {
158
+ return Err ( DataFusionError :: Internal (
159
+ "IcebergWriteExec expects exactly one child" . to_string ( ) ,
160
+ ) ) ;
161
+ }
162
+
163
+ Ok ( Arc :: new ( Self :: new (
164
+ self . table . clone ( ) ,
165
+ Arc :: clone ( & children[ 0 ] ) ,
166
+ self . schema ( ) ,
167
+ ) ) )
158
168
}
159
169
160
170
fn execute (
0 commit comments