Github user ueshin commented on a diff in the pull request: https://github.com/apache/spark/pull/1034#discussion_r13584575 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala --- @@ -100,8 +100,8 @@ object ColumnPruning extends Rule[LogicalPlan] { object NullPropagation extends Rule[LogicalPlan] { def apply(plan: LogicalPlan): LogicalPlan = plan transform { case q: LogicalPlan => q transformExpressionsUp { - case e @ Count(Literal(null, _)) => Literal(0, e.dataType) - case e @ Sum(Literal(c, _)) if c == 0 => Literal(0, e.dataType) + case e @ Count(Literal(null, _)) => Literal(0L, e.dataType) --- End diff -- I agree with that. Even if we never change/specialize the return type, `SimplifyCasts` can remove the extra `Cast`. And I'd like to change the `Literal` value for `Sum` to `0L` to use `SimplifyCasts` for the case of the sum of integral values.
--- 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. ---