apache / druid

Apache Druid: a high performance real-time analytics database.
https://druid.apache.org/
Apache License 2.0
13.4k stars 3.68k forks source link

Windowed first_value/last_value ignores ordering #15240

Closed kgyrtkirk closed 2 weeks ago

kgyrtkirk commented 10 months ago

Description

For the query:

select g,last_value(val) over (partition by g order by val) from t;

is executed equivalently to

select g,last_value(val) over (partition by g) from t;

The result should take into account the rows up to the current val ; and not take the whole window

http://sqlfiddle.com/#!17/7baabc/5

dataset ```sql create table t (g integer,val integer); insert into t values (1,1); insert into t values (2,1); insert into t values (2,1); insert into t values (2,2); insert into t values (3,1); insert into t values (3,2); insert into t values (3,3); ```

affects: DrillWindowQueryTest#test_last_val_lastValFn_35 and some others

github-actions[bot] commented 1 month ago

This issue has been marked as stale due to 280 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@druid.apache.org list. Thank you for your contributions.

github-actions[bot] commented 2 weeks ago

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.