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

Arina Ielchiieva commented on DRILL-6377:
-----------------------------------------

For decimals SqlTypeOf function covers precision and scale:
{noformat}
apache drill> select sqltypeof(cast(10.56 as decimal(5,2))) from (values(1));
+---------------+
|    EXPR$0     |
+---------------+
| DECIMAL(5, 2) |
{noformat}

For interval looks like issue was fixed:
{noformat}
apache drill> select sqltypeof(INTERVAL '1' YEAR) from (values(1));
+------------------------+
|         EXPR$0         |
+------------------------+
| INTERVAL YEAR TO MONTH |
+------------------------+
1 row selected (0.109 seconds)
apache drill> select typeof(INTERVAL '1' YEAR) from (values(1));
+--------------+
|    EXPR$0    |
+--------------+
| INTERVALYEAR |
{noformat}


> typeof() does not return DECIMAL scale, precision
> -------------------------------------------------
>
>                 Key: DRILL-6377
>                 URL: https://issues.apache.org/jira/browse/DRILL-6377
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.13.0
>            Reporter: Paul Rogers
>            Priority: Minor
>
> The {{typeof()}} function returns the type of a column:
> {noformat}
> SELECT typeof(CAST(a AS DOUBLE)) FROM (VALUES (1)) AS T(a);
> +---------+
> | EXPR$0  |
> +---------+
> | FLOAT8  |
> +---------+
> {noformat}
> In Drill, the {{DECIMAL}} type is parameterized with scale and precision. 
> However, {{typeof()}} does not return this information:
> {noformat}
> ALTER SESSION SET `planner.enable_decimal_data_type` = true;
> SELECT typeof(CAST(a AS DECIMAL)) FROM (VALUES (1)) AS T(a);
> +------------------+
> |      EXPR$0      |
> +------------------+
> | DECIMAL38SPARSE  |
> +------------------+
> SELECT typeof(CAST(a AS DECIMAL(6, 3))) FROM (VALUES (1)) AS T(a);
> +-----------+
> |  EXPR$0   |
> +-----------+
> | DECIMAL9  |
> +-----------+
> {noformat}
> Expected something of the form {{DECIMAL<suffix>(<scale>, <precision>)}}.



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

Reply via email to