[ 
https://issues.apache.org/jira/browse/HIVE-28449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stamatis Zampetakis resolved HIVE-28449.
----------------------------------------
    Fix Version/s: Not Applicable
       Resolution: Won't Fix

Resolving this as won't fix since there is no strong interest to push this 
change forward and may cause other unintended breaking changes.

> Infer constant types from columns before strict type validation
> ---------------------------------------------------------------
>
>                 Key: HIVE-28449
>                 URL: https://issues.apache.org/jira/browse/HIVE-28449
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Planning
>         Environment: 
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>              Labels: backwards-compatibility, pull-request-available
>             Fix For: Not Applicable
>
>
> HIVE-2249 introduced some [specialized type inference 
> logic|https://github.com/apache/hive/blob/5cbffb532a586226500abc498d6505722d62234d/ql/src/java/org/apache/hadoop/hive/ql/parse/type/TypeCheckProcFactory.java#L972]
>  that kicks in when there are comparisons between columns and numeric 
> constant expressions.
> Consider for instance a comparison between a BIGINT column and a STRING 
> constant.
> {code:sql}
> SELECT * FROM table WHERE c_bigint = '9223372036854775807'
> {code}
> The type derivation logic will attempt to convert the STRING constant to 
> BIGINT and evaluate the expression by comparing long values.
> Currently (commit 5cbffb532a586226500abc498d6505722d62234d), the query above 
> throws the following ERROR/WARNING:
> {noformat}
> Comparing bigint and string may result in loss of information.
> {noformat}
> This is due to strict type checking (controlled via 
> hive.strict.checks.type.safety property) that is now applied before the 
> constant type inference logic described above.
> In this case, the ERROR/WARNING is a bit misleading since there is no real 
> risk for losing precision/information since the STRING constant fits into a 
> BIGINT (Java long) and the whole comparison can be evaluated without 
> precision loss.
> For quite some time, strict type checking was performed *after* constant type 
> inference (and not *before*) but the behavior was changed unintentionally by 
> HIVE-23100.
> The goal of this change is to perform constant type inference before strict 
> type validation (behavior before HIVE-23100) to restore backward 
> compatibility and remove some unnecessary warnings/errors during compilation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to