alamb commented on code in PR #14113:
URL: https://github.com/apache/datafusion/pull/14113#discussion_r1913554182


##########
datafusion/expr/src/expr_rewriter/mod.rs:
##########
@@ -462,10 +462,11 @@ mod test {
             normalize_col_with_schemas_and_ambiguity_check(expr, &[&schemas], 
&[])
                 .unwrap_err()
                 .strip_backtrace();
-        assert_eq!(
-            error,
-            r#"Schema error: No field named b. Valid fields are "tableA".a."#
-        );
+        let expected = "Schema error: No field named b. \
+            You can use double quotes to refer to the \"b\" column \
+            or set the datafusion.sql_parser.enable_ident_normalization 
configuration option. \
+            Valid fields are \"tableA\".a.";

Review Comment:
   I think this is confusing as the message says use \"b\" but there is no 
column named `b` 
   
   Can you change it so that the normalization suggestion is only shown when a 
column name in the schema would have matched if the case was different?



##########
datafusion/common/src/error.rs:
##########
@@ -167,6 +167,12 @@ impl Display for SchemaError {
                 valid_fields,
             } => {
                 write!(f, "No field named {}", field.quoted_flat_name())?;
+                write!(
+                    f,
+                    ". You can use double quotes to refer to the \"{}\" 
column",

Review Comment:
   I think it is important to provide an alternate syntax for users of end 
systems who can not control the DataFusion settings. For example, for our 
InfluxDB users they can't set the configuration settings
   
   I suspect the @TheBuilderJR 's users would likely not be able to change this 
setting
   
   What about something like this (only in cases where the schema contains a 
column that matches except for case)
   
   ```
   Column names are case sensitive. Use double quotes to refer to the "z" column
   or set the datafusion.sql_parser.enable_ident_normalization configuration
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to