jiwen624 opened a new issue, #27843:
URL: https://github.com/apache/datafusion/issues/27843

   ### Describe the bug
   
   With the default setting `datafusion.sql_parser.enable_ident_normalization = 
true`, unquoted target column names in the `REPLACE`, `EXCLUDE` and `EXCEPT` 
options of `SELECT *`  are not normalized to lowercase.
   
   For a table with a lowercase column `col1`, using unquoted `COL1` causes 
`REPLACE` to silently leave the column unchanged, while `EXCLUDE` and `EXCEPT` 
fail with a schema error. Ordinary column references such as `SELECT COL1 FROM 
t` resolve correctly.
   
   ### To Reproduce
   
   ```SQL
   CREATE TABLE t (col1 INT, col2 VARCHAR) AS VALUES (1, 'a'), (2, 'b');
   
   SELECT * REPLACE (col1 + 1 AS COL1) FROM t;
   -- col1 = 1, 2
   
   SELECT * EXCLUDE (COL1) FROM t;
   -- Schema error: No field named "COL1". Did you mean 't.col1'?
   
   SELECT * EXCEPT (COL1) FROM t;
   -- Schema error: No field named "COL1". Did you mean 't.col1'?
   ```
   
   ### Expected behavior
   
   The same results as with col1: REPLACE returns col1 = 2, 3, and 
EXCLUDE/EXCEPT return only col2. SELECT COL1 FROM t already works.
   
   ### Additional context
   
   Similar to #9714
   
   ### Willingness to contribute
   
   I plan to contribute a fix for this bug independently


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