1

The Calcite SQL language reference (https://calcite.apache.org/docs/reference.html) says the following:

In Calcite, matching identifiers to the name of the referenced object is case-sensitive. But remember that unquoted identifiers are implicitly converted to upper case before matching, and if the object it refers to was created using an unquoted identifier for its name, then its name will have been converted to upper case also.

Is there some configuration to make both object creation and the query case insensitive? For example, if I have a table named countries is it possible to configure the query validator to accept identifiers either COUNTRIES or countries in the SQL query?

I tried to configure the SqlParser to case sensitive false in the following:

Frameworks.newConfigBuilder().parserConfig(SqlParser.configBuilder().setCaseSensitive(false).build()).build()

and then passed this framework config to the PlannerImpl used in SqlToRelConverter, but the SQL validator still fails when I do not enclose the identifier in quotes to enforce case.

tuzhucheng
  • 158
  • 3
  • 9

1 Answers1

3

I believe the case sensitivity on the parser is irrelevant here. You'll want to set the case sensitivity on the catalog reader that you're using. For example, if you're using CalciteCatalogReader, you'll want to set CalciteConnectionProperty.CASE_SENSITIVE to true on the CalciteConnectionConfig object you're passing in during configuration.

Michael Mior
  • 28,107
  • 9
  • 89
  • 113