@@ -1111,7 +1111,6 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
11111111 & plan,
11121112 select. projection ,
11131113 empty_from,
1114- outer_query_schema,
11151114 planner_context,
11161115 & from_schema,
11171116 ) ?;
@@ -1286,7 +1285,6 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
12861285 plan : & LogicalPlan ,
12871286 projection : Vec < SelectItem > ,
12881287 empty_from : bool ,
1289- outer_query_schema : Option < & DFSchema > ,
12901288 planner_context : & mut PlannerContext ,
12911289 from_schema : & DFSchema ,
12921290 ) -> Result < Vec < Expr > > {
@@ -1297,7 +1295,6 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
12971295 expr,
12981296 plan,
12991297 empty_from,
1300- outer_query_schema,
13011298 planner_context,
13021299 from_schema,
13031300 )
@@ -1605,28 +1602,18 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
16051602 sql : SelectItem ,
16061603 plan : & LogicalPlan ,
16071604 empty_from : bool ,
1608- outer_query_schema : Option < & DFSchema > ,
16091605 planner_context : & mut PlannerContext ,
16101606 from_schema : & DFSchema ,
16111607 ) -> Result < Vec < Expr > > {
1612- let input_schema = match outer_query_schema {
1613- Some ( x) => {
1614- let mut input_schema = plan. schema ( ) . as_ref ( ) . clone ( ) ;
1615- input_schema. merge ( x) ;
1616- input_schema
1617- }
1618- _ => plan. schema ( ) . as_ref ( ) . clone ( ) ,
1619- } ;
1620-
16211608 match sql {
16221609 SelectItem :: UnnamedExpr ( expr) => {
1623- let expr = self . sql_to_rex ( expr, & input_schema , planner_context) ?;
1610+ let expr = self . sql_to_rex ( expr, plan . schema ( ) , planner_context) ?;
16241611 self . column_reference_ambiguous_check ( from_schema, & [ expr. clone ( ) ] ) ?;
16251612 Ok ( vec ! [ normalize_col( expr, plan) ?] )
16261613 }
16271614 SelectItem :: ExprWithAlias { expr, alias } => {
16281615 let select_expr =
1629- self . sql_to_rex ( expr, & input_schema , planner_context) ?;
1616+ self . sql_to_rex ( expr, plan . schema ( ) , planner_context) ?;
16301617 self . column_reference_ambiguous_check (
16311618 from_schema,
16321619 & [ select_expr. clone ( ) ] ,
@@ -2150,7 +2137,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
21502137 negated,
21512138 Box :: new ( self . sql_expr_to_logical_expr ( * expr, schema, planner_context) ?) ,
21522139 Box :: new ( pattern) ,
2153- escape_char,
2140+ escape_char
21542141 ) ) )
21552142 }
21562143
@@ -2376,13 +2363,13 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
23762363 }
23772364 }
23782365
2379- SQLExpr :: Floor { expr, field : _field } => {
2366+ SQLExpr :: Floor { expr, field : _field} => {
23802367 let fun = BuiltinScalarFunction :: Floor ;
23812368 let args = vec ! [ self . sql_expr_to_logical_expr( * expr, schema, planner_context) ?] ;
23822369 Ok ( Expr :: ScalarFunction { fun, args } )
23832370 }
23842371
2385- SQLExpr :: Ceil { expr, field : _field } => {
2372+ SQLExpr :: Ceil { expr, field : _field} => {
23862373 let fun = BuiltinScalarFunction :: Ceil ;
23872374 let args = vec ! [ self . sql_expr_to_logical_expr( * expr, schema, planner_context) ?] ;
23882375 Ok ( Expr :: ScalarFunction { fun, args } )
@@ -2673,7 +2660,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
26732660 return Err ( DataFusionError :: Plan ( format ! (
26742661 "Unsupported Value {}" ,
26752662 value[ 0 ]
2676- ) ) ) ;
2663+ ) ) )
26772664 }
26782665 } ,
26792666 // for capture signed number e.g. +8, -8
@@ -2684,14 +2671,14 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
26842671 return Err ( DataFusionError :: Plan ( format ! (
26852672 "Unsupported Value {}" ,
26862673 value[ 0 ]
2687- ) ) ) ;
2674+ ) ) )
26882675 }
26892676 } ,
26902677 _ => {
26912678 return Err ( DataFusionError :: Plan ( format ! (
26922679 "Unsupported Value {}" ,
26932680 value[ 0 ]
2694- ) ) ) ;
2681+ ) ) )
26952682 }
26962683 } ;
26972684
@@ -2921,7 +2908,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
29212908 return Err ( DataFusionError :: Internal ( format ! (
29222909 "Incorrect data type for time_zone: {}" ,
29232910 v. get_datatype( ) ,
2924- ) ) ) ;
2911+ ) ) )
29252912 }
29262913 None => return Err ( DataFusionError :: Internal (
29272914 "Config Option datafusion.execution.time_zone doesn't exist"
@@ -2949,7 +2936,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
29492936 }
29502937 }
29512938 SQLDataType :: Numeric ( exact_number_info)
2952- | SQLDataType :: Decimal ( exact_number_info) => {
2939+ |SQLDataType :: Decimal ( exact_number_info) => {
29532940 let ( precision, scale) = match * exact_number_info {
29542941 ExactNumberInfo :: None => ( None , None ) ,
29552942 ExactNumberInfo :: Precision ( precision) => ( Some ( precision) , None ) ,
@@ -2981,12 +2968,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
29812968 | SQLDataType :: CharacterVarying ( _)
29822969 | SQLDataType :: CharVarying ( _)
29832970 | SQLDataType :: CharacterLargeObject ( _)
2984- | SQLDataType :: CharLargeObject ( _)
2971+ | SQLDataType :: CharLargeObject ( _)
29852972 // precision is not supported
2986- | SQLDataType :: Timestamp ( Some ( _) , _)
2973+ | SQLDataType :: Timestamp ( Some ( _) , _)
29872974 // precision is not supported
2988- | SQLDataType :: Time ( Some ( _) , _)
2989- | SQLDataType :: Dec ( _)
2975+ | SQLDataType :: Time ( Some ( _) , _)
2976+ | SQLDataType :: Dec ( _)
29902977 | SQLDataType :: Clob ( _) => Err ( DataFusionError :: NotImplemented ( format ! (
29912978 "Unsupported SQL type {:?}" ,
29922979 sql_type
0 commit comments