-
Couldn't load subscription status.
- Fork 1.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
After IOx upgraded DF recently, we hit a bug in count distinct with date_bin/date_part.
To Reproduce
After some investigation, here is the reproducer in Datafusion CLI:
create table t1(state string, city string, min_temp float, area int, time timestamp) as values
('MA', 'Boston', 70.4, 1, 50),
('MA', 'Bedford', 71.59, 2, 150);
select date_part('year', time) as bla, count(distinct state) as count from t1 group by bla;
-- Optimizer rule 'single_distinct_aggregation_to_group_by' failed caused by Schema error: No field named "date_part(Utf8(""year""),t1.time)". Valid fields are group_alias_0, "COUNT(DISTINCT t1.state)".
-- this query has the same issue
select date_bin(interval '1 year', time) as bla, count(distinct state) as count from t1 group by bla;Expected behavior
The queries should work
Additional context
After I backed out 15d8c9b locally, the queries work
waynexia and haohuaijin
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working