scarlin-cloudera commented on code in PR #3433:
URL: https://github.com/apache/hive/pull/3433#discussion_r929127785
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java:
##########
@@ -85,6 +107,31 @@ public Text evaluate(Text t, IntWritable pos, IntWritable
len) {
return r;
}
+ private int[] makeIndex(long pos, long len, int inputLen) {
+ if ((Math.abs(pos) > inputLen)) {
+ return null;
+ }
+
+ long start, end;
+
+ if (pos > 0) {
+ start = pos - 1;
+ } else if (pos < 0) {
+ start = inputLen + pos;
+ } else {
+ start = 0;
+ }
+
+ if ((inputLen - start) < len) {
+ end = inputLen;
+ } else {
+ end = start + len;
+ }
+ index[0] = (int) start;
+ index[1] = (int) end;
+ return index;
+ }
Review Comment:
Done
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]