You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/07/08 16:03:07 UTC

[GitHub] [spark] AngersZhuuuu commented on a change in pull request #33265: [SPARK-36049][SQL] Remove IntervalUnit

AngersZhuuuu commented on a change in pull request #33265:
URL: https://github.com/apache/spark/pull/33265#discussion_r666328235



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
##########
@@ -774,19 +747,32 @@ object IntervalUtils {
         UNIT_SUFFIX,
         UNIT_END = Value
   }
-  private final val intervalStr = UTF8String.fromString("interval")
-  private def unitToUtf8(unit: IntervalUnit): UTF8String = {
-    UTF8String.fromString(unit.toString)
+  private final val intervalStr = unitToUtf8("interval")
+  private def unitToUtf8(unit: String): UTF8String = {
+    UTF8String.fromString(unit)
+  }
+  private final val yearStr = unitToUtf8("year")
+  private final val monthStr = unitToUtf8("month")
+  private final val weekStr = unitToUtf8("week")
+  private final val dayStr = unitToUtf8("day")
+  private final val hourStr = unitToUtf8("hour")
+  private final val minuteStr = unitToUtf8("minute")
+  private final val secondStr = unitToUtf8("second")
+  private final val millisStr = unitToUtf8("millisecond")
+  private final val microsStr = unitToUtf8("microsecond")
+  private final val nanosStr = unitToUtf8("nanosecond")
+
+  def intervalUnits: Seq[UTF8String] = {
+    Seq(yearStr,
+      monthStr,
+      weekStr,
+      dayStr,
+      hourStr,
+      minuteStr,
+      secondStr,
+      millisStr,
+      microsStr)

Review comment:
       > Is it used somewhere except of tests? Just wonder why did you move it from `ExpressionParserSuite`?
   
   Move back, how about current?




-- 
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: reviews-unsubscribe@spark.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org