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

RelToSqlConverter assertion error with projection over sort

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.11.0
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None

      Description

      RelToSqlConverter has a problem creating aliases when wrapping a query, e.g.:

          relBuilder.scan("product");
          relBuilder.sort(1)
                    .project(relBuilder.field(0), relBuilder.field(2), relBuilder.field(4))
      

      This throws

      Caused by: java.lang.AssertionError: field ordinal 1 out of range {t=RecordType(INTEGER product_class_id, VARCHAR(60) brand_name, BIGINT SKU)}
      	at org.apache.calcite.rel.rel2sql.SqlImplementor$AliasContext.field(SqlImplementor.java:845)
      	at org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:512)
      	at org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:151)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jbalint@gmail.com Jess Balint
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: