attilapiros edited a comment on issue #23000: [SPARK-26002][SQL] Fix day of 
year calculation for Julian calendar days
URL: https://github.com/apache/spark/pull/23000#issuecomment-448098882
 
 
   @cloud-fan It was off by one (at least at 1500, with each 100 years back in 
time the difference increases) as I described in the 
[Jira](https://issues.apache.org/jira/browse/SPARK-26002):
   
   ```
   +-----------------------------------+
   |dayofyear(CAST(1500-01-02 AS DATE))|
   +-----------------------------------+
   |                                  1|
   +-----------------------------------+
   
   scala> sql("select year('1500-01-01')").show()
   +------------------------------+
   |year(CAST(1500-01-01 AS DATE))|
   +------------------------------+
   |                          1499|
   +------------------------------+
   
   
   scala> sql("select month('1500-01-01')").show()
   +-------------------------------+
   |month(CAST(1500-01-01 AS DATE))|
   +-------------------------------+
   |                             12|
   +-------------------------------+
   
   
   scala> sql("select dayOfYear('1500-01-01')").show()
   +-----------------------------------+
   |dayofyear(CAST(1500-01-01 AS DATE))|
   +-----------------------------------+
   |                                365|
   +-----------------------------------+
   
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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