MaxGekk opened a new pull request #25782: [SPARK-29074][SQL] Optimize 
`date_format` for foldable `fmt`
URL: https://github.com/apache/spark/pull/25782
 
 
   ### What changes were proposed in this pull request?
   
   In the PR, I propose to create an instance of `TimestampFormatter` only once 
at the initialization, and reuse it inside of `nullSafeEval()` and 
`doGenCode()` in the case when the `fmt` parameter is foldable.
   
   ### Why are the changes needed?
   
   The changes improve performance of the `date_format()` function.
   
   Before:
   ```
   format date:                             Best/Avg Time(ms)    Rate(M/s)   
Per Row(ns)   Relative
   
------------------------------------------------------------------------------------------------
   format date wholestage off                    7180 / 7181          1.4       
  718.0       1.0X
   format date wholestage on                     7051 / 7194          1.4       
  705.1       1.0X
   ```
   
   After:
   ```
   format date:                             Best/Avg Time(ms)    Rate(M/s)   
Per Row(ns)   Relative
   
------------------------------------------------------------------------------------------------
   format date wholestage off                    6642 / 6666          1.4       
  664.2       1.0X
   format date wholestage on                     6556 / 6565          1.5       
  655.6       1.0X
   ```
   
   ### Does this PR introduce any user-facing change?
   No.
   
   ### How was this patch tested?
   
   By existing test suites `DateExpressionsSuite` and `DateFunctionsSuite`.
   

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

Reply via email to