| 297 | } |
| 298 | |
| 299 | inline Status ValidateShape(const std::vector<int64_t>& shape) const override { |
| 300 | ARROW_RETURN_NOT_OK(SparseIndex::ValidateShape(shape)); |
| 301 | |
| 302 | if (shape.size() < 2) { |
| 303 | return Status::Invalid("shape length is too short"); |
| 304 | } |
| 305 | |
| 306 | if (shape.size() > 2) { |
| 307 | return Status::Invalid("shape length is too long"); |
| 308 | } |
| 309 | |
| 310 | if (indptr_->shape()[0] == shape[static_cast<int64_t>(kCompressedAxis)] + 1) { |
| 311 | return Status::OK(); |
| 312 | } |
| 313 | |
| 314 | return Status::Invalid("shape length is inconsistent with the ", ToString()); |
| 315 | } |
| 316 | |
| 317 | protected: |
| 318 | std::shared_ptr<Tensor> indptr_; |