You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/04/29 06:47:00 UTC

[jira] [Commented] (DRILL-6362) typeof() lies about types

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

Paul Rogers commented on DRILL-6362:
------------------------------------

We probably cannot change {{typeof}} because of concerns about backward compatibility. See DRILL-6361 for new, alternative functions.

> typeof() lies about types
> -------------------------
>
>                 Key: DRILL-6362
>                 URL: https://issues.apache.org/jira/browse/DRILL-6362
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.13.0
>            Reporter: Paul Rogers
>            Priority: Major
>
> Drill provides a {{typeof()}} function that returns the type of a column. But, it seems to make up types. Consider the following input file:
> {noformat}
> {a: true}
> {a: false}
> {a: null}
> {noformat}
> Consider the following two queries:
> {noformat}
> SELECT a FROM `json/boolean.json`;
> +--------+
> |   a    |
> +--------+
> | true   |
> | false  |
> | null   |
> +--------+
> > SELECT typeof(a) FROM `json/boolean.json`;
> +---------+
> | EXPR$0  |
> +---------+
> | BIT     |
> | BIT     |
> | NULL    |
> +---------+
> {noformat}
> Notice that the values are reported as BIT. But, I believe the actual type is UInt1 (the bit vector is, I believe, deprecated.) Then, the function reports NULL instead of the actual type for the null value.
> Since Drill has an {{isnull()}} function, there is no reason for {{typeof()}} to muddle the type.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)