@@ -167,14 +167,24 @@ impl ResolveUnqualifiedIdentifer {
167167
168168 // Step 3: Rewrite expressions in the WHERE and ORDER BY clauses.
169169 if let Some ( selection) = & mut select. selection {
170- Self :: rewrite_expr ( selection, & wildcard_alias, & table_aliases, & projection_aliases) ;
170+ Self :: rewrite_expr (
171+ selection,
172+ & wildcard_alias,
173+ & table_aliases,
174+ & projection_aliases,
175+ ) ;
171176 }
172177
173178 if let Some ( OrderByKind :: Expressions ( order_by_exprs) ) =
174179 query. order_by . as_mut ( ) . map ( |o| & mut o. kind )
175180 {
176181 for order_by_expr in order_by_exprs {
177- Self :: rewrite_expr ( & mut order_by_expr. expr , & wildcard_alias, & table_aliases, & projection_aliases) ;
182+ Self :: rewrite_expr (
183+ & mut order_by_expr. expr ,
184+ & wildcard_alias,
185+ & table_aliases,
186+ & projection_aliases,
187+ ) ;
178188 }
179189 }
180190 }
@@ -247,11 +257,18 @@ impl ResolveUnqualifiedIdentifer {
247257 aliases
248258 }
249259
250- fn rewrite_expr ( expr : & mut Expr , wildcard_alias : & str , table_aliases : & HashSet < String > , projection_aliases : & HashSet < String > ) {
260+ fn rewrite_expr (
261+ expr : & mut Expr ,
262+ wildcard_alias : & str ,
263+ table_aliases : & HashSet < String > ,
264+ projection_aliases : & HashSet < String > ,
265+ ) {
251266 match expr {
252267 Expr :: Identifier ( ident) => {
253268 // If the identifier is not a table alias itself and not already aliased in projection, rewrite it.
254- if !table_aliases. contains ( & ident. value ) && !projection_aliases. contains ( & ident. value ) {
269+ if !table_aliases. contains ( & ident. value )
270+ && !projection_aliases. contains ( & ident. value )
271+ {
255272 * expr = Expr :: CompoundIdentifier ( vec ! [
256273 Ident :: new( wildcard_alias. to_string( ) ) ,
257274 ident. clone( ) ,
0 commit comments