Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-1372

Query using PrepareStatement failed with multi OR clause

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: v1.2, v1.4.0
    • Fix Version/s: v1.3.0, v1.4.0
    • Component/s: None
    • Labels:
      None

      Description

      Query using prepare statement, with filter 'where lstg_format_name in (?, ?)', exception threw:

      Caused by: java.util.NoSuchElementException
              at java.util.HashMap$HashIterator.nextNode(HashMap.java:1431)
              at java.util.HashMap$KeyIterator.next(HashMap.java:1453)
              at org.apache.kylin.metadata.filter.CompareTupleFilter.addChild(CompareTupleFilter.java:84)
              at org.apache.kylin.query.relnode.OLAPFilterRel$TupleFilterVisitor.mergeToInClause(OLAPFilterRel.java:159)
              at org.apache.kylin.query.relnode.OLAPFilterRel$TupleFilterVisitor.visitCall(OLAPFilterRel.java:126)
              at org.apache.kylin.query.relnode.OLAPFilterRel$TupleFilterVisitor.visitCall(OLAPFilterRel.java:45)
              at org.apache.calcite.rex.RexCall.accept(RexCall.java:107)
              at org.apache.kylin.query.relnode.OLAPFilterRel$TupleFilterVisitor.visitCall(OLAPFilterRel.java:117)
              at org.apache.kylin.query.relnode.OLAPFilterRel$TupleFilterVisitor.visitCall(OLAPFilterRel.java:45)
              at org.apache.calcite.rex.RexCall.accept(RexCall.java:107)
              at org.apache.kylin.query.relnode.OLAPFilterRel.translateFilter(OLAPFilterRel.java:257)
              at org.apache.kylin.query.relnode.OLAPFilterRel.implementOLAP(OLAPFilterRel.java:241)
              at org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:81)
              at org.apache.kylin.query.relnode.OLAPProjectRel.implementOLAP(OLAPProjectRel.java:100)
              at org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:81)
              at org.apache.kylin.query.relnode.OLAPToEnumerableConverter.implement(OLAPToEnumerableConverter.java:67)
              at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:99)
              at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
              at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1050)
              at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:293)
              at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:188)
              at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:671)
              at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:572)
              at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:541)
              at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:173)
              at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:158)
              ... 84 more
      

      If using with filter 'where lstg_format_name in ('FP-GTC', ?)', query succeed, but the result only contained 'FP-GTC' row, the dynamic filter seems didn't work.

      The reason is, with multi OR clause, OLAPFilterRel.mergeToInClause was called to merge into one In clause, but the new CompareTupleFilter lost dynamic variables.

      I'll fix this issue later.

        Attachments

        1. KYLIN-1372-2.x-staging.patch
          6 kB
          Yerui Sun
        2. KYLIN-1372-1.x-staging.patch
          5 kB
          Yerui Sun

          Activity

            People

            • Assignee:
              sunyerui Yerui Sun
              Reporter:
              sunyerui Yerui Sun
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: