Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6986#discussion_r35490308
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
 ---
    @@ -573,4 +573,35 @@ object DateTimeUtils {
           dayInYear - 334
         }
       }
    +
    +  /**
    +   * Returns Day of week from String.
    +   */
    +  def getDayOfWeekFromString(string: UTF8String): Int = {
    +    val dowString = string.toString.toUpperCase
    +    dowString match {
    +      case "SU" | "SUN" | "SUNDAY" => 2
    +      case "MO" | "MON" | "MONDAY" => 3
    +      case "TU" | "TUE" | "TUESDAY" => 4
    +      case "WE" | "WED" | "WEDNESDAY" => 5
    +      case "TH" | "THU" | "THURSDAY" => 6
    +      case "FR" | "FRI" | "FRIDAY" => 0
    +      case "SA" | "SAT" | "SATURDAY" => 1
    +      case _ => -1
    +    }
    +  }
    +
    +  /**
    +   * Returns last day of the month for the given date. The date is 
expressed in days
    +   * since 1.1.1970.
    +   */
    +  def getLastDayOfMonth(date: Int): Int = {
    +    val dayOfMonth = getDayOfMonth(date)
    +    val month = getMonth(date)
    +
    +    val febDay = if (isLeapYear(getYear(date))) 29 else 28
    --- End diff --
    
    move days to a static field


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to