@@ -412,11 +412,14 @@ impl ExecutionPlan for WindowAggExec {
412412
413413 /// Get the output partitioning of this plan
414414 fn output_partitioning ( & self ) -> Partitioning {
415- Partitioning :: UnknownPartitioning ( 1 )
415+ // because we can have repartitioning using the partition keys
416+ // this would be either 1 or more than 1 depending on the presense of
417+ // repartitioning
418+ self . input . output_partitioning ( )
416419 }
417420
418421 fn required_child_distribution ( & self ) -> Distribution {
419- Distribution :: SinglePartition
422+ Distribution :: UnspecifiedDistribution
420423 }
421424
422425 fn with_new_children (
@@ -436,22 +439,7 @@ impl ExecutionPlan for WindowAggExec {
436439 }
437440
438441 async fn execute ( & self , partition : usize ) -> Result < SendableRecordBatchStream > {
439- if 0 != partition {
440- return Err ( DataFusionError :: Internal ( format ! (
441- "WindowAggExec invalid partition {}" ,
442- partition
443- ) ) ) ;
444- }
445-
446- // window needs to operate on a single partition currently
447- if 1 != self . input . output_partitioning ( ) . partition_count ( ) {
448- return Err ( DataFusionError :: Internal (
449- "WindowAggExec requires a single input partition" . to_owned ( ) ,
450- ) ) ;
451- }
452-
453442 let input = self . input . execute ( partition) . await ?;
454-
455443 let stream = Box :: pin ( WindowAggStream :: new (
456444 self . schema . clone ( ) ,
457445 self . window_expr . clone ( ) ,
@@ -591,38 +579,6 @@ mod tests {
591579 Ok ( ( input, schema) )
592580 }
593581
594- #[ tokio:: test]
595- async fn window_function_input_partition ( ) -> Result < ( ) > {
596- let ( input, schema) = create_test_schema ( 4 ) ?;
597-
598- let window_exec = Arc :: new ( WindowAggExec :: try_new (
599- vec ! [ create_window_expr(
600- & WindowFunction :: AggregateFunction ( AggregateFunction :: Count ) ,
601- "count" . to_owned( ) ,
602- & [ col( "c3" , & schema) ?] ,
603- & [ ] ,
604- & [ ] ,
605- Some ( WindowFrame :: default ( ) ) ,
606- schema. as_ref( ) ,
607- ) ?] ,
608- input,
609- schema. clone ( ) ,
610- ) ?) ;
611-
612- let result = collect ( window_exec) . await ;
613-
614- assert ! ( result. is_err( ) ) ;
615- if let Some ( DataFusionError :: Internal ( msg) ) = result. err ( ) {
616- assert_eq ! (
617- msg,
618- "WindowAggExec requires a single input partition" . to_owned( )
619- ) ;
620- } else {
621- unreachable ! ( "Expect an internal error to happen" ) ;
622- }
623- Ok ( ( ) )
624- }
625-
626582 #[ tokio:: test]
627583 async fn window_function ( ) -> Result < ( ) > {
628584 let ( input, schema) = create_test_schema ( 1 ) ?;
0 commit comments