stevomitric commented on code in PR #57931:
URL: https://github.com/apache/spark/pull/57931#discussion_r3967482969
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala:
##########
@@ -1108,7 +1123,8 @@ object Overlay {
} else {
replace.numChars
}
- builder.append(input.substringSQL(pos + length, Int.MaxValue))
+ val tail = clampTail(pos.toLong + length, input.numChars)
Review Comment:
the `input.numChars` will iterate over the string to get the number of
characters, so this is an additional O(n) scan. Its needed only in extreme
cases so can we optimize a bit here?
--
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]