[
https://issues.apache.org/jira/browse/CALCITE-5626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17912541#comment-17912541
]
suibianwanwan commented on CALCITE-5626:
----------------------------------------
Hi, [~julianhyde] [~Runking]. I agree with [~Runking] .The problem is that
namespace.getTable is called without first calling validate. An easier fix is
to find the place where getTable is called without validate. Call
validateNamespace ahead of time. The validateNamespace also ensures that the
validate method is not called repeatedly.
If you have time, could you take a look at the PR? [PR-4143]
> Sub-query with fully qualified table name throws table not found exception in
> validation phase
> ----------------------------------------------------------------------------------------------
>
> Key: CALCITE-5626
> URL: https://issues.apache.org/jira/browse/CALCITE-5626
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.34.0
> Reporter: Roman Churganov
> Priority: Blocker
> Labels: pull-request-available
>
> If query has a sub-query in EXIXST function and full column names used in
> sub-query , like
> {code:sql}
> SELECT sch1.foo.c11 FROM sch1.foo
> WHERE exists ( SELECT sch2.tab.c41 FROM sch2.tab
> where sch2.tab.c41 = 1 )
> {code}
> it fails with exception:
> {noformat}
> .....
> at
> org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:787)
> at org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:226)
> ... 73 more
> Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Table
> 'SCH2.TAB' not found
> at
> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
> at
> java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at
> java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
> at
> java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
> at
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:505)
> at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:599)
> ... 98 more
> {noformat}
> also need to have a different table in the outer query to reproduce
--
This message was sent by Atlassian Jira
(v8.20.10#820010)