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

Function AssertFirstLastIsNull

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

Source from the content-addressed store, hash-verified

1575
1576template <typename ArrowType>
1577class TestFirstLastKernel : public ::testing::Test {
1578 using Traits = TypeTraits<ArrowType>;
1579 using ArrayType = typename Traits::ArrayType;
1580 using c_type = typename ArrowType::c_type;
1581 using ScalarType = typename Traits::ScalarType;
1582
1583 public:
1584 void AssertFirstLastIs(const Datum& array, c_type expected_first, c_type expected_last,
1585 const ScalarAggregateOptions& options) {
1586 ASSERT_OK_AND_ASSIGN(Datum out, CallFunction("first", {array}, &options));
1587 const auto& out_first = out.scalar_as<ScalarType>();
1588 ASSERT_EQ(expected_first, out_first.value);
1589
1590 ASSERT_OK_AND_ASSIGN(out, CallFunction("last", {array}, &options));
1591 const auto& out_last = out.scalar_as<ScalarType>();
1592 ASSERT_EQ(expected_last, out_last.value);
1593 }
1594
1595 void AssertFirstLastIsNull(const Datum& array, const ScalarAggregateOptions& options) {
1596 ASSERT_OK_AND_ASSIGN(Datum out, First(array, options));
1597 const auto& out_first = out.scalar_as<ScalarType>();
1598 ASSERT_FALSE(out_first.is_valid);
1599
1600 ASSERT_OK_AND_ASSIGN(out, Last(array, options));
1601 const auto& out_last = out.scalar_as<ScalarType>();
1602 ASSERT_FALSE(out_last.is_valid);
1603 }
1604
1605 void AssertFirstLastIsNull(const std::string& json,
1606 const ScalarAggregateOptions& options) {

Callers

nothing calls this directly

Calls 5

LastFunction · 0.85
ArrayFromJSONFunction · 0.85
ChunkedArrayFromJSONFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
type_singletonFunction · 0.70

Tested by

no test coverage detected