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

    https://github.com/apache/spark/pull/18664#discussion_r128107798
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/arrow/ArrowConvertersSuite.scala
 ---
    @@ -792,6 +793,76 @@ class ArrowConvertersSuite extends SharedSQLContext 
with BeforeAndAfterAll {
         collectAndValidate(df, json, "binaryData.json")
       }
     
    +  test("date type conversion") {
    +    val json =
    +      s"""
    +         |{
    +         |  "schema" : {
    +         |    "fields" : [ {
    +         |      "name" : "date",
    +         |      "type" : {
    +         |        "name" : "date",
    +         |        "unit" : "DAY"
    +         |      },
    +         |      "nullable" : true,
    +         |      "children" : [ ],
    +         |      "typeLayout" : {
    +         |        "vectors" : [ {
    +         |          "type" : "VALIDITY",
    +         |          "typeBitWidth" : 1
    +         |        }, {
    +         |          "type" : "DATA",
    +         |          "typeBitWidth" : 32
    +         |        } ]
    +         |      }
    +         |    } ]
    +         |  },
    +         |  "batches" : [ {
    +         |    "count" : 4,
    +         |    "columns" : [ {
    +         |      "name" : "date",
    +         |      "count" : 4,
    +         |      "VALIDITY" : [ 1, 1, 1, 1 ],
    +         |      "DATA" : [ -1, 0, 16533, 16930 ]
    +         |    } ]
    +         |  } ]
    +         |}
    +       """.stripMargin
    +
    +    val sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z", Locale.US)
    +    val d1 = new Date(-1)  // "1969-12-31 13:10:15.000 UTC"
    +    val d2 = new Date(0)  // "1970-01-01 13:10:15.000 UTC"
    +    val d3 = new Date(sdf.parse("2015-04-08 13:10:15.000 UTC").getTime)
    +    val d4 = new Date(sdf.parse("2016-05-09 12:01:01.000 UTC").getTime)
    +
    +    // Date is created unaware of timezone, but DateTimeUtils force 
defaultTimeZone()
    +    
assert(DateTimeUtils.toJavaDate(DateTimeUtils.fromJavaDate(d2)).getTime == 
d2.getTime)
    --- End diff --
    
    Thanks @ueshin!  I think I got it


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