You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Vova Vysotskyi (Jira)" <ji...@apache.org> on 2020/03/02 13:38:00 UTC
[jira] [Commented] (DRILL-7616) Wrong MIN() and MAX() values for
TSV file
[ https://issues.apache.org/jira/browse/DRILL-7616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17049211#comment-17049211 ]
Vova Vysotskyi commented on DRILL-7616:
---------------------------------------
[~sj14], Drill by default reads text files data as VARCHAR, so MIN and MAX functions are applied to strings. You may either add a cast to int to compare values as ints:
{code:sql}
SELECT MIN(cast(requests as int)) FROM TABLE(dfs.`/.../requests.tsv`(type => 'text', extractHeader => true, fieldDelimiter => '\t'));
{code}
or you may use a schema provisioning feature: [https://drill.apache.org/docs/create-or-replace-schema/].
> Wrong MIN() and MAX() values for TSV file
> -----------------------------------------
>
> Key: DRILL-7616
> URL: https://issues.apache.org/jira/browse/DRILL-7616
> Project: Apache Drill
> Issue Type: Bug
> Affects Versions: 1.17.0
> Environment: Docker image
> Reporter: Simon Jürgensmeyer
> Priority: Major
> Attachments: requests.tsv
>
>
> MIN() and MAX() give wrong results.
> {code:java}
> SELECT MIN(requests) FROM TABLE(dfs.`/.../requests.tsv`(type => 'text', extractHeader => true, fieldDelimiter => '\t'));
> +--------+
> | EXPR$0 |
> +--------+
> | 102996 |
> +--------+
> {code}
> Expected MIN value: 2020
>
> {code:java}
> SELECT MAX(requests) FROM TABLE(dfs.`/.../requests.tsv`(type => 'text', extractHeader => true, fieldDelimiter => '\t'));
> +--------+
> | EXPR$0 |
> +--------+
> | 97728 |
> +--------+
> {code}
> Expected MAX value: 185594
--
This message was sent by Atlassian Jira
(v8.3.4#803005)