Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.0.0
Description
The following query returns wrong results:
0: jdbc:drill:> select sum(1) over w sum1, sum(5) over w sum5 from cp.`employee.json` where position_id = 2 window w as (partition by position_id); +-------+-------+ | sum1 | sum5 | +-------+-------+ | 6 | 6 | | 6 | 6 | | 6 | 6 | | 6 | 6 | | 6 | 6 | | 6 | 6 | +-------+-------+
The second column should display 30 (5 x 6) instead of 6.
Here is the plan for the query:
00-00 Screen 00-01 Project(sum1=[$0], sum5=[$1]) 00-02 Project(sum1=[$0], sum5=[$1]) 00-03 Project($0=[$1], $1=[$2]) 00-04 Window(window#0=[window(partition {0} order by [] range between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING aggs [SUM($1), SUM($2)])]) 00-05 SelectionVectorRemover 00-06 Sort(sort0=[$0], dir0=[ASC]) 00-07 Filter(condition=[=($0, 2)]) 00-08 Scan(groupscan=[EasyGroupScan [selectionRoot=/employee.json, numFiles=1, columns=[`position_id`], files=[classpath:/employee.json]]])