drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Rogers (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-6378) MajorType passed into UDF with FieldReader has unset prec, scale for DECIMAL
Date Wed, 02 May 2018 06:01:00 GMT
Paul Rogers created DRILL-6378:
----------------------------------

             Summary: 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


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)

Mime
View raw message