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

    https://github.com/apache/spark/pull/17997#discussion_r116878495
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
 ---
    @@ -601,22 +601,32 @@ object DateTimeUtils {
        * The calculation uses the fact that the period 1.1.2001 until 
31.12.2400 is
        * equals to the period 1.1.1601 until 31.12.2000.
        */
    -  private[this] def getYearAndDayInYear(daysSince1970: SQLDate): (Int, 
Int) = {
    -    // add the difference (in days) between 1.1.1970 and the artificial 
year 0 (-17999)
    -    val daysNormalized = daysSince1970 + toYearZero
    -    val numOfQuarterCenturies = daysNormalized / daysIn400Years
    -    val daysInThis400 = daysNormalized % daysIn400Years + 1
    -    val (years, dayInYear) = numYears(daysInThis400)
    -    val year: Int = (2001 - 20000) + 400 * numOfQuarterCenturies + years
    -    (year, dayInYear)
    +  private[this] def getYearAndDayInYear(daysSince1970: SQLDate): (Int, 
Int, Int) = {
    +    val date = new Date(daysToMillis(daysSince1970))
    +    val YMD = date.toString.trim.split("-")
    --- End diff --
    
    this would cause massive performance regression.



---
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