Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Cannot Reproduce
-
0.5.0
-
None
Description
The following COUNT query with a UNION subquery returns two rows, one count for each side of the union. Run by itself, the subquery returns 70000 rows.
0: jdbc:drill:> select count from (select trans_id from `clicks/clicks.campaign.json` union all select trans_id from `clicks/clicks.json`);
------------
EXPR$0 |
------------
40000 |
30000 |
------------
2 rows selected (5.896 seconds)
0: jdbc:drill:> explain plan for select count from (select trans_id from `clicks/clicks.campaign.json` union all select trans_id from `clicks/clicks.json`);
----------------------+
text | json |
----------------------+
00-00 Screen 00-01 StreamAgg(group=[{}], EXPR$0=[COUNT()]) 00-02 Project($f0=[0]) 00-03 UnionAll(all=[true]) 00-05 Project(trans_id=[$1]) 00-07 Scan(groupscan=[EasyGroupScan [selectionRoot=/mapr/demorig/data/nested/clicks/clicks.campaign.json, columns = null]]) 00-04 Project(trans_id=[$1]) 00-06 Scan(groupscan=[EasyGroupScan [selectionRoot=/mapr/demorig/data/nested/clicks/clicks.json, columns = null]]) |
{ "head" : Unknown macro: { "version" }
, Unknown macro: { "root" }
, Unknown macro: { "psv" }
}, , Unknown macro: { "pop" }
, { Unknown macro: { "root" }
, Unknown macro: { "psv" }
}, , Unknown macro: { "pop" }
, { "pop" : "union-all", "@id" : 3, "children" : [ 5, 4 ], "initialAllocation" : 1000000, "maxAllocation" : 10000000000, "cost" : 12973.0 }, Unknown macro: { "pop" }
, Unknown macro: { "pop" }
, { "pop" : "screen", "@id" : 0, "child" : 1, "initialAllocation" : 1000000, "maxAllocation" : 10000000000, "cost" : 1297.3 } ] |
----------------------+
1 row selected (0.142 seconds)