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

Function CheckValueCountsNull

cpp/src/arrow/compute/kernels/vector_hash_test.cc:74–89  ·  view source on GitHub ↗

Check that ValueCounts() accepts a 0-length array with null buffers

Source from the content-addressed store, hash-verified

72
73// Check that ValueCounts() accepts a 0-length array with null buffers
74void CheckValueCountsNull(const std::shared_ptr<DataType>& type) {
75 std::vector<std::shared_ptr<Buffer>> data_buffers(2);
76 Datum input;
77 input.value =
78 ArrayData::Make(type, 0 /* length */, std::move(data_buffers), 0 /* null_count */);
79
80 std::shared_ptr<Array> ex_values = ArrayFromJSON(type, "[]");
81 std::shared_ptr<Array> ex_counts = ArrayFromJSON(int64(), "[]");
82
83 ASSERT_OK_AND_ASSIGN(auto result_struct, ValueCounts(input));
84 ValidateOutput(*result_struct);
85 ASSERT_NE(result_struct->GetFieldByName(kValuesFieldName), nullptr);
86 // TODO: We probably shouldn't rely on value ordering.
87 ASSERT_ARRAYS_EQUAL(*ex_values, *result_struct->GetFieldByName(kValuesFieldName));
88 ASSERT_ARRAYS_EQUAL(*ex_counts, *result_struct->GetFieldByName(kCountsFieldName));
89}
90
91template <typename T>
92void CheckValueCounts(const std::shared_ptr<T>& input,

Callers 1

TYPED_TESTFunction · 0.85

Calls 4

ArrayFromJSONFunction · 0.85
ValidateOutputFunction · 0.85
MakeFunction · 0.50
GetFieldByNameMethod · 0.45

Tested by

no test coverage detected