File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
rust/cubesql/cubesql/src/compile/rewrite Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2120,6 +2120,11 @@ impl LanguageToLogicalPlanConverter {
21202120 from. schema ( )
21212121 . fields ( )
21222122 . iter ( )
2123+ . chain (
2124+ joins
2125+ . iter ( )
2126+ . flat_map ( |( j, _, _) | j. schema ( ) . fields ( ) . iter ( ) ) ,
2127+ )
21232128 . map ( |f| Expr :: Column ( f. qualified_column ( ) ) )
21242129 . collect :: < Vec < _ > > ( )
21252130 } else {
@@ -2157,7 +2162,14 @@ impl LanguageToLogicalPlanConverter {
21572162 for subquery in subqueries. iter ( ) {
21582163 subqueries_schema. merge ( subquery. schema ( ) ) ;
21592164 }
2160- let schema_with_subqueries = from. schema ( ) . join ( & subqueries_schema) ?;
2165+ let mut joins_schema = DFSchema :: empty ( ) ;
2166+ for join in joins. iter ( ) {
2167+ joins_schema. merge ( join. 0 . schema ( ) ) ;
2168+ }
2169+ let schema_with_subqueries = from
2170+ . schema ( )
2171+ . join ( & subqueries_schema) ?
2172+ . join ( & joins_schema) ?;
21612173
21622174 let without_window_fields = exprlist_to_fields_from_schema (
21632175 all_expr_without_window. iter ( ) ,
You can’t perform that action at this time.
0 commit comments