Github user mgaido91 commented on a diff in the pull request: https://github.com/apache/spark/pull/22519#discussion_r219667780 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala --- @@ -554,8 +554,11 @@ class Analyzer( Cast(value, pivotColumn.dataType, Some(conf.sessionLocalTimeZone)).eval(EmptyRow) } // Group-by expressions coming from SQL are implicit and need to be deduced. - val groupByExprs = groupByExprsOpt.getOrElse( - (child.outputSet -- aggregates.flatMap(_.references) -- pivotColumn.references).toSeq) + val groupByExprs = groupByExprsOpt.getOrElse { + val pivotColAndAggRefs = + (pivotColumn.references ++ aggregates.flatMap(_.references)).toSet --- End diff -- why do we need `toSet`?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org