[ 
https://issues.apache.org/jira/browse/SPARK-5680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14587473#comment-14587473
 ] 

Venkata Ramana G commented on SPARK-5680:
-----------------------------------------

Holman, You are right that column with all NULL values should return NULL.
As my motivation was to fix udaf_number_format.q, "select sum('a') from src" 
returns 0 in hive, mysql.
 and "select cast('a' as double) from src" returned NULL in hive.
I assumed or rather wrongly analysed it as "Sum of ALL NULLs return 0" and this 
has introduced the problem.
I apologize for this and will submit the patch to revert that fix. 

"select sum('a') from src" returning 0 in hive and mysql created this 
confusion, is still not clear.


> Sum function on all null values, should return zero
> ---------------------------------------------------
>
>                 Key: SPARK-5680
>                 URL: https://issues.apache.org/jira/browse/SPARK-5680
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Venkata Ramana G
>            Assignee: Venkata Ramana G
>            Priority: Minor
>             Fix For: 1.3.1, 1.4.0
>
>
> SELECT  sum('a'),  avg('a'),  variance('a'),  std('a') FROM src;
> Current output:
> NULL  NULL    NULL    NULL
> Expected output:
> 0.0   NULL    NULL    NULL
> This fixes hive udaf_number_format.q 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to