Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/17348#discussion_r107335518
--- 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 --
With the default timezone ...
```scala
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").groupBy("a").pivot("a").count().show(false)
+-----------------------+-----------------------+
|a |2012-12-31 16:00:10.011|
+-----------------------+-----------------------+
|2012-12-31 16:00:10.011|1 |
+-----------------------+-----------------------+
```
---
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]