lidavidm edited a comment on pull request #11754: URL: https://github.com/apache/arrow/pull/11754#issuecomment-975944295
Just for reference it seems DuckDB actually outputs a double: ``` D create table df (dec decimal(3, 2), flt float); D insert into df (dec, flt) values (0.01, 0.01); D insert into df (dec, flt) values (0.02, 0.02); D insert into df (dec, flt) values (0.02, 0.02); D insert into df (dec, flt) values (0.02, 0.02); D select typeof(dec), typeof(flt) from df; ┌──────────────┬─────────────┐ │ typeof(dec) │ typeof(flt) │ ├──────────────┼─────────────┤ │ DECIMAL(3,2) │ FLOAT │ │ DECIMAL(3,2) │ FLOAT │ │ DECIMAL(3,2) │ FLOAT │ │ DECIMAL(3,2) │ FLOAT │ └──────────────┴─────────────┘ D select avg(dec), avg(flt), typeof(avg(dec)), typeof(avg(flt)) from df; ┌──────────┬─────────────────────┬──────────────────┬──────────────────┐ │ avg(dec) │ avg(flt) │ typeof(avg(dec)) │ typeof(avg(flt)) │ ├──────────┼─────────────────────┼──────────────────┼──────────────────┤ │ 0.0175 │ 0.01749999960884452 │ DOUBLE │ DOUBLE │ └──────────┴─────────────────────┴──────────────────┴──────────────────┘ ``` We can cast back to Decimal, but how should we round/truncate the result? -- 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]
