Check that ValueCounts() accepts a 0-length array with null buffers
| 72 | |
| 73 | // Check that ValueCounts() accepts a 0-length array with null buffers |
| 74 | void 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 | |
| 91 | template <typename T> |
| 92 | void CheckValueCounts(const std::shared_ptr<T>& input, |
no test coverage detected