Hi Benoit,

There are various places in the code where RexFieldAccess is meant to work
only for the special case of correlated subqueries.
The exception that you got is among those places and it corresponds to a
bug that should be solved.

>From a quick look on JIRA (https://issues.apache.org/jira/browse) the issue
does not seem to be reported. Can you double-check and if needed create a
new issue?

Best,
Stamatis

2018-07-17 14:46 GMT+02:00 Benoit H <[email protected]>:

> Hello,
>
> I am trying to use Calcite to parse and transform Hive SQL queries, however
> I can't seem to be able to convert the physical plan back to SQL using
> *RelToSqlConverter* when the table has a nested struct, I get the following
> exception:
>
> *Caused by: java.lang.ClassCastException:
> org.apache.calcite.rex.RexInputRef cannot be cast to
> org.apache.calcite.rex.RexCorrelVariable*
> * at
> org.apache.calcite.rel.rel2sql.SqlImplementor$
> Context.toSql(SqlImplementor.java:446)*
> * at
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.
> visit(RelToSqlConverter.java:182)*
> * ... 38 more*
>
> I have been able to isolate the issue in a test case that is accessible at
> https://github.com/BenoitHanotte/calcite/commit/
> fd879310efab2858e33e06a9d666c106763e36db
> In this example, the table is a simple table with the following schema *{a:
> {b: INTEGER} }* . A simple *SELECT ** queryfails with the above exception.
>
> I am missing a step in my processing or doing something that is not
> expected?
>
> Thanks a lot!
>
> Benoit
>

Reply via email to