You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Chun Chang (JIRA)" <ji...@apache.org> on 2017/08/31 20:47:00 UTC
[jira] [Commented] (DRILL-4970) Wrong results when casting double
to bigint or int
[ https://issues.apache.org/jira/browse/DRILL-4970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149575#comment-16149575 ]
Chun Chang commented on DRILL-4970:
-----------------------------------
Verified fix:
0: jdbc:drill:schema=dfs.drillTestDir> select count(*) from dfs.`/tmp/test_table` where (int_id > -3025 and bigint_id <= -256) or (cast(double_id as bigint) >= -255 and double_id <= -5);
+---------+
| EXPR$0 |
+---------+
| 3020 |
+---------+
0: jdbc:drill:schema=dfs.drillTestDir> select count(*) as c from (values(-255.0)) as t(double_id) where (cast(double_id as int) >= -255 and double_id <= -5) or (double_id <= -256);
+----+
| c |
+----+
| 1 |
+----+
> Wrong results when casting double to bigint or int
> --------------------------------------------------
>
> Key: DRILL-4970
> URL: https://issues.apache.org/jira/browse/DRILL-4970
> Project: Apache Drill
> Issue Type: Bug
> Components: Execution - Data Types
> Affects Versions: 1.8.0
> Reporter: Robert Hou
> Assignee: Volodymyr Vysotskyi
> Labels: ready-to-commit
> Fix For: 1.11.0
>
> Attachments: test_table
>
>
> This query returns the wrong result
> {code:sql}
> 0: jdbc:drill:zk=10.10.100.186:5181/drill/rho> select count(\*) from test_table where (int_id > -3025 and bigint_id <= -256) or (cast(double_id as bigint) >= -255 and double_id <= -5);
> +---------+
> | EXPR$0 |
> +---------+
> | 2769 |
> +---------+
> {code}
> Without the cast, it returns the correct result:
> {code:sql}
> 0: jdbc:drill:zk=10.10.100.186:5181/drill/rho> select count(\*) from test_table where (int_id > -3025 and bigint_id <= -256) or (double_id >= -255 and double_id <= -5);
> +---------+
> | EXPR$0 |
> +---------+
> | 3020 |
> +---------+
> {code}
> By itself, the result is also correct:
> {code:sql}
> 0: jdbc:drill:zk=10.10.100.186:5181/drill/rho> select count(\*) from test_table where (cast(double_id as bigint) >= -255 and double_id <= -5);
> +---------+
> | EXPR$0 |
> +---------+
> | 251 |
> +---------+
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)