[
https://issues.apache.org/jira/browse/CALCITE-6933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17939950#comment-17939950
]
Ulrich Kramer commented on CALCITE-6933:
----------------------------------------
To my surprise, the following test is calling {{SnapshotLookup::getIgnoreCase}}
to resolve a the table name "emp"
{code:java}
@Test void testCustomJdbc() {
CalciteAssert.model(JdbcTest.FOODMART_SCOTT_CUSTOM_MODEL)
.query("select * from SCOTT.\"emp\"\n")
.enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.HSQLDB)
.planHasSql("SELECT *\nFROM \"SCOTT\".\"EMP\"")
.returnsCount(14);
}
{code}
{noformat}
getIgnoreCase:46, SnapshotLookup (org.apache.calcite.schema.lookup)
getIgnoreCase:52, ConcatLookup (org.apache.calcite.schema.lookup)
get:80, Lookup (org.apache.calcite.schema.lookup)
getTable:283, CalciteSchema (org.apache.calcite.jdbc)
resolve_:144, EmptyScope (org.apache.calcite.sql.validate)
resolveTable:101, EmptyScope (org.apache.calcite.sql.validate)
resolveTable:232, DelegatingScope (org.apache.calcite.sql.validate)
resolveImpl:148, IdentifierNamespace (org.apache.calcite.sql.validate)
validateImpl:188, IdentifierNamespace (org.apache.calcite.sql.validate)
validate:96, AbstractNamespace (org.apache.calcite.sql.validate)
validateNamespace:1208, SqlValidatorImpl (org.apache.calcite.sql.validate)
validateQuery:1179, SqlValidatorImpl (org.apache.calcite.sql.validate)
validateFrom:3628, SqlValidatorImpl (org.apache.calcite.sql.validate)
validateFrom:3607, SqlValidatorImpl (org.apache.calcite.sql.validate)
validateSelect:4121, SqlValidatorImpl (org.apache.calcite.sql.validate)
validateImpl:62, SelectNamespace (org.apache.calcite.sql.validate)
validate:96, AbstractNamespace (org.apache.calcite.sql.validate)
validateNamespace:1208, SqlValidatorImpl (org.apache.calcite.sql.validate)
validateQuery:1179, SqlValidatorImpl (org.apache.calcite.sql.validate)
validate:282, SqlSelect (org.apache.calcite.sql)
validateScopedExpression:1145, SqlValidatorImpl
(org.apache.calcite.sql.validate)
validate:851, SqlValidatorImpl (org.apache.calcite.sql.validate)
convertQuery:625, SqlToRelConverter (org.apache.calcite.sql2rel)
prepareSql:258, Prepare (org.apache.calcite.prepare)
prepareSql:221, Prepare (org.apache.calcite.prepare)
prepare2_:673, CalcitePrepareImpl (org.apache.calcite.prepare)
prepare_:524, CalcitePrepareImpl (org.apache.calcite.prepare)
prepareSql:492, CalcitePrepareImpl (org.apache.calcite.prepare)
parseQuery:246, CalciteConnectionImpl (org.apache.calcite.jdbc)
prepareAndExecute:654, CalciteMetaImpl (org.apache.calcite.jdbc)
prepareAndExecuteInternal:677, AvaticaConnection (org.apache.calcite.avatica)
executeInternal:157, AvaticaStatement (org.apache.calcite.avatica)
executeQuery:228, AvaticaStatement (org.apache.calcite.avatica)
assertQuery:571, CalciteAssert (org.apache.calcite.test)
lambda$ensurePlan$9:1781, CalciteAssert$AssertQuery (org.apache.calcite.test)
accept:-1, CalciteAssert$AssertQuery$$Lambda/0x000000e001179270
(org.apache.calcite.test)
withConnection:1481, CalciteAssert$AssertQuery (org.apache.calcite.test)
ensurePlan:1780, CalciteAssert$AssertQuery (org.apache.calcite.test)
planContains:1753, CalciteAssert$AssertQuery (org.apache.calcite.test)
planHasSql:1771, CalciteAssert$AssertQuery (org.apache.calcite.test)
testCustomJdbc:156, JdbcAdapterTest (org.apache.calcite.test)
{noformat}
> Lookup of quoted identifier produces an incorrect result
> --------------------------------------------------------
>
> Key: CALCITE-6933
> URL: https://issues.apache.org/jira/browse/CALCITE-6933
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.39.0
> Reporter: Mihai Budiu
> Priority: Minor
>
> Consider the following example:
> {code:sql}
> CREATE TABLE "T" (COL1 INT NOT NULL);
> CREATE TABLE "t" (COL1 INT NOT NULL, COL2 DOUBLE NOT NULL);
> CREATE VIEW V AS SELECT COL1, rlike(COL2, 'asf') FROM "t";
> {code}
> There are two tables with the same name, but different casing. I believe that
> the lookup in the schema should use case-sensitive lookup when the looked-up
> identifier is quoted. (This example used to work, but fails after we have
> merged the fix to https://issues.apache.org/jira/browse/CALCITE-6728).
> I am assuming this is a bug, but perhaps my understanding is wrong.
> Today the IdentifierNamespace.resolveImpl uses a nameMatcher whose case
> sensitivity is fixed by the configuration, but I think it should take into
> consideration the quoting as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)