File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
datafusion/core/src/physical_plan Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change 2222
2323use arrow:: compute:: concat;
2424use std:: any:: Any ;
25+ use std:: collections:: HashMap ;
2526use std:: pin:: Pin ;
2627use std:: sync:: Arc ;
2728use std:: task:: { Context , Poll } ;
@@ -61,23 +62,15 @@ impl SubqueryExec {
6162 input : Arc < dyn ExecutionPlan > ,
6263 cursor : Arc < OuterQueryCursor > ,
6364 ) -> Result < Self > {
64- let input_schema = ( * input. schema ( ) ) . clone ( ) ;
65+ let input_schema = input. schema ( ) ;
6566
66- let merged_schema = Schema :: try_merge (
67- vec ! [ input_schema] . into_iter ( ) . chain (
68- subqueries
69- . iter ( )
70- . map ( |s| ( * s. schema ( ) ) . clone ( ) )
71- . collect :: < Vec < _ > > ( ) ,
72- ) ,
73- ) ?;
74-
75- if merged_schema. fields ( ) . len ( )
76- != input. schema ( ) . fields ( ) . len ( ) + subqueries. len ( )
77- {
78- return Err ( DataFusionError :: Plan ( "One or more correlated sub queries use same column names which is not supported" . to_string ( ) ) ) ;
67+ let mut total_fields = input_schema. fields ( ) . clone ( ) ;
68+ for q in subqueries. iter ( ) {
69+ total_fields. append ( & mut q. schema ( ) . fields ( ) . clone ( ) ) ;
7970 }
8071
72+ let merged_schema = Schema :: new_with_metadata ( total_fields, HashMap :: new ( ) ) ;
73+
8174 Ok ( Self {
8275 subqueries,
8376 schema : Arc :: new ( merged_schema) ,
You can’t perform that action at this time.
0 commit comments