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

Incorrect query result with fixed-length string

    XMLWordPrintableJSON

    Details

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

      Description

      Query may return wrong result when fixed-length strings (CHAR(N)) are used in OR/IN clause

      @Test void test() {
          // Passed.
          CalciteAssert.that()
              .query("select * from (values (1, 'a'), (2, 'abc')) where EXPR$1 = 'a'")
              .returns("EXPR$0=1; EXPR$1=a  \n");
      
          // Failed. Only "EXPR$0=2; EXPR$1=abc\n" is returned
          CalciteAssert.that()
              .query("select * from (values (1, 'a'), (2, 'abc')) where EXPR$1 = 'a' or EXPR$1 = 'abc'")
              .returns("EXPR$0=1; EXPR$1=a  \n"
                  + "EXPR$0=2; EXPR$1=abc\n");
        }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nobigo duan xiong
                Reporter:
                rkondakov Roman Kondakov
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: