ACking-you opened a new issue, #8479:
URL: https://github.com/apache/arrow-datafusion/issues/8479

   ### Describe the bug
   
   As soon as an expression appears in the projection it causes a schema error, 
which was introduced in version 33.0.0, but before that everything worked fine.
   ```
   Optimizer rule 'single_distinct_aggregation_to_group_by' failed
   caused by
   Schema error: No field named "date_trunc(Utf8(""day""),t.time)". Valid 
fields are group_alias_0, "COUNT(DISTINCT t.val)".
   ```
   
   ### To Reproduce
   
   This can be reproduced by running the following sql under version 33.0.0:
   ```sql
   SELECT
     date_trunc('day', time)  ntime,
     count(distinct val) cnt
   FROM (
     VALUES
       (TIMESTAMP '2021-06-10 17:05:00Z', 0.5),
       (TIMESTAMP '2021-06-10 17:19:10Z', 0.3)
     ) as t (time, val) group by ntime order by ntime;
   ```
   
   ### Expected behavior
   
   correct output
   
   ### Additional context
   
   I tried using the latest main branch code and found that the issue seems to 
be resolved. I'd like to see if any PRs have already solved the problem.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to