Closed
Description
When #44745 has been introduced as a way of aggregations (SUM, MAX, AVG etc) dealing with a lack of documents matching a query and, implicitly, dealing with NULLs the case of COUNT(DISTINCT) (that uses a cardinality
aggregation behind the scene) has been approached as well.
But, this introduced the issue of returning a NULL
for COUNT(DISTINCT)
where there are no matching documents. For example SELECT COUNT(DISTINCT languages) FROM test_emp WHERE languages > 100
returns NULL
, whereas it should return 0
since there are no documents matching the condition languages > 100
.