Hi
You'd better do the subquery elimination.
org.apache.calcite.tools.Programs#subQuery
org.apache.calcite.tools.Programs.DecorrelateProgram


Regards!

Aron Tao


you Zhuang <[email protected]> 于2021年2月9日周二 上午8:31写道:

> String sql = "select id, name, (select id from test.users where id = b.id)
> as pid from test.depts b";
>
> sqlToRelConverter.convertQuery(validatedSqlNode, false, true)
>
> i can get the following
>
> [main:DEBUG] org.apache.calcite.sql2rel: Plan after converting SqlNode to
> RelNode
> LogicalProject(ID=[$0], NAME=[$1], PID=[$SCALAR_QUERY({
> LogicalProject(ID=[$0])
>   LogicalFilter(condition=[=($0, $cor0.id)])
>     LogicalTableScan(table=[[test, users]])
> })])
>   LogicalTableScan(table=[[test, depts]])
>
>
> but when i execute code:
>
> sqlNode = new RelToSqlConverter(SPARK).visitRoot(rel)
>
> it throws the exception: variable $cor0 is not found
>
> is it a bug issue?
>

Reply via email to