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

jirapos...@reviews.apache.org commented on HIVE-2378:
-----------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/1515/
-----------------------------------------------------------

(Updated 2011-08-18 17:21:26.213141)


Review request for hive and Siying Dong.


Changes
-------

Changed my mind.

Ran a few more tests to make sure they were equivalent and found that having 
the check in  GenericUDFBaseCompare.ObjectInspector.initialize can result in 
the warning being thrown multiple times for the same operator.  I also found 
that queries, like the ones in the .q file don't hit 
DefaultExprProcessor.getFuncExprNodeDesc.

I added the check to ExprNodeGenericFuncDesc.newInstance because this is hit, 
it appears to only be hit once per operator, and it will be hit if the code 
ever goes through DefaultExprProcessor.getFuncExprNodeDesc.


Summary
-------

I added a check in the code for equality expressions (includes inequalities) 
with operands of different types, that throws an error or logs a warning, 
depending on strict mode, if one operand is a string or double and the other is 
a bigint.


This addresses bug HIVE-2378.
    https://issues.apache.org/jira/browse/HIVE-2378


Diffs (updated)
-----

  trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java 1158835 
  trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeGenericFuncDesc.java 
1158835 
  trunk/ql/src/test/queries/clientnegative/compare_double_bigint.q PRE-CREATION 
  trunk/ql/src/test/queries/clientnegative/compare_string_bigint.q PRE-CREATION 
  trunk/ql/src/test/results/clientnegative/compare_double_bigint.q.out 
PRE-CREATION 
  trunk/ql/src/test/results/clientnegative/compare_string_bigint.q.out 
PRE-CREATION 

Diff: https://reviews.apache.org/r/1515/diff


Testing
-------

I added two tests (one for strings and one for doubles) to record the issue.

I also verified the unit tests still run.


Thanks,

Kevin



> Warn user that precision is lost when bigint is implicitly cast to double.
> --------------------------------------------------------------------------
>
>                 Key: HIVE-2378
>                 URL: https://issues.apache.org/jira/browse/HIVE-2378
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Kevin Wilfong
>            Assignee: Kevin Wilfong
>         Attachments: HIVE-2378.1.patch.txt, HIVE-2378.2.patch.txt, 
> HIVE-2378.3.patch.txt
>
>
> When a bigint is implicitly cast to a double (when a bigint is involved in an 
> equality expression with a string or double) precision may be lost, resulting 
> in unexpected behavior.  Until we fix the underlying issue we should throw an 
> error in strict mode, and a warning in nonstrict mode alerting the user about 
> this.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to