Julian Hyde created CALCITE-4266:
------------------------------------

             Summary: JDBC adapter throws UnsupportedOperationException if 
query contains range predicate on columns from sub-query
                 Key: CALCITE-4266
                 URL: https://issues.apache.org/jira/browse/CALCITE-4266
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


JDBC adapter throws {{UnsupportedOperationException}} if query contains range 
predicate on columns from sub-query. The query
{code}
SELECT CASE WHEN v.g IN (0, 1) THEN 0 ELSE 1 END
FROM (SELECT * FROM "foodmart"."customer") AS c,
 (SELECT 0 AS g) AS v
GROUP BY v.g
{code}
contains a range (by virtue of the {{IN (0, 1)}}) and throws
{noformat}
java.lang.UnsupportedOperationException
        at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.implementor(SqlImplementor.java:1597)
        at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.lambda$toSql$0(SqlImplementor.java:862)
        at 
java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
{noformat}

The problem is that, in order to simplify a Sarg (see CALCITE-4173), the 
{{implementor()}} is being called in a context where it was not called before. 
The solution is to implement the {{SqlImplementor.Context.implementor()}} 
method in more sub-classes.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to