[
https://issues.apache.org/jira/browse/HIVE-24534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stamatis Zampetakis updated HIVE-24534:
---------------------------------------
Description:
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.
was:
Implicit conversions between decimal and character types are not always safe
and in various cases they 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 implicit conversions when
hive.strict.checks.type.safety is enabled and throw an error.
> Prevent comparisons between characters and decimals types
> ---------------------------------------------------------
>
> 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
> Fix For: 4.0.0
>
>
> 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)