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

Function CheckModes

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

Source from the content-addressed store, hash-verified

2865
2866template <typename CType>
2867void CheckModes(const Datum& array, const ModeOptions options,
2868 const std::vector<CType>& expected_modes,
2869 const std::vector<int64_t>& expected_counts) {
2870 ARROW_SCOPED_TRACE("Mode Options: ", options.ToString());
2871 ASSERT_OK_AND_ASSIGN(Datum out, Mode(array, options));
2872 ValidateOutput(out);
2873 const StructArray out_array(out.array());
2874 ASSERT_EQ(out_array.length(), expected_modes.size());
2875 ASSERT_EQ(out_array.num_fields(), 2);
2876
2877 const CType* out_modes = out_array.field(0)->data()->GetValues<CType>(1);
2878 const int64_t* out_counts = out_array.field(1)->data()->GetValues<int64_t>(1);
2879 for (int i = 0; i < out_array.length(); ++i) {
2880 // equal or nan equal
2881 ASSERT_TRUE((expected_modes[i] == out_modes[i]) ||
2882 (expected_modes[i] != expected_modes[i] && out_modes[i] != out_modes[i]))
2883 << " Actual Value: " << out_modes[i] << "\n"
2884 << "Expected Value: " << expected_modes[i];
2885 ASSERT_EQ(expected_counts[i], out_counts[i]);
2886 }
2887}
2888
2889template <>
2890void CheckModes<bool>(const Datum& array, const ModeOptions options,

Callers 1

AssertModesAreMethod · 0.85

Calls 8

ValidateOutputFunction · 0.85
ToStringMethod · 0.45
arrayMethod · 0.45
lengthMethod · 0.45
sizeMethod · 0.45
num_fieldsMethod · 0.45
dataMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected