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

Incorrect query result with fixed-length string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.26.0
    • None
    • core
    • 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

              nobigo xiong duan
              rkondakov Roman Kondakov
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: