alamb commented on code in PR #5785:
URL: https://github.com/apache/arrow-datafusion/pull/5785#discussion_r1154717138


##########
datafusion/sql/src/expr/identifier.rs:
##########
@@ -47,7 +46,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             // interpret names with '.' as if they were
             // compound identifiers, but this is not a compound
             // identifier. (e.g. it is "foo.bar" not foo.bar)
-            let normalize_ident = normalize_ident(id);
+            let normalize_ident =

Review Comment:
   It would be really nice to refactor the code to make it harder to miss such 
functions. Maybe we could add a struct like
   
   ```rust
   struct IdentNormalizer {
     bool normalize;
   }
   
   impl IdentNormalizer {
     fn normalize(id: Ident) -> String {
     ...
      }
   }
   ```
   
   And then we could change `SqlToRel` so it had a normalizer field, and remove 
the `fn normalize_ident` entirely -- that way the compiler could help make sure 
there are no more missing `normalize_ident` callsites (b/c they would all have 
to be changed to `self.normalizer.normalize(...)`



##########
datafusion/sql/src/planner.rs:
##########
@@ -424,7 +424,7 @@ pub fn object_name_to_qualifier(
         .join(" AND ")
 }
 
-fn normalize_ident(id: Ident, enable_normalization: bool) -> String {
+pub fn normalize_ident(id: Ident, enable_normalization: bool) -> String {

Review Comment:
   What would you think about making `crate::utils::normalize_ident` pub 
instead? making something public that only does something if `true` is passed 
in seems somewhat strange to me



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to