Hi Julian

Thanks for the response on this and suggesting use of QUOTED_CASING and 
UNQUOTED_CASING properties.

The values for these properties are either TO_LOWER, TO_UPPER or UNCHANGED. But 
I don't not find an option which records if the identifier was quoted/not. This 
information is being lost as part of the parsing is what I feel. I would like 
to use this information to quote only those identifiers in the final SQL post 
optimization. Please let me know if you have any questions on this and if you 
want me to elaborate more.

Thanks,
Sriharsha

From: Annepu, Sai Sriharsha [Engineering]
Sent: Monday, December 18, 2023 7:11 PM
To: [email protected]
Cc: Ormerod, Andrew [Engineering] <[email protected]>; De Belen, 
Pierre [Engineering] <[email protected]>; Harte, David 
[Engineering] <[email protected]>
Subject: Case-sensitive parser configuration for quoted identifiers

Hello Team,

We are attempting to use Calcite as a dialect specific SQL string generator / 
optimizer for SQL queries systematically generated by Legend data management 
platform (https://github.com/finos/legend).

In this context, I am trying to find if there exists a Calcite parser 
configuration which allows case sensitive matching only if the identifier is 
quoted, and also record that identifier as a quoted identifier to ensure it 
remains the same in the final SQL generated by the dialect. quotedCasing and 
unQuotedCasing configurations do help to some extent, but the identifier is 
stored without quoting information.

As an example, in the below SQL, I would like to do case in-sensitive matching 
(from schema) for people table and name column but case sensitive match for 
date column. Also, post parsing, validation and optimization, the final SQL 
should have quotes only for date column -

                SELECT p.name AS name, p."date" AS dt FROM people AS p

Does any such configuration exist? If it doesn't, can you please provide us 
feedback on feasibility of the request and some pointers on where we can get 
started if we want to contribute this feature.

Thanks,
Sriharsha

________________________________

Your Personal Data: We may collect and process information about you that may 
be subject to data protection laws. For more information about how we use and 
disclose your personal data, how we protect your information, our legal basis 
to use your information, your rights and who you can contact, please refer to: 
www.gs.com/privacy-notices<http://www.gs.com/privacy-notices>

Reply via email to