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

Jason Dere commented on HIVE-14995:
-----------------------------------

Seems like the select operator should be doing the same UDFToInteger conversion 
to the partition column value that it is doing for the value that is being 
inserted to the normal column.

> double conversion can corrupt partition column values for insert with dynamic 
> partitions
> ----------------------------------------------------------------------------------------
>
>                 Key: HIVE-14995
>                 URL: https://issues.apache.org/jira/browse/HIVE-14995
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Sergey Shelukhin
>            Priority: Critical
>
> {noformat}
> set hive.mapred.mode=nonstrict;
> set hive.explain.user=false;
> set hive.exec.dynamic.partition.mode=nonstrict;
> set hive.fetch.task.conversion=none;
> drop table iow1; 
> create table iow1(key int) partitioned by (key2 int);
> select key, key + 1 as k1, key + 1 as k2 from src where key >= 0 order by k1 
> desc limit 1;
> explain
> insert overwrite table iow1 partition (key2)
> select key + 1 as k1, key + 1 as k2 from src where key >= 0 order by k1 desc 
> limit 1;
> insert overwrite table iow1 partition (key2)
> select key + 1 as k1, key + 1 as k2 from src where key >= 0 order by k1 desc 
> limit 1;
> {noformat}
> The result of the select query has the column converted to double (because 
> src.key is string). 
> {noformat}
> 498   499.0   499.0
> {noformat}
> When inserting that into table, the value is converted correctly to integer 
> for the regular column, but not for partition column.
> Explain for insert (extracted)
> {noformat}
>       Map Operator Tree:
> ...
>               Select Operator
>                 expressions: (UDFToDouble(key) + 1.0) (type: double)
> ...
>                 Reduce Output Operator
>                   key expressions: _col0 (type: double)
> ...
>       Reduce Operator Tree:
>         Select Operator
>           expressions: KEY.reducesinkkey0 (type: double), KEY.reducesinkkey0 
> (type: double)
> ...
>             Select Operator
>               expressions: UDFToInteger(_col0) (type: int), _col1 (type: 
> double)
> ... followed by FSOP and load into table
> {noformat}
> The result of the select from the resulting table is:
> {noformat}
> POSTHOOK: query: select key, key2 from iow1
> ...
> POSTHOOK: Input: default@iow1@key2=499.0
> ...
> 499   NULL
> {noformat}
> Woops!



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

Reply via email to