Dmitry Lychagin created ASTERIXDB-2307:
------------------------------------------

             Summary: Incorrect result of quantified expression when condition 
returns NULL/MISSING
                 Key: ASTERIXDB-2307
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2307
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: COMP - Compiler
            Reporter: Dmitry Lychagin
            Assignee: Dmitry Lychagin


Input data:

{ "custid": "C1",
 "name": "James",
 "rating": 750
},
{ "custid": "C2",
 "name": "Mary",
 "rating": 690
},
{ "custid": "C3",
 "name": "John"
},
{ "custid": "C4",
 "name": "Patricia",
 "rating": null
},
{ "custid": "C5",
 "name": "Robert",
 "rating": 750
},
{ "custid": "C6",
 "name": "Jennifer",
 "rating": 640
}

 

Query:

SELECT VALUE COUNT(c1.name)
FROM customers AS c1
WHERE EVERY r IN
 (SELECT VALUE c2.rating FROM customers AS c2)
SATISFIES c1.rating >= r

Result: 4, which is incorrect because for some customers the 'rating' field is 
either missing or null, therefore the quantified expression can never succeed. 
The correct result should be 0

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to