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

Query result is wrong when table is implemented with FilterableTable and the sql has multiple where conditions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.16.0
    • 1.20.0
    • core
    • version 1.16.0

    Description

      you can reappearance this bug in test case `org.apache.calcite.test.CsvTest#testFilterableSelect`.

       

      Try execute this sql:

      sql("filterable-model", "select name from EMPS where name not like '%F%' and name like '%e%'").ok();
      

      The code generate in method `org.apache.calcite.interpreter.JaninoRexCompiler#compile`

      {
      final Object[] current = context.values;
      final String inp1_ = current[1] == null ? (String) null : current[1].toString();
      outputValues[0] = (inp1_ == null || org.apache.calcite.runtime.SqlFunctions.like(inp1_, "%e%")) && !(inp1_ != null && org.apache.calcite.runtime.SqlFunctions.like(inp1_, "%F%")) ? (inp1_ == null || inp1_ != null ? (Boolean) null : Boolean.TRUE) : Boolean.FALSE;
      }
      
      

      This bug can be reappearanced in 1.17.0-SNAPSHOT、1.16.0、1.13.0

       

      Attachments

        Issue Links

          Activity

            People

              Chunwei Lei Chunwei Lei
              cnzhujie cnzhujie
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m