Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-16580

Calcite. Merge returns unexpected results.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • None
    • None
    • sql

    Description

          @Test
          public void testMerge0() {
              sql("CREATE TABLE test1 (k1 int, k2 int, a int, b varchar, c varchar, CONSTRAINT PK PRIMARY KEY (k1, k2))");
              sql("INSERT INTO test1 VALUES (111, 111, 0, 'a', '0')");
              sql("INSERT INTO test1 VALUES (222, 222, 1, 'b', '1')");
      
              sql("CREATE TABLE test2 (k1 int, k2 int, a int, b varchar, c varchar, CONSTRAINT PK PRIMARY KEY (k1, k2))");
              sql("INSERT INTO test2 VALUES (333, 333, 0, '100', '')");
              sql("INSERT INTO test2 VALUES (444, 444, 2, '200', '')");
      
              String sql = "MERGE INTO test2 dst USING test1 src ON (dst.a = src.a) " +
                  "WHEN MATCHED THEN UPDATE SET b = src.b " +
                  "WHEN NOT MATCHED THEN INSERT (k1, k2, a, b) VALUES (src.k2, src.k2, src.a, src.b)";
      
              assertQuery(sql).matches(QueryChecker.containsSubPlan("IgniteTableSpool")).check();
      
              assertQuery("SELECT * FROM test2 ORDER BY k1")
                  .returns(222, 222, 1, "b", "1")
                  .returns(333, 333, 0, "a", "")
                  .returns(444, 444, 2, "200", "")
                  .check();
          }
      

      java.lang.AssertionError: Collections sizes are not equal:
      Expected: [[222, 222, 1, b, 1], [333, 333, 0, a, ], [444, 444, 2, 200, ]]
      Actual: [[333, 333, 0, 100, ], [444, 444, 2, 200, ]]

      Attachments

        Issue Links

          Activity

            People

              alex_pl Aleksey Plekhanov
              zstan Evgeny Stanilovsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: