| 165 | : options(std::move(options)), memo_table_(new MemoTable(memory_pool, 0)) {} |
| 166 | |
| 167 | Status Consume(KernelContext*, const ExecSpan& batch) override { |
| 168 | if (batch[0].is_array()) { |
| 169 | const ArraySpan& arr = batch[0].array; |
| 170 | this->has_nulls = arr.GetNullCount() > 0; |
| 171 | |
| 172 | auto visit_null = []() { return Status::OK(); }; |
| 173 | auto visit_value = [&](VisitorArgType arg) { |
| 174 | int32_t y; |
| 175 | return memo_table_->GetOrInsert(arg, &y); |
| 176 | }; |
| 177 | RETURN_NOT_OK(VisitArraySpanInline<Type>(arr, visit_value, visit_null)); |
| 178 | } else { |
| 179 | const Scalar& input = *batch[0].scalar; |
| 180 | this->has_nulls = !input.is_valid; |
| 181 | |
| 182 | if (input.is_valid) { |
| 183 | int32_t unused; |
| 184 | RETURN_NOT_OK(memo_table_->GetOrInsert(UnboxScalar<Type>::Unbox(input), &unused)); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | this->non_nulls = memo_table_->size(); |
| 189 | return Status::OK(); |
| 190 | } |
| 191 | |
| 192 | Status MergeFrom(KernelContext*, KernelState&& src) override { |
| 193 | const auto& other_state = checked_cast<const CountDistinctImpl&>(src); |
nothing calls this directly
no test coverage detected