| 229 | // Filter tests |
| 230 | |
| 231 | std::shared_ptr<Array> CoalesceNullToFalse(std::shared_ptr<Array> filter) { |
| 232 | const bool is_ree = filter->type_id() == Type::RUN_END_ENCODED; |
| 233 | // Work directly on run values array in case of REE |
| 234 | const ArrayData& data = is_ree ? *filter->data()->child_data[1] : *filter->data(); |
| 235 | if (data.GetNullCount() == 0) { |
| 236 | return filter; |
| 237 | } |
| 238 | auto is_true = std::make_shared<BooleanArray>(data.length, data.buffers[1], nullptr, 0, |
| 239 | data.offset); |
| 240 | auto is_valid = std::make_shared<BooleanArray>(data.length, data.buffers[0], nullptr, 0, |
| 241 | data.offset); |
| 242 | EXPECT_OK_AND_ASSIGN(Datum out_datum, And(is_true, is_valid)); |
| 243 | if (is_ree) { |
| 244 | const auto& ree_filter = checked_cast<const RunEndEncodedArray&>(*filter); |
| 245 | EXPECT_OK_AND_ASSIGN( |
| 246 | auto new_ree_filter, |
| 247 | RunEndEncodedArray::Make(ree_filter.length(), ree_filter.run_ends(), |
| 248 | /*values=*/out_datum.make_array(), ree_filter.offset())); |
| 249 | return new_ree_filter; |
| 250 | } |
| 251 | return out_datum.make_array(); |
| 252 | } |
| 253 | |
| 254 | class TestFilterKernel : public ::testing::Test { |
| 255 | protected: |
no test coverage detected