hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Friedrich (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-10616) TypeInfoUtils doesn't handle DECIMAL with just precision specified
Date Tue, 30 Jun 2015 06:14:04 GMT

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

Thomas Friedrich commented on HIVE-10616:
-----------------------------------------

The CLI has no issue, that's why I opened the defect against the Serializers/Deserializers
component.
We are using the TypeInfoUtils class (package org.apache.hadoop.hive.serde2.typeinfo) in one
of our own serdes to parse the datatype and call the static method getTypeInfoFromTypeString
which should treat the decimal data type according to the spec.
However, if you pass in a string for the decimal type with just one argument, the precision
is always 10 and the scale is 0 because the parseType method doesn't handle the one argument
decimal type.

You can run a simple test like this:
TypeInfo t = TypeInfoUtils.getTypeInfoFromTypeString("decimal(20)");      
DecimalTypeInfo dti = (DecimalTypeInfo)t;
System.out.println(dti.getPrecision());  // prints 10
System.out.println(dti.getScale());       // prints 0




> TypeInfoUtils doesn't handle DECIMAL with just precision specified
> ------------------------------------------------------------------
>
>                 Key: HIVE-10616
>                 URL: https://issues.apache.org/jira/browse/HIVE-10616
>             Project: Hive
>          Issue Type: Bug
>          Components: Serializers/Deserializers
>    Affects Versions: 1.0.0
>            Reporter: Thomas Friedrich
>            Assignee: Thomas Friedrich
>            Priority: Minor
>         Attachments: HIVE-10616.1.patch
>
>
> The parseType method in TypeInfoUtils doesn't handle decimal types with just precision
specified although that's a valid type definition. 
> As a result, TypeInfoUtils.getTypeInfoFromTypeString will always return decimal(10,0)
for any decimal(<precision>) string. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message