maropu commented on a change in pull request #26256: [SPARK-29605][SQL]
Optimize string to interval casting
URL: https://github.com/apache/spark/pull/26256#discussion_r339282987
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
##########
@@ -119,4 +119,168 @@ object IntervalUtils {
case _: IllegalArgumentException => null
}
}
+
+ private object ParseState extends Enumeration {
+ val PREFIX,
+ BEGIN_VALUE,
+ PARSE_SIGN,
+ POSITIVE_VALUE_TO_LONG,
+ NEGATIVE_VALUE_TO_LONG,
+ BEGIN_UNIT_NAME,
+ UNIT_NAME_SUFFIX,
+ END_UNIT_NAME = Value
+ }
+ private final val intervalStr = UTF8String.fromString("interval")
+ private final val yearStr = UTF8String.fromString("year")
+ private final val monthStr = UTF8String.fromString("month")
+ private final val weekStr = UTF8String.fromString("week")
+ private final val dayStr = UTF8String.fromString("day")
+ private final val hourStr = UTF8String.fromString("hour")
+ private final val minuteStr = UTF8String.fromString("minute")
+ private final val secondStr = UTF8String.fromString("second")
+ private final val millisStr = UTF8String.fromString("millisecond")
+ private final val microsStr = UTF8String.fromString("microsecond")
Review comment:
I know you added `final` for performance reasons, but do we have actual
performance diffs of the benchmarks below with/without this `final`? (Just out
of curiosity...
----------------------------------------------------------------
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]