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 2019/04/11 21:00:56 UTC

[GitHub] [spark] rednaxelafx opened a new pull request #24352: [SPARK-27199][SQL][FOLLOWUP] Fix bug in codegen templates in UnixTime and FromUnixTime

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