Deneche A. Hakim created DRILL-4289: ---------------------------------------
Summary: window functions give different results if star is used in inner query Key: DRILL-4289 URL: https://issues.apache.org/jira/browse/DRILL-4289 Project: Apache Drill Issue Type: Bug Components: Query Planning & Optimization Affects Versions: 1.5.0 Reporter: Deneche A. Hakim The following queries give different results, although they are similar: {noformat} SELECT position_id, COUNT(*) OVER w AS `count` FROM (SELECT position_id FROM `/b1p2tbl` ORDER BY employee_id, sub) WINDOW w AS (PARTITION BY position_id); +--------------+--------+ | position_id | count | +--------------+--------+ | 1 | 10 | | 1 | 10 | | 1 | 10 | | 1 | 10 | | 1 | 10 | | 1 | 10 | | 1 | 10 | | 1 | 10 | | 1 | 10 | | 1 | 10 | | 2 | 10 | | 2 | 10 | | 2 | 10 | | 2 | 10 | | 2 | 10 | | 2 | 10 | | 2 | 10 | | 2 | 10 | | 2 | 10 | | 2 | 10 | +--------------+--------+ {noformat} {noformat} SELECT position_id, COUNT(*) OVER w AS `count` FROM (SELECT * FROM dfs.data.`b1p2tbl` ORDER BY employee_id, sub) WINDOW w AS (PARTITION BY position_id); +--------------+--------+ | position_id | count | +--------------+--------+ | 1 | 20 | | 1 | 20 | | 1 | 20 | | 1 | 20 | | 1 | 20 | | 1 | 20 | | 1 | 20 | | 1 | 20 | | 1 | 20 | | 1 | 20 | | 2 | 20 | | 2 | 20 | | 2 | 20 | | 2 | 20 | | 2 | 20 | | 2 | 20 | | 2 | 20 | | 2 | 20 | | 2 | 20 | | 2 | 20 | +--------------+--------+ {noformat} the results of the second query are incorrect. -- This message was sent by Atlassian JIRA (v6.3.4#6332)