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 @@ -2121,6 +2121,11 @@ impl LanguageToLogicalPlanConverter {
21212121 from. schema ( )
21222122 . fields ( )
21232123 . iter ( )
2124+ . chain (
2125+ joins
2126+ . iter ( )
2127+ . flat_map ( |( j, _, _) | j. schema ( ) . fields ( ) . iter ( ) ) ,
2128+ )
21242129 . map ( |f| Expr :: Column ( f. qualified_column ( ) ) )
21252130 . collect :: < Vec < _ > > ( )
21262131 } else {
@@ -2158,7 +2163,14 @@ impl LanguageToLogicalPlanConverter {
21582163 for subquery in subqueries. iter ( ) {
21592164 subqueries_schema. merge ( subquery. schema ( ) ) ;
21602165 }
2161- let schema_with_subqueries = from. schema ( ) . join ( & subqueries_schema) ?;
2166+ let mut joins_schema = DFSchema :: empty ( ) ;
2167+ for join in joins. iter ( ) {
2168+ joins_schema. merge ( join. 0 . schema ( ) ) ;
2169+ }
2170+ let schema_with_subqueries = from
2171+ . schema ( )
2172+ . join ( & subqueries_schema) ?
2173+ . join ( & joins_schema) ?;
21622174
21632175 let without_window_fields = exprlist_to_fields_from_schema (
21642176 all_expr_without_window. iter ( ) ,
You can’t perform that action at this time.
0 commit comments