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

   ## Problem
   
   `datafusion.sql_parser.enable_ident_normalization = true` currently folds 
unquoted SQL identifiers to lowercase. Setting it to `false` preserves the 
input spelling. Neither mode can express the SQL-standard/Snowflake behavior 
where unquoted `foo`, `Foo`, and `FOO` all resolve to `FOO`, while quoted 
`"foo"` remains a distinct, case-sensitive name. See [Snowflake identifier 
rules](https://docs.snowflake.com/en/sql-reference/identifiers-syntax).
   
   This matters for case-sensitive catalog providers that expose both `FOO` and 
`foo`. An application built on DataFusion currently cannot resolve both 
consistently without rewriting SQL/AST identifiers outside the planner. We hit 
this in [Rustice #857](https://github.com/Embucket/rustice/issues/857); a 
focused Snowflake probe confirmed the two schemas can coexist. The previous 
#5626 addressed incomplete handling of the existing boolean flag, not uppercase 
folding.
   
   ## Requested behavior
   
   Add an opt-in uppercase-folding policy for unquoted identifiers while 
preserving the current lowercase default and quoted-name behavior. In uppercase 
mode:
   
   - `foo`, `Foo`, and `FOO` resolve to the same `FOO` catalog key.
   - `"foo"` resolves to a separate exact-case `foo` key.
   - DDL names, relation discovery, CTEs, and subsequent SELECTs use the same 
policy; no CREATE-only special case.
   - Existing lower/preserve modes and their performance remain unchanged.
   
   Possible implementation: a normalization policy rather than another SQL 
rewrite, applied consistently in `IdentNormalizer`, table-reference resolution, 
and DDL name construction. Today `sql/src/utils.rs::normalize_ident`, 
`sql/src/planner.rs::IdentNormalizer`, `sql/src/resolve.rs`, and 
`sql/src/statement.rs::object_name_to_string` are relevant paths. I can work on 
a focused PR after maintainers confirm the preferred config/API shape.


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