[
https://issues.apache.org/jira/browse/DRILL-1945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mehant Baid updated DRILL-1945:
-------------------------------
Attachment: DRILL-1945.patch
My initial thought that this might be related to null handling wasn't correct,
problem was happening because of incorrect initialization of variables for
Float8 and Float4 data type in max function.
> max() of all 0.0 value gives wrong results
> ------------------------------------------
>
> Key: DRILL-1945
> URL: https://issues.apache.org/jira/browse/DRILL-1945
> Project: Apache Drill
> Issue Type: Bug
> Components: Functions - Drill
> Affects Versions: 0.8.0
> Reporter: Chun Chang
> Assignee: Mehant Baid
> Attachments: DRILL-1945.patch
>
>
> #Fri Jan 02 21:20:47 EST 2015
> git.commit.id.abbrev=b491cdb
> test data can be accessed from
> https://s3.amazonaws.com/apache-drill/files/complex.json.gz
> Using the above dataset, the t.sfa[0] field is all 0.0.
> {code}
> 0: jdbc:drill:schema=dfs.drillTestDirMondrian> select t.sfa[0] from
> `complex.json` t limit 10;
> +------------+
> | EXPR$0 |
> +------------+
> | 0.0 |
> | 0.0 |
> | 0.0 |
> | 0.0 |
> | 0.0 |
> | 0.0 |
> | 0.0 |
> | 0.0 |
> | 0.0 |
> | 0.0 |
> +------------+
> 10 rows selected (0.083 seconds)
> 0: jdbc:drill:schema=dfs.drillTestDirMondrian> select t.sfa[0] from
> `complex.json` t where t.sfa[0] <> 0.0;
> +------------+
> | EXPR$0 |
> +------------+
> +------------+
> No rows selected (15.616 seconds)
> {code}
> The max value of this field in a group by query gives wrong results.
> {code}
> 0: jdbc:drill:schema=dfs.drillTestDirMondrian> select mod(trunc(t.sfa[1]),
> 10) sfamod, max(t.sfa[0]) sfamax from `complex.json` t group by
> mod(trunc(t.sfa[1]), 10);
> +------------+------------+
> | sfamod | sfamax |
> +------------+------------+
> | 1.0 | 4.9E-324 |
> | 2.0 | 4.9E-324 |
> | 3.0 | 4.9E-324 |
> | 4.0 | 4.9E-324 |
> | 5.0 | 4.9E-324 |
> | 6.0 | 4.9E-324 |
> | 7.0 | 4.9E-324 |
> | 8.0 | 4.9E-324 |
> | 9.0 | 4.9E-324 |
> | 0.0 | 4.9E-324 |
> +------------+------------+
> 10 rows selected (14.474 seconds)
> {code}
> simple max() on the field also gives the same wrong result.
> {code}
> 0: jdbc:drill:schema=dfs.drillTestDirMondrian> select max(t.sfa[0]) sfamax
> from `complex.json` t;
> +------------+
> | sfamax |
> +------------+
> | 4.9E-324 |
> +------------+
> 1 row selected (15.666 seconds)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)