yaooqinn opened a new pull request #28766:
URL: https://github.com/apache/spark/pull/28766


   ### What changes were proposed in this pull request?
   
   If a datetime pattern contains no year field, the day of year field should 
not be ignored if exists
   
   e.g.
   
   ```
   spark-sql> select to_timestamp('31', 'DD');
   1970-01-01 00:00:00
   spark-sql> select to_timestamp('31 30', 'DD dd');
   1970-01-30 00:00:00
   
   spark.sql.legacy.timeParserPolicy legacy
   spark-sql> select to_timestamp('31', 'DD');
   1970-01-31 00:00:00
   spark-sql> select to_timestamp('31 30', 'DD dd');
   NULL
   ```
   
   This PR only fixes some corner cases that use 'D' pattern to parse datetimes 
and there is w/o 'y'.
   
   ### Why are the changes needed?
   
   fix some corner cases
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   yes, the day of year field will not be ignored 
   
   
   ### How was this patch tested?
   
   
   add unit tests.


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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to