alamb commented on a change in pull request #9600:
URL: https://github.com/apache/arrow/pull/9600#discussion_r593100188



##########
File path: rust/datafusion/src/execution/context.rs
##########
@@ -495,13 +495,30 @@ impl QueryPlanner for DefaultQueryPlanner {
     }
 }
 
+/// The style of case display
+#[derive(Clone, PartialEq)]
+pub enum CaseStyle {
+    /// Case style like MySQL, SELECT mD5("a") will output SELECT mD5("a")
+    LikeMySQL,
+    /// Case style like PostgreSQL, SELECT mD5("a") will output SELECT md5("a")
+    LikePostgreSQL,

Review comment:
       ```suggestion
       /// function names in the output are displayed as they were provided:
       /// 'mD5("a")' will appear in the results as `mD5("a")`. This 
       /// mimics MySQL behavior
       PreserveCase,
       /// function names in the output are displayed in lower case:
       /// `mD5("a")` will appear in the results as  `md5("a")`This 
       /// mimics PostgreSQL behavior
       LikePostgreSQL,
   ```
   
   I think naming the enum variants based on what they do may be clearer

##########
File path: rust/datafusion/src/execution/context.rs
##########
@@ -495,13 +495,30 @@ impl QueryPlanner for DefaultQueryPlanner {
     }
 }
 
+/// The style of case display

Review comment:
       ```suggestion
   /// The style of displaying function and aggregate names in the query results
   ```

##########
File path: rust/datafusion/src/sql/planner.rs
##########
@@ -963,7 +983,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                             .collect::<Result<Vec<Expr>>>()?
                     };
 
+                    if let CaseStyle::LikePostgreSQL = case_style {
+                        input_name = input_name.to_uppercase();

Review comment:
       I think postgres does `to_lowercase` -- this also seems to be 
inconsistent with the clause above (that also uses `to_lowercase`. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to