You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug #5132 introduced a regression regarding ordering by alias columns that were also marked as DISTINCT
To Reproduce
DataFusion CLI v18.0.0
❯ create or replace table t asselect column1 as value, column2 astimefrom (select*from (values
(1, timestamp'2022-01-01 00:00:30'),
(2, timestamp'2022-01-01 01:00:10'),
(3, timestamp'2022-01-02 00:00:20')
) as sq) as sq
;
0 rows inset. Query took 0.007 seconds.
❯ SELECT DISTINCTtimeas"first_seen"FROM t ORDER BYtime;
Plan("For SELECT DISTINCT, ORDER BY expressions time must appear in select list")
Expected behavior
The query should succeed and produce the same answer as posgres
postgres=# postgres=# create table t as select column1 as value, column2 as time from (select * from (values
(1, timestamp'2022-01-01 00:00:30'),
(2, timestamp'2022-01-01 01:00:10'),
(3, timestamp'2022-01-02 00:00:20')
) as sq) as sq
;
SELECT3
postgres=# SELECT DISTINCT time as "first_seen" FROM t ORDER BY time;
first_seen
---------------------2022-01-0100:00:302022-01-0101:00:102022-01-0200:00:20
(3 rows)
Additional context
We found this internally in IOx.
The text was updated successfully, but these errors were encountered:
Describe the bug
#5132 introduced a regression regarding ordering by alias columns that were also marked as DISTINCT
To Reproduce
Expected behavior
The query should succeed and produce the same answer as posgres
Additional context
We found this internally in IOx.
The text was updated successfully, but these errors were encountered: