parkma99 commented on issue #7460:
URL: 
https://github.com/apache/arrow-datafusion/issues/7460#issuecomment-1703150509

   Hello here is my  solution.
   
   function `field_with_unqualified_name` add one parameter named `ignore_case` 
with bool type. 
   in function body 
   change:
   
   `.filter(|field| field.name() == name)` => `.filter(|field| if ignore_case{ 
field.name().to_ascii_lowercase() == name}else{ field.name() == name}) `
   
   
https://github.com/apache/arrow-datafusion/blob/58fc80eddaf93d4c6399e4ac4fc1234649b26e43/datafusion/sql/src/expr/identifier.rs#L49-L56
   
   we can find get `igore_case` value by using `id.quote_style.is_none();` 
   
   change :
   
   `Ok(Expr::Column(Column { relation: None, name: normalize_ident, }))` => 
`Ok(Expr::Column(field.qualified_column()))`
   
   fixed all compiler errors, I found it not working very well.
   
   > 1. a and A return "A" column
   > 2. b and B fail as ambiguous
   > 3. "B" and "b" work, returning upper and lower case columns respectively
   > 4. The schema always preserves the original case of identifier
   
   1 3 4 done,  but 2 failed.
   because function  `Column::normalize_with_schemas_and_ambiguity_check` does 
not know  `using_columns`'s names are `ignore_case` or not. I set default is 
`false`.
   
   One solution is `Column` adding a member named `ignore_case`.  I think it's 
a ugly way. Do you have some suggesstion? @sergiimk 
   


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