You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/06/18 14:34:25 UTC
[GitHub] [arrow] pitrou commented on a change in pull request #7478: ARROW-9055: [C++] Add sum/mean kernels for Boolean type
pitrou commented on a change in pull request #7478:
URL: https://github.com/apache/arrow/pull/7478#discussion_r442274099
##########
File path: cpp/src/arrow/compute/kernels/aggregate_test.cc
##########
@@ -127,6 +127,41 @@ void ValidateSum(const Array& array) {
ValidateSum<ArrowType>(array, NaiveSum<ArrowType>(array));
}
+using UnaryOp = Result<Datum>(const Datum&, ExecContext*);
+
+template <UnaryOp& Op, typename ScalarType>
+void ValidateBooleanAgg(const std::string& json,
+ const std::shared_ptr<ScalarType>& expected) {
+ auto array = ArrayFromJSON(boolean(), json);
+ auto exp = Datum(expected);
+ ASSERT_OK_AND_ASSIGN(Datum result, Op(array, nullptr));
+ ASSERT_TRUE(result.Equals(exp));
+}
+
+TEST(TestBooleanAggregation, Sum) {
+ ValidateBooleanAgg<Sum>("[]", std::make_shared<UInt64Scalar>());
Review comment:
Why isn't it 0 here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org