okumin commented on code in PR #5624:
URL: https://github.com/apache/hive/pull/5624#discussion_r2177445177


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java:
##########
@@ -172,32 +171,59 @@ public BytesWritable evaluate(BytesWritable bw, 
IntWritable pos, IntWritable len
   }
 
   private BytesWritable evaluateInternal(BytesWritable bw, int pos, int len) {
-
     if (len <= 0) {
       return new BytesWritable();
     }
 
-    int[] index = makeIndex(pos, len, bw.getLength());
-    if (index == null) {
+    // Even though we are using longs, substr can only deal with ints, so we 
use
+    // the maximum int value as the maxValue
+    StringSubstrColStartLen.populateSubstrOffsets(bw.getBytes(), 0, 
bw.getLength(), adjustStartPos(pos), len, index);

Review Comment:
   `StringSubstrColStartLen.populateSubstrOffsets` assumes the byte array as 
UTF-8 and `substrStart` and `substrLength` as the position of UTF-8. However, 
`UDFSubstr#evaluate(ByteWritable)` seems to handle the byte array as a pure 
byte array without assuming any encoding. So, we don't need to update the 
behavior, I think. No vectorized implementation exists for the binary type.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to