[
https://issues.apache.org/jira/browse/PHOENIX-915?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Samarth Jain reassigned PHOENIX-915:
------------------------------------
Assignee: Samarth Jain
Looks like a bug. Will send a pull request with the fix shortly. Thanks for
reporting this!
> Numeric functions ROUND, CEIL, FLOOR return incorrect results for DOUBLE
> ------------------------------------------------------------------------
>
> Key: PHOENIX-915
> URL: https://issues.apache.org/jira/browse/PHOENIX-915
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 3.0.0, 4.0.0
> Reporter: alex kamil
> Assignee: Samarth Jain
> Fix For: 3.0.0
>
>
> numeric functions ROUND, CEIL, FLOOR return incorrect results for DOUBLE ,
> FLOAT, UNSIGNED_DOUBLE , UNSIGNED_FLOAT data types
> (these functions work correctly only for DECIMAL)
> >CREATE TABLE myproducts (id BIGINT NOT NULL PRIMARY KEY, price DOUBLE);
> > UPSERT INTO myproducts (id,price) values (1,22.33);
> >SELECT id, price, ROUND(price) as roundedPrice from myproducts;
> +------------+------------+--------------+
> | ID | PRICE | ROUNDEDPRICE |
> +------------+------------+--------------+
> | 1 | 22.33 | 1.0 |
> (ROUND returns 1.0 instead of 22)
> SELECT id, price, ROUND(price,1) as roundedPrice from myproducts;
> +------------+------------+--------------+
> | ID | PRICE | ROUNDEDPRICE |
> +------------+------------+--------------+
> | 1 | 22.33 | 0.5 |
> (ROUND returns 0.5 instead of 22.3)
> >SELECT id, price, CEIL(price) as roundedPrice from myproducts;
> +------------+------------+--------------+
> | ID | PRICE | ROUNDEDPRICE |
> +------------+------------+--------------+
> | 1 | 22.33 | 1.0 |
> (CEIL returns 1.0 instead of 23)
> >SELECT id, price, FLOOR(price) as roundedPrice from myproducts;
> +------------+------------+--------------+
> | ID | PRICE | ROUNDEDPRICE |
> +------------+------------+--------------+
> | 1 | 22.33 | 0.0 |
> (FLOOR returns 0.0 instead of 22)
> etc.
--
This message was sent by Atlassian JIRA
(v6.2#6252)