Dmitry Lychagin created ASTERIXDB-2750:
------------------------------------------

             Summary: Incorrect result with simple unnest (",") followed by JOIN
                 Key: ASTERIXDB-2750
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2750
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: COMP - Compiler
    Affects Versions: 0.9.4.1
            Reporter: Dmitry Lychagin
            Assignee: Dmitry Lychagin
             Fix For: 0.9.5


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)
{noformat}
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(*)
{noformat}
Correct: returns 24 as expected.

Q2: ("," then ",")
{noformat}
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(*)
{noformat}
Correct: returns 24 as expected.

Q3: ("," then JOIN ON TRUE)
{noformat}
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(*)
{noformat}
INCORRECT: returns 48



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to