cloud-fan commented on a change in pull request #26622:
[WIP][SPARK-28023][Test] Cheap UTF8String Trim
URL: https://github.com/apache/spark/pull/26622#discussion_r349015186
##########
File path:
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
##########
@@ -1077,13 +1077,21 @@ public UTF8String translate(Map<Character, Character>
dict) {
* @return true if the parsing was successful else false
*/
public boolean toLong(LongWrapper toLongResult) {
+ int numBytes = this.numBytes;
+ int offset = 0;
+ while (offset < numBytes && getByte(offset) == 0x20) {
+ offset++;
+ }
+ while (numBytes - 1 > offset && getByte(numBytes - 1) == 0x20) {
+ numBytes--;
Review comment:
this is not numBytes, but the endIndex. numBytes should be endIndex -
startIndex.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]