rednaxelafx opened a new pull request #24352: [SPARK-27199][SQL][FOLLOWUP] Fix 
bug in codegen templates in UnixTime and FromUnixTime
URL: https://github.com/apache/spark/pull/24352
 
 
   ## What changes were proposed in this pull request?
   
   SPARK-27199 introduced the use of `ZoneId` instead of `TimeZone` in a few 
date/time expressions.
   There were 3 occurrences of `ctx.addReferenceObj("zoneId", zoneId)` in that 
PR, which had a bug because while the `java.time.ZoneId` base type is public, 
the actual concrete implementation classes are not public, so using the 2-arg 
version of `CodegenContext.addReferenceObj` would incorrectly generate code 
that reference non-public types (`java.time.ZoneRegion`, to be specific). The 
3-arg version should be used, with the class name of the referenced object 
explicitly specified to the public base type.
   
   One of such occurrences was caught in testing in the main PR of SPARK-27199, 
for `DateFormatClass`. But the other 2 occurrences slipped through because 
there were no test cases that covered them.
   
   This PR fixes the codegen issues and adds the corresponding unit tests.
   
   ## How was this patch tested?
   
   Enhanced tests in `DateExpressionsSuite` for `to_unix_timestamp` and 
`from_unixtime`.

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