[
https://issues.apache.org/jira/browse/CALCITE-5626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17722310#comment-17722310
]
Runkang He edited comment on CALCITE-5626 at 5/13/23 12:56 AM:
---------------------------------------------------------------
[~julianhyde] In my current opinion, the correlation variables can be find in
parent scope, so it has no effect to this issue. I write a test case below,
which passes the validation phase.
{code:sql}
select
sales.emp.empno
from
sales.emp as emp
where
sales.emp.deptno in (
select
sales.dept.deptno
from
sales.dept
where
sales.dept.deptno = *emp.empno* -- after fix of namespace
initialization
){code}
was (Author: JIRAUSER280488):
[~julianhyde] In my current opinion, the correlation variables can be find in
parent scope, so it has no effect to this issue. I write a test case below,
which passes the validation phase.
{code:sql}
select
sales.emp.empno
from
sales.emp as emp
where
sales.emp.deptno in (
select
sales.dept.deptno
from
sales.dept
where
sales.dept.deptno = *emp.empno*
){code}
> Query with EXISTS function gives Table ... not found error
> ----------------------------------------------------------
>
> 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
> Assignee: Runkang He
> Priority: Blocker
>
> 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)