Github user NathanHowell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16386#discussion_r100103739
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala
 ---
    @@ -227,66 +267,71 @@ class JacksonParser(
           }
     
         case TimestampType =>
    -      (parser: JsonParser) => parseJsonToken(parser, dataType) {
    +      (parser: JsonParser) => parseJsonToken[java.lang.Long](parser, 
dataType) {
             case VALUE_STRING =>
    +          val stringValue = parser.getText
               // This one will lose microseconds parts.
               // See https://issues.apache.org/jira/browse/SPARK-10681.
    -          Try(options.timestampFormat.parse(parser.getText).getTime * 
1000L)
    -            .getOrElse {
    -              // If it fails to parse, then tries the way used in 2.0 and 
1.x for backwards
    -              // compatibility.
    -              DateTimeUtils.stringToTime(parser.getText).getTime * 1000L
    -            }
    +          Long.box {
    --- End diff --
    
    This is needed to satisfy the type checker. The other approach is to 
explicitly specify the type in two locations: 
`Try[java.lang.Long](...).getOrElse[java.lang.Long](...)`. I found explicitly 
boxing to be more readable than the alternative.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to