Hi colleagues, I am trying to implement case insensitive resolution of column/table/schema names for our Apache Calcite integration in Hazelcast and got stuck. I hope that the community might help me.
Consider that we have a table source that contains the following Java class: class Employee { LocalDate birthDate } I would like to have an SQL engine that could resolve identifiers in accordance with ANSI SQL standard, which basically says that unquoted identifiers should be compared in a case-insensitive way, while quoted identifiers should be compared in a case-sensitive way. Let's focus on columns only for now: SELECT birthDate FROM employee // OK SELECT birthdate FROM employee // OK SELECT BIRTHDATE FROM employee // OK SELECT `birthDate` FROM employee // OK SELECT `birthdate` FROM employee // Fail SELECT `BIRTHDATE` FROM employee // Fail That is, my source is a collection of Java objects, and the natural name of the column is "birthDate". But I would like it to be accessible as "birthDate", birthDate, BIRTHDate, etc. My problem comes from the fact that casing configuration is applied during parsing and by the time the table is asked for a column, the information whether the user request was quoted or not is lost. Consider that I have a table RelDataType["birthDate"]. Now consider what happens with different combinations of casing configuration: 1) [unquoted=UNCHANGED, quoted=UNCHANGED]: "SELECT BIRTHDATE" doesn't work obviously 2) [unquoted=UPPER, quoted=UNCHANGED]: "SELECT BIRTHDATE" doesn't work again, because parser normalizes unqouted identifier to upper case, but RelDataType has a column "birthDate" 3) Same as p.2, but with manual normalization of RelDataType to RelDataType["BIRTHDATE"]: "SELECT BIRTHDATE" works now, but "SELECT `birthDate`" don't! Is there any built-in solution to the above problem? Regards, Vladimir.