| 134 | } |
| 135 | |
| 136 | int64_t Datum::null_count() const { |
| 137 | if (this->kind() == Datum::ARRAY) { |
| 138 | return std::get<std::shared_ptr<ArrayData>>(this->value)->GetNullCount(); |
| 139 | } else if (this->kind() == Datum::CHUNKED_ARRAY) { |
| 140 | return std::get<std::shared_ptr<ChunkedArray>>(this->value)->null_count(); |
| 141 | } else if (this->kind() == Datum::SCALAR) { |
| 142 | const auto& val = *std::get<std::shared_ptr<Scalar>>(this->value); |
| 143 | return val.is_valid ? 0 : 1; |
| 144 | } else { |
| 145 | DCHECK(false) << "This function only valid for array-like values"; |
| 146 | return 0; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | ArrayVector Datum::chunks() const { |
| 151 | if (!this->is_arraylike()) { |