jayzhan211 commented on PR #26211:
URL: https://github.com/apache/datafusion/pull/26211#issuecomment-6383835569

   Besides the reported type, the mismatch makes queries fail:
   
   ```sql
   create table s (g varchar, k varchar, x decimal(18,6)) as values ('a', 'u1', 
1.5), ('a', 'u2', 2.5), ('b', 'u1', 3.0);
   select g, nullif(sum(x), 0) as s, count(*) as n, count(distinct k) as d from 
s group by g order by g;
   ```
   
   On `main` this fails with `Arrow error: Invalid argument error: Invalid 
comparison operation: Decimal128(38, 6) == Decimal128(28, 6)`. With this PR it 
returns `a, 4.000000, 2, 2` and `b, 3.000000, 1, 1`, as DuckDB does.
   
   This query works on 55.0.0. It fails since #24859, which lets the rule 
rewrite an aggregate with a `count(*)` next to the distinct aggregate. Query 
q158 of the dbolympics benchmark (#26661) fails the same way and runs with this 
PR.
   
   The PR also fixes #17699: its query fails on `main` with the same 
`Decimal128(35, 2)` vs `Decimal128(25, 2)` mismatch and returns `10.00` with 
this PR.
   
   Could you add the query above to `aggregate.slt`, so the failing case is 
covered end to end, and add `Closes #17699` to the description?
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to