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 2018/12/18 05:14:11 UTC

[GitHub] attilapiros edited a comment on issue #23000: [SPARK-26002][SQL] Fix day of year calculation for Julian calendar days

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:
users@infra.apache.org


With regards,
Apache Git Services

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