[ 
https://issues.apache.org/jira/browse/HIVE-24534?focusedWorklogId=537444&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-537444
 ]

ASF GitHub Bot logged work on HIVE-24534:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Jan/21 15:09
            Start Date: 18/Jan/21 15:09
    Worklog Time Spent: 10m 
      Work Description: zabetak opened a new pull request #1780:
URL: https://github.com/apache/hive/pull/1780


   ### What changes were proposed in this pull request?
   Throw an error when `hive.strict.checks.type.safety=true` and the query 
contains comparison between decimals and character types.
   
   ### Why are the changes needed?
   To fail-fast and avoid unexpected query results. Examples in the JIRA.
   
   
   ### Does this PR introduce _any_ user-facing change?
   Queries relying on comparisons between decimal and character types will fail.
   
   ### How was this patch tested?
   `mvn clean test -Dtest=TestNegativeCliDriver 
-Dqfile="strict_type_decimal_char_00.q,strict_type_decimal_char_01.q,strict_type_decimal_string_00.q,strict_type_decimal_string_01.q,strict_type_decimal_string_02.q,strict_type_decimal_varchar_00.q,strict_type_decimal_varchar_01.q,strict_type_decimal_varchar_02.q,strict_type_decimal_varchar_03.q,strict_type_decimal_varchar_04.q,strict_type_decimal_varchar_05.q,strict_type_decimal_varchar_06.q,strict_type_decimal_varchar_07.q,strict_type_decimal_varchar_08.q"
 -Dtest.output.overwrite`
   `mvn test -Dtest=TestDecimalStringValidation`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 537444)
    Time Spent: 2.5h  (was: 2h 20m)

> Prevent comparisons between characters and decimals types when strict checks 
> enabled
> ------------------------------------------------------------------------------------
>
>                 Key: HIVE-24534
>                 URL: https://issues.apache.org/jira/browse/HIVE-24534
>             Project: Hive
>          Issue Type: Task
>          Components: HiveServer2
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> When we compare decimal and character types implicit conversions take place 
> that can lead to unexpected and surprising results. 
> {code:sql}
> create table t_str (str_col string);
> insert into t_str values ('1208925742523269458163819');select * from t_str 
> where str_col=1208925742523269479013976;
> {code}
> The SELECT query brings up one row while the filtering value is not the same 
> with the one present in the string column of the table. The problem is that 
> both types are converted to doubles and due to loss of precision the values 
> are deemed equal.
> Even if we change the implicit conversion to use another type (HIVE-24528) 
> there are always some cases that may lead to unexpected results. 
> The goal of this issue is to prevent comparisons between decimal and 
> character types when hive.strict.checks.type.safety is enabled and throw an 
> error. 
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to