[ https://issues.apache.org/jira/browse/HIVE-26294?focusedWorklogId=796831&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-796831 ]
ASF GitHub Bot logged work on HIVE-26294: ----------------------------------------- Author: ASF GitHub Bot Created on: 01/Aug/22 09:33 Start Date: 01/Aug/22 09:33 Worklog Time Spent: 10m Work Description: kasakrisz commented on code in PR #3433: URL: https://github.com/apache/hive/pull/3433#discussion_r934330702 ########## ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java: ########## @@ -64,19 +64,39 @@ public UDFSubstr() { r = new Text(); } - public Text evaluate(Text t, IntWritable pos, IntWritable len) { + public Text evaluate(Text t, LongWritable pos, LongWritable len) { + if ((t == null) || (pos == null) || (len == null)) { + return null; + } + + long longPos = pos.get(); + long longLen = len.get(); + // If an unsupported value is seen, we don't want to return a string + // that doesn't match what the user expects, so we return NULL (still + // unexpected, of course, but probably better than a bad string). + if (longPos > Integer.MAX_VALUE || longLen > Integer.MAX_VALUE) { Review Comment: Should negative overflow also be handled? ``` long l = Integer.MIN_VALUE - 10L; int i = (int)l; ``` I think `i` is going to be a positive integer. Issue Time Tracking ------------------- Worklog Id: (was: 796831) Time Spent: 1h 10m (was: 1h) > Allow substr to take bigint as parameters > ----------------------------------------- > > Key: HIVE-26294 > URL: https://issues.apache.org/jira/browse/HIVE-26294 > Project: Hive > Issue Type: Improvement > Components: Types > Reporter: Steve Carlin > Priority: Minor > Labels: pull-request-available > Time Spent: 1h 10m > Remaining Estimate: 0h > > Small enhancement > Impala allows a bigint as an argument for the substr function. We should > allow Hive to allow bigint arguments too. -- This message was sent by Atlassian Jira (v8.20.10#820010)