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

Function ValidateMinMax

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

Source from the content-addressed store, hash-verified

2380
2381template <typename ArrowType>
2382void ValidateMinMax(const Array& array, const ScalarAggregateOptions& options) {
2383 using Traits = TypeTraits<ArrowType>;
2384 using ScalarType = typename Traits::ScalarType;
2385
2386 ASSERT_OK_AND_ASSIGN(Datum out, MinMax(array, options));
2387 const StructScalar& value = out.scalar_as<StructScalar>();
2388
2389 auto expected = NaiveMinMax<ArrowType>(array);
2390 const auto& out_min = checked_cast<const ScalarType&>(*value.value[0]);
2391 const auto& out_max = checked_cast<const ScalarType&>(*value.value[1]);
2392
2393 if (expected.is_valid) {
2394 ASSERT_TRUE(out_min.is_valid);
2395 ASSERT_TRUE(out_max.is_valid);
2396 ASSERT_EQ(expected.min, out_min.value);
2397 ASSERT_EQ(expected.max, out_max.value);
2398 } else { // All null values
2399 ASSERT_FALSE(out_min.is_valid);
2400 ASSERT_FALSE(out_max.is_valid);
2401 }
2402}
2403
2404template <typename ArrowType>
2405class TestRandomNumericMinMaxKernel : public ::testing::Test {};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected