Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4266

JDBC adapter throws UnsupportedOperationException if query contains range predicate on columns from sub-query

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      JDBC adapter throws UnsupportedOperationException if query contains range predicate on columns from sub-query. The query

      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
      

      contains a range (by virtue of the IN (0, 1)) and throws

      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)
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              julianhyde Julian Hyde
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: