Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-2750

Incorrect result with simple unnest (",") followed by JOIN

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.9.4.1
    • 0.9.5
    • COMP - Compiler
    • None

    Description

      Simple unnest (",") should be equivalent to using UNNEST keyword. However a combination of simple unnest followed by JOIN produces incorrect result.

      Consider these 3 queries which should return the same result (24 = 2*3*4):
      Q1: (UNNEST then JOIN ON TRUE)

      with 
        t1 as [ { "x": 1, "y": [10, 11, 12] }, { "x": 2, "y": [20, 21, 22] } ], 
        t2 as [ 100, 101, 102, 103 ]
      from t1 as t1 unnest t1.y as y join t2 as t2 on true
      select value count(*)
      

      Correct: returns 24 as expected.

      Q2: ("," then ",")

      with 
        t1 as [ { "x": 1, "y": [10, 11, 12] }, { "x": 2, "y": [20, 21, 22] } ], 
        t2 as [ 100, 101, 102, 103 ]
      from t1 as t1, t1.y as y, t2 as t2
      select value count(*)
      

      Correct: returns 24 as expected.

      Q3: ("," then JOIN ON TRUE)

      with 
        t1 as [ { "x": 1, "y": [10, 11, 12] }, { "x": 2, "y": [20, 21, 22] } ], 
        t2 as [ 100, 101, 102, 103 ]
      from t1 as t1, t1.y as y join t2 as t2 on true
      select value count(*)
      

      INCORRECT: returns 48

      Attachments

        Issue Links

          Activity

            People

              dlychagin-cb Dmitry Lychagin
              dlychagin-cb Dmitry Lychagin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: