MCPcopy Create free account
hub / github.com/apache/arrow / TEST_F

Function TEST_F

cpp/src/arrow/compute/kernels/aggregate_test.cc:477–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475class TestSumKernelRoundOff : public ::testing::Test {};
476
477TEST_F(TestSumKernelRoundOff, Basics) {
478 using ScalarType = typename TypeTraits<DoubleType>::ScalarType;
479
480 // array = np.arange(321000, dtype='float64')
481 // array -= np.mean(array)
482 // array *= array
483 double index = 0;
484 ASSERT_OK_AND_ASSIGN(
485 auto array, ArrayFromBuilderVisitor(
486 float64(), 321000, [&](NumericBuilder<DoubleType>* builder) {
487 builder->UnsafeAppend((index - 160499.5) * (index - 160499.5));
488 ++index;
489 }));
490
491 // reference value from numpy.sum()
492 ASSERT_OK_AND_ASSIGN(Datum result, Sum(array));
493 auto sum = checked_cast<const ScalarType*>(result.scalar().get());
494 ASSERT_EQ(sum->value, 2756346749973250.0);
495}
496
497TEST(TestDecimalSumKernel, SimpleSum) {
498 std::vector<std::shared_ptr<DataType>> init_types = {decimal128(3, 2),

Callers

nothing calls this directly

Calls 15

month_intervalFunction · 0.85
day_time_intervalFunction · 0.85
month_day_nano_intervalFunction · 0.85
fixed_size_binaryFunction · 0.85
decimal256Function · 0.85
CheckFunction · 0.85
struct_Function · 0.85
ScalarFromJSONFunction · 0.85
MakeNullScalarFunction · 0.85
ResultWithFunction · 0.85
MakeScalarFunction · 0.85
WelfordVarFunction · 0.85

Tested by

no test coverage detected