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

Function AssertFirstLastIsNull

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

Source from the content-addressed store, hash-verified

1615
1616template <typename ArrowType>
1617class TestFirstLastKernel : public ::testing::Test {
1618 using Traits = TypeTraits<ArrowType>;
1619 using ArrayType = typename Traits::ArrayType;
1620 using c_type = typename ArrowType::c_type;
1621 using ScalarType = typename Traits::ScalarType;
1622
1623 public:
1624 void AssertFirstLastIs(const Datum& array, c_type expected_first, c_type expected_last,
1625 const ScalarAggregateOptions& options) {
1626 ASSERT_OK_AND_ASSIGN(Datum out, CallFunction("first", {array}, &options));
1627 const auto& out_first = out.scalar_as<ScalarType>();
1628 ASSERT_EQ(expected_first, out_first.value);
1629
1630 ASSERT_OK_AND_ASSIGN(out, CallFunction("last", {array}, &options));
1631 const auto& out_last = out.scalar_as<ScalarType>();
1632 ASSERT_EQ(expected_last, out_last.value);
1633 }
1634
1635 void AssertFirstLastIsNull(const Datum& array, const ScalarAggregateOptions& options) {
1636 ASSERT_OK_AND_ASSIGN(Datum out, First(array, options));
1637 const auto& out_first = out.scalar_as<ScalarType>();
1638 ASSERT_FALSE(out_first.is_valid);
1639
1640 ASSERT_OK_AND_ASSIGN(out, Last(array, options));
1641 const auto& out_last = out.scalar_as<ScalarType>();
1642 ASSERT_FALSE(out_last.is_valid);
1643 }
1644
1645 void AssertFirstLastIsNull(const std::string& json,
1646 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