| 122 | } |
| 123 | |
| 124 | Status Finalize(KernelContext* ctx, Datum* out) override { |
| 125 | const auto& state = checked_cast<const CountImpl&>(*ctx->state()); |
| 126 | switch (state.options.mode) { |
| 127 | case CountOptions::ONLY_VALID: |
| 128 | case CountOptions::ALL: |
| 129 | // ALL is equivalent since we don't count the null/non-null |
| 130 | // separately to avoid potentially computing null count |
| 131 | *out = Datum(state.non_nulls); |
| 132 | break; |
| 133 | case CountOptions::ONLY_NULL: |
| 134 | *out = Datum(state.nulls); |
| 135 | break; |
| 136 | default: |
| 137 | DCHECK(false) << "unreachable"; |
| 138 | } |
| 139 | return Status::OK(); |
| 140 | } |
| 141 | |
| 142 | CountOptions options; |
| 143 | int64_t non_nulls = 0; |
no test coverage detected