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/05/04 22:44:00 UTC

[jira] [Commented] (DRILL-6378) MajorType passed into UDF with FieldReader has unset prec, scale for DECIMAL

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

Paul Rogers commented on DRILL-6378:
------------------------------------

Verified fix using latest master. A unit test demonstrating the fix is available in DRILL-6361.

> MajorType passed into UDF with FieldReader has unset prec, scale for DECIMAL
> ----------------------------------------------------------------------------
>
>                 Key: DRILL-6378
>                 URL: https://issues.apache.org/jira/browse/DRILL-6378
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.13.0
>            Reporter: Paul Rogers
>            Assignee: Volodymyr Vysotskyi
>            Priority: Major
>
> UDFs allow passing in a generic {{FieldReader}} such as for the {{typeof}} function. I tried to modify the new {{sqlTypeOf()}} function to include the DECIMAL precision and scale, something like: {{DECIMAL(9, 2)}}.
> But, the {{MajorType}} associated with the {{FieldReader}} has these values as 0. Not sure if it is because the DECIMAL is the result of a cast, or if there is a deeper bug.
> Query:
> {noformat}
> ALTER SESSION SET `planner.enable_decimal_data_type` = true;
> SELECT sqlTypeof(CAST(a AS DECIMAL)) FROM (VALUES (1)) AS T(a);
> {noformat}
> Debug information for the {{MajorType}}
> {noformat}
> type	TypeProtos$MajorType  (id=151)	
> precision_	0	
> scale_	0	
> {noformat}
> This bug is not simply a nuisance for formatting. The precision and scale are required to make sense of any {{DECIMAL}} values that the function wants to process: without these values, the function does not know the meaning of the {{DECIMAL}} data.
> Once this bug is fixed, reenable the type suffix code in {{UnionFunctions.extendType()}}.



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