| 600 | explicit BooleanAllImpl(ScalarAggregateOptions options) : options(std::move(options)) {} |
| 601 | |
| 602 | Status Consume(KernelContext*, const ExecSpan& batch) override { |
| 603 | // short-circuit if seen a false already |
| 604 | if (this->all == false && this->count >= options.min_count) { |
| 605 | return Status::OK(); |
| 606 | } |
| 607 | // short-circuit if seen a null already |
| 608 | if (!options.skip_nulls && this->has_nulls) { |
| 609 | return Status::OK(); |
| 610 | } |
| 611 | if (batch[0].is_scalar()) { |
| 612 | const Scalar& scalar = *batch[0].scalar; |
| 613 | this->has_nulls |= !scalar.is_valid; |
| 614 | this->count += scalar.is_valid * batch.length; |
| 615 | this->all &= !scalar.is_valid || checked_cast<const BooleanScalar&>(scalar).value; |
| 616 | return Status::OK(); |
| 617 | } |
| 618 | const ArraySpan& data = batch[0].array; |
| 619 | this->has_nulls |= data.GetNullCount() > 0; |
| 620 | this->count += data.length - data.GetNullCount(); |
| 621 | arrow::internal::OptionalBinaryBitBlockCounter counter( |
| 622 | data.buffers[1].data, data.offset, data.buffers[0].data, data.offset, |
| 623 | data.length); |
| 624 | int64_t position = 0; |
| 625 | while (position < data.length) { |
| 626 | const auto block = counter.NextOrNotBlock(); |
| 627 | if (!block.AllSet()) { |
| 628 | this->all = false; |
| 629 | break; |
| 630 | } |
| 631 | position += block.length; |
| 632 | } |
| 633 | |
| 634 | return Status::OK(); |
| 635 | } |
| 636 | |
| 637 | Status MergeFrom(KernelContext*, KernelState&& src) override { |
| 638 | const auto& other = checked_cast<const BooleanAllImpl&>(src); |
nothing calls this directly
no test coverage detected