Github user aray commented on the issue:
https://github.com/apache/spark/pull/17226
@HyukjinKwon There is an inconsistency/regression but its not being
introduced in this PR, its already there. Take an example without null as a
pivot column value like below. The only difference is for the `count(1)`
aggregate on cells with no values aggregated in the pivot table. Again I don't
think it's clear which is "correct" here.
**Spark 2.1.0** (and presumably 2.0.x/master)
```
scala> Seq(1,2).toDF("a").groupBy("a").pivot("a").count().show
+---+----+----+
| a| 1| 2|
+---+----+----+
| 1| 1|null|
| 2|null| 1|
+---+----+----+
scala> Seq(1,2).toDF("a").groupBy("a").pivot("a").sum("a").show
+---+----+----+
| a| 1| 2|
+---+----+----+
| 1| 1|null|
| 2|null| 2|
+---+----+----+
```
**Spark 1.6.0**
```
scala>
sc.parallelize(Seq(1,2)).toDF("a").groupBy("a").pivot("a").count().show
+---+---+---+
| a| 1| 2|
+---+---+---+
| 1| 1| 0|
| 2| 0| 1|
+---+---+---+
scala>
sc.parallelize(Seq(1,2)).toDF("a").groupBy("a").pivot("a").sum("a").show
+---+----+----+
| a| 1| 2|
+---+----+----+
| 1| 1|null|
| 2|null| 2|
+---+----+----+
```
---
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]