Adam Hooper created ARROW-12911:
-----------------------------------
Summary: sum of zero rows gives null; should give 0
Key: ARROW-12911
URL: https://issues.apache.org/jira/browse/ARROW-12911
Project: Apache Arrow
Issue Type: Bug
Components: C++, Python
Affects Versions: 4.0.1
Reporter: Adam Hooper
{code}
>>> pa.compute.sum(pa.array([], pa.int64()))
<pyarrow.Int64Scalar: None>
{code}
I'd expect 0.
I can't think of any reason for NULL, except that SQL returns NULL. But I can't
figure out why SQL returns NULL. Does anybody know? Any textbook -- and
https://en.wikipedia.org/wiki/Summation -- specifies 0.
Pandas and Numpy return 0. Also, Apache Arrow c_glib implementation returns 0
-- and even tests for it:
https://github.com/apache/arrow/blob/master/c_glib/test/test-int8-array.rb#L60
--
This message was sent by Atlassian Jira
(v8.3.4#803005)