[ 
https://issues.apache.org/jira/browse/TAJO-1789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14738373#comment-14738373
 ] 

Jongyoung Park edited comment on TAJO-1789 at 9/10/15 8:14 AM:
---------------------------------------------------------------

This problem is related in floating point precision.

As you know, float/double type precision is not precise in C/C++ or Java.
The closer to 0, the lesser accurate it is.

For example, next code prints *false* as I tested.

{code:java}
double dval = 0.06;
System.out.println(dval == 0.05+0.01);
{code}

RDBMS is not free from this kind of problem, either.
So it should be defined as Number/Decimal type.


was (Author: eminency):
This problem is related in floating point precision.

As you know, float/double type precision is not precise in C/C++ or Java.
The closer to 0, the lesser accurate it is.

For example, next code prints *false* as I tested.

{code:java}
double dval = 0.06;
System.out.println(dval == 0.05+0.01);
{code}

RDBMS is also free from this kind of problem, either.
So it should be defined as Number/Decimal type.

> 'BETWEEN a AND b' clause has a bug
> ----------------------------------
>
>                 Key: TAJO-1789
>                 URL: https://issues.apache.org/jira/browse/TAJO-1789
>             Project: Tajo
>          Issue Type: Bug
>            Reporter: Dongkyu Hwangbo
>            Assignee: Jongyoung Park
>              Labels: sql
>
> This is TPC-H q6 in TPC-H Reference document.
> {code:SQL}
> select
> sum(l_extendedprice*l_discount) as revenue
> from
> lineitem
> where
> l_shipdate >= date '1994-01-01'
> and l_shipdate < date '1995-01-01'
> and l_discount between 0.06 - 0.01 and 0.06 + 0.01
> and l_quantity < 24;
> {code}
> look this line.
> {code:SQL}
> and l_discount between 0.06 - 0.01 and 0.06 + 0.01
> {code}
> this line make a wrong answer.
> Replaced line
> {code:SQL}
> and l_discount between 0.05 and 0.07
> {code}
> gives me right answer.
> Between Answers of 
> {code:SQL}
> and l_discount between 0.06 - 0.01 and 0.06 + 0.01
> {code}
> and
> {code:SQL}
> and l_discount between 0.06 - 0.01 and 0.06
> {code}
> are same. 
> I think "BetweenPredicate" has a bug.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to