Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
For the following query:
WITH c1 AS( SELECT f1, f2 FROM collection1 b), c2 AS( SELECT f1, ( SELECT COUNT(1) FILTER(WHERE b.f2>=a.f2 AND b.f2<=a.f2) AS counts FROM c1 b WHERE b.f1=a.f1 )[0] counts FROM c1 a) SELECT COUNT(*) counts FROM c2 a
The plan contains a redundant listify:
unnest $#3 <- scan-collection($$135) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] -- UNNEST |LOCAL| group by ([]) decor ([$$165; $$170; $$171; $$b]) { aggregate [$$135] <- [listify({"b": $$129})] [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] -- AGGREGATE |LOCAL| select (not(is-missing($$175))) [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] -- STREAM_SELECT |LOCAL| nested tuple source [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] -- NESTED_TUPLE_SOURCE |LOCAL| } [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] -- MICRO_PRE_CLUSTERED_GROUP_BY[] |LOCAL| nested tuple source [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] -- NESTED_TUPLE_SOURCE |LOCAL| } [cardinality: 0.0, op-cost: 0.0, total-cost: 0.0] -- PRE_CLUSTERED_GROUP_BY[$$165] |PARTITIONED|