[
https://issues.apache.org/jira/browse/HIVE-23269?focusedWorklogId=426759&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-426759
]
ASF GitHub Bot logged work on HIVE-23269:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Apr/20 22:14
Start Date: 23/Apr/20 22:14
Worklog Time Spent: 10m
Work Description: dengzhhu653 commented on a change in pull request #992:
URL: https://github.com/apache/hive/pull/992#discussion_r414159331
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/parse/type/TypeCheckProcFactory.java
##########
@@ -789,12 +791,25 @@ protected void validateUDF(ASTNode expr, boolean
isFunction, TypeCheckCtx ctx, F
LogHelper console = new LogHelper(LOG);
+ Set<PrimitiveObjectInspector.PrimitiveCategory> unsafeConventionTyps =
Sets.newHashSet(
+ PrimitiveObjectInspector.PrimitiveCategory.STRING,
+ PrimitiveObjectInspector.PrimitiveCategory.VARCHAR,
+ PrimitiveObjectInspector.PrimitiveCategory.CHAR);
// For now, if a bigint is going to be cast to a double throw an error
or warning
- if ((oiTypeInfo0.equals(TypeInfoFactory.stringTypeInfo) &&
oiTypeInfo1.equals(TypeInfoFactory.longTypeInfo)) ||
- (oiTypeInfo0.equals(TypeInfoFactory.longTypeInfo) &&
oiTypeInfo1.equals(TypeInfoFactory.stringTypeInfo))) {
+ if ((oiTypeInfo0 instanceof PrimitiveTypeInfo &&
Review comment:
Move the conditions to method unSafeCompareWithBigInt.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 426759)
Time Spent: 1.5h (was: 1h 20m)
> Unsafe comparing bigints and chars
> ----------------------------------
>
> Key: HIVE-23269
> URL: https://issues.apache.org/jira/browse/HIVE-23269
> Project: Hive
> Issue Type: Improvement
> Affects Versions: 4.0.0
> Reporter: Zhihua Deng
> Priority: Major
> Attachments: HIVE-23269.patch
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> Comparing bigints and varchars or chars may result to wrong result, for
> example:
> CREATE TABLE test_a (appid1 varchar(256), appid2 char(20));
> INSERT INTO test_a VALUES ('2882303761517473127', '2882303761517473127'),
> ('2882303761517473276','2882303761517473276');
> SET hive.strict.checks.type.safety=false;
> SELECT appid1 FROM test_a WHERE appid1 = 2882303761517473127;
> SELECT appid2 FROM test_a WHERE appid2 = 2882303761517473127;
> Both queries will output the row:
> ('2882303761517473276','2882303761517473276')
--
This message was sent by Atlassian Jira
(v8.3.4#803005)