[
https://issues.apache.org/jira/browse/DRILL-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15059160#comment-15059160
]
Victoria Markman edited comment on DRILL-2419 at 12/16/15 12:14 AM:
--------------------------------------------------------------------
So this function will become useful when we enable union type, I believe.
I've played with it a little and it seems to return what was intended, though
NULL is not technically a type ...
{code}
0: jdbc:drill:schema=dfs> select count(*), typeof(c_timestamp) from j1 group by
typeof(c_timestamp);
+---------+------------+
| EXPR$0 | EXPR$1 |
+---------+------------+
| 9800 | TIMESTAMP |
| 200 | NULL |
+---------+------------+
2 rows selected (1.361 seconds)
0: jdbc:drill:schema=dfs> select typeof(c_integer + c_bigint ) from j2;
+---------+
| EXPR$0 |
+---------+
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| NULL |
+---------+
10 rows selected (0.565 seconds)
0: jdbc:drill:schema=dfs> select typeof(sum(c_integer)) from j2;
+---------+
| EXPR$0 |
+---------+
| BIGINT |
+---------+
1 row selected (0.377 seconds)
0: jdbc:drill:schema=dfs> select typeof(c_integer) from j3 where c_integer is
null;
+---------+
| EXPR$0 |
+---------+
+---------+
No rows selected (0.598 seconds)
0: jdbc:drill:schema=dfs> select typeof(typeof(a1)) from t1;
+----------+
| EXPR$0 |
+----------+
| VARCHAR |
| VARCHAR |
| VARCHAR |
| VARCHAR |
| VARCHAR |
| VARCHAR |
| VARCHAR |
| VARCHAR |
| VARCHAR |
| VARCHAR |
+----------+
10 rows selected (0.395 seconds)
:)
{code}
was (Author: vicky):
So this function will become useful when we enable union type, I believe.
I've played with it a little and it seems to return what was intended, though
NULL is not technically a type ...
{code}
0: jdbc:drill:schema=dfs> select count(*), typeof(c_timestamp) from j1 group by
typeof(c_timestamp);
+---------+------------+
| EXPR$0 | EXPR$1 |
+---------+------------+
| 9800 | TIMESTAMP |
| 200 | NULL |
+---------+------------+
2 rows selected (1.361 seconds)
0: jdbc:drill:schema=dfs> select typeof(c_integer + c_bigint ) from j2;
+---------+
| EXPR$0 |
+---------+
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| BIGINT |
| NULL |
+---------+
10 rows selected (0.565 seconds)
0: jdbc:drill:schema=dfs> select typeof(sum(c_integer)) from j2;
+---------+
| EXPR$0 |
+---------+
| BIGINT |
+---------+
1 row selected (0.377 seconds)
0: jdbc:drill:schema=dfs> select typeof(c_integer) from j3 where c_integer is
null;
+---------+
| EXPR$0 |
+---------+
+---------+
No rows selected (0.598 seconds)
{code}
> UDF that returns string representation of expression type
> ---------------------------------------------------------
>
> Key: DRILL-2419
> URL: https://issues.apache.org/jira/browse/DRILL-2419
> Project: Apache Drill
> Issue Type: Improvement
> Components: Functions - Drill
> Reporter: Victoria Markman
> Assignee: Steven Phillips
> Fix For: 1.3.0
>
>
> Suggested name: typeof (credit goes to Aman)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)