See https://issues.apache.org/jira/browse/CALCITE-1945 
<https://issues.apache.org/jira/browse/CALCITE-1945>.

> On Oct 29, 2017, at 3:31 PM, Marc Prud'hommeaux <[email protected]> wrote:
> 
> 
> When I run the following against a Calcite connection containing the 
> PostgreSQL "dvdstore" sample database:
> 
>  select avg(products.price) from dvdstore.products group by products.category
> 
> The following SQL is executed on the server:
> 
>  SELECT CAST(SUM("price") / COUNT(*) AS DECIMAL(19, 0)) FROM "products" GROUP 
> BY “category"
> 
> Is there some way I can prevent Calcite from rounding it (price is a decimal 
> type)? Is there some reason it isn’t just sending the aggregate as an AVG?
> 
>       -Marc
> 

Reply via email to