[ https://issues.apache.org/jira/browse/SPARK-20346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15970281#comment-15970281 ]
Jacek Laskowski commented on SPARK-20346: ----------------------------------------- [~hyukjin.kwon] Caught me! I didn't think about it much and thought 0 would be a viable candidate, but it's not obvious to me now. The field is {{nullable}} so...{{null}} is acceptable. I think it may be acceptable for end users (like me) when at least it's documented in the docs (or at least in scaladoc for {{agg}} or {{groupBy}} / {{groupByKey}}). It was weird to see {{null}} as a numeric value. > sum aggregate over empty Dataset gives null > ------------------------------------------- > > Key: SPARK-20346 > URL: https://issues.apache.org/jira/browse/SPARK-20346 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.2.0 > Reporter: Jacek Laskowski > Priority: Minor > > {code} > scala> spark.range(0).agg(sum("id")).show > +-------+ > |sum(id)| > +-------+ > | null| > +-------+ > scala> spark.range(0).agg(sum("id")).printSchema > root > |-- sum(id): long (nullable = true) > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org