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

Select * on table with nested struct throws ClassCastException: RexInputRef cannot be cast to RexCorrelVariable

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.16.0, next
    • Fix Version/s: 1.18.0
    • Component/s: core
    • Labels:
      None

      Description

      Trying to convert the physical plan of a select * query on a table with a nested struct throws ClassCastException as RexInputRef cannot be cast to RexCorrelVariable:
       
      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
       
      You may find a test case to reproduce the issue at https://github.com/BenoitHanotte/calcite/commit/fd879310efab2858e33e06a9d666c106763e36db

       

      This is likely due to the cast to RexCorrelVariable not being done on the referenced expression of RexInputRef accessible through RexFieldAccess.getReferenceExpr()

        Attachments

          Activity

            People

            • Assignee:
              mmior Michael Mior
              Reporter:
              b.hanotte Benoit Hanotte
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: