Chun Chang created DRILL-1007:
---------------------------------
Summary: decimal38 comparison with double failed on some values
Key: DRILL-1007
URL: https://issues.apache.org/jira/browse/DRILL-1007
Project: Apache Drill
Issue Type: Bug
Components: Functions - Drill
Reporter: Chun Chang
Assignee: Mehant Baid
comparison between double and decimal38 fails for some values like:
0 vs -0.000000010000000000
-56789012345.1234 vs -999999999999999999.000000000000000000
For example, the following query yields the following results with postgres:
foodmart=# select c_row, c_float8, cast(c_decimal38 as decimal(38,18)) from
data where c_row < 15 and c_float8 > cast(c_decimal38 as decimal(38,18));
c_row | c_float8 | c_decimal38
-------+-------------------+----------------------------------------
1 | 10.5 | 0.000000000000000000
2 | 10.5 | 1.000000000000000000
4 | 123456789012345 | 999999999.000000000000000000
5 | 999999999999999 | -999999999.000000000000000000
7 | 0 | -0.000000010000000000
11 | -56789012345.1234 | -999999999999999999.000000000000000000
13 | 2147483647 | -0.000000000000000010
(7 rows)
with Drill, two rows are missing due to failed comparison:
0: jdbc:drill:schema=dfs> select c_row, c_float8, cast(c_decimal38 as
decimal(38,18)) from data where c_row < 15 and c_float8 > cast(c_decimal38 as
decimal(38,18));
+------------+------------+------------+
| c_row | c_float8 | EXPR$2 |
+------------+------------+------------+
| 1 | 10.5 | 0E-18 |
| 2 | 10.5 | 1.000000000000000000 |
| 4 | 1.23456789012345E14 | 999999999.000000000000000000 |
| 5 | 9.99999999999999E14 | -999999999.000000000000000000 |
| 13 | 2.147483647E9 | -1.0E-17 |
+------------+------------+------------+
5 rows selected (0.156 seconds)
--
This message was sent by Atlassian JIRA
(v6.2#6252)