Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/17348#discussion_r107330581
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/DataFramePivotSuite.scala ---
@@ -230,4 +230,17 @@ class DataFramePivotSuite extends QueryTest with
SharedSQLContext{
.groupBy($"a").pivot("a").agg(min($"b")),
Row(null, Seq(null, 7), null) :: Row(1, null, Seq(1, 7)) :: Nil)
}
+
+ test("pivot with timestamp and count should not print internal
representation") {
+ val ts = "2012-12-31 16:00:10.011"
+ val tsWithZone = "2013-01-01 00:00:10.011"
+
+ withSQLConf(SQLConf.SESSION_LOCAL_TIMEZONE.key -> "GMT") {
+ val df =
Seq(java.sql.Timestamp.valueOf(ts)).toDF("a").groupBy("a").pivot("a").count()
+ val expected = StructType(
+ StructField("a", TimestampType) ::
+ StructField(tsWithZone, LongType) :: Nil)
--- End diff --
Yea, I was confused of it too because the original values are apprently
rendered differently. However, it seems intended.
```scala
scala> spark.conf.set("spark.sql.session.timeZone", "America/Los_Angeles")
scala> val timestamp = java.sql.Timestamp.valueOf("2012-12-31 16:00:10.011")
timestamp: java.sql.Timestamp = 2012-12-31 16:00:10.011
scala> Seq(timestamp).toDF("a").show()
+--------------------+
| a|
+--------------------+
|2012-12-30 23:00:...|
+--------------------+
```
Internal values seem as they are but it seems only changing human readable
format according to the given timezone.
I guess this is as described in https://github.com/apache/spark/pull/16308
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]