@@ -29,7 +29,9 @@ use crate::utils::{
2929
3030use datafusion_common:: error:: DataFusionErrorBuilder ;
3131use datafusion_common:: tree_node:: { TreeNode , TreeNodeRecursion } ;
32- use datafusion_common:: { Column , DFSchema , Diagnostic , Result , Span , not_impl_err, plan_err} ;
32+ use datafusion_common:: {
33+ Column , DFSchema , Diagnostic , Result , Span , not_impl_err, plan_err,
34+ } ;
3335use datafusion_common:: { RecursionUnnestOption , UnnestOptions } ;
3436use datafusion_expr:: expr:: { Alias , PlannedReplaceSelectItem , WildcardOptions } ;
3537use datafusion_expr:: expr_rewriter:: {
@@ -694,33 +696,29 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
694696 _ => {
695697 let extract_table_name =
696698 |t : & TableWithJoins | -> Option < ( String , Option < Span > ) > {
697- let span =
698- Span :: try_from_sqlparser_span ( t. relation . span ( ) ) ;
699+ let span = Span :: try_from_sqlparser_span ( t. relation . span ( ) ) ;
699700 match & t. relation {
700701 TableFactor :: Table { alias : Some ( a) , .. } => {
701- let name = self
702- . ident_normalizer
703- . normalize ( a. name . clone ( ) ) ;
702+ let name =
703+ self . ident_normalizer . normalize ( a. name . clone ( ) ) ;
704704 Some ( ( name, span) )
705705 }
706- TableFactor :: Table { name, alias : None , .. } => {
706+ TableFactor :: Table {
707+ name, alias : None , ..
708+ } => {
707709 let table_name = name
708710 . 0
709711 . iter ( )
710712 . filter_map ( |p| p. as_ident ( ) )
711- . map ( |id| {
712- self . ident_normalizer
713- . normalize ( id. clone ( ) )
714- } )
713+ . map ( |id| self . ident_normalizer . normalize ( id. clone ( ) ) )
715714 . last ( ) ?;
716715 Some ( ( table_name, span) )
717716 }
718717 _ => None ,
719718 }
720719 } ;
721720
722- let mut alias_spans: HashMap < String , Option < Span > > =
723- HashMap :: new ( ) ;
721+ let mut alias_spans: HashMap < String , Option < Span > > = HashMap :: new ( ) ;
724722
725723 let mut from = from. into_iter ( ) ;
726724 let first = from. next ( ) . unwrap ( ) ;
@@ -744,8 +742,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
744742 alias_spans. entry ( name. clone ( ) ) . or_insert ( * span) ;
745743 }
746744
747- let right =
748- self . plan_table_with_joins ( input, planner_context) ?;
745+ let right = self . plan_table_with_joins ( input, planner_context) ?;
749746
750747 left = left. cross_join ( right) . map_err ( |e| {
751748 if let Some ( ( ref name, ref current_span) ) = current_name {
@@ -756,10 +753,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
756753 "duplicate table alias in FROM clause" ,
757754 * current_span,
758755 )
759- . with_note (
760- "first defined here" ,
761- Some ( prior_span) ,
762- ) ;
756+ . with_note ( "first defined here" , Some ( prior_span) ) ;
763757 return e. with_diagnostic ( diagnostic) ;
764758 }
765759 }
0 commit comments