cloud-fan commented on a change in pull request #26662: [SPARK-30026][SQL]
Whitespaces can be identified as delimiters in interval string
URL: https://github.com/apache/spark/pull/26662#discussion_r350699034
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
##########
@@ -484,15 +484,17 @@ object IntervalUtils {
var pointPrefixed: Boolean = false
def trimToNextState(b: Byte, next: ParseState): Unit = {
- b match {
- case ' ' => i += 1
- case _ => state = next
+ if (b <= ' ') {
+ i += 1
+ } else {
+ state = next
}
}
def currentWord: UTF8String = {
- val strings = s.split(UTF8String.blankString(1), -1)
- val lenRight = s.substring(i,
s.numBytes()).split(UTF8String.blankString(1), -1).length
+ val sep = UTF8String.fromString("\\s+")
+ val strings = s.split(sep, -1)
Review comment:
`UTF8String.split` simply calls java `String.split`. Since we only need to
get the current word for error message, can we just call `String.split`?
----------------------------------------------------------------
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]