Check the requested capacity for validity
| 283 | |
| 284 | // Check the requested capacity for validity |
| 285 | Status CheckCapacity(int64_t new_capacity) { |
| 286 | if (ARROW_PREDICT_FALSE(new_capacity < 0)) { |
| 287 | return Status::Invalid( |
| 288 | "Resize capacity must be positive (requested: ", new_capacity, ")"); |
| 289 | } |
| 290 | |
| 291 | if (ARROW_PREDICT_FALSE(new_capacity < length_)) { |
| 292 | return Status::Invalid("Resize cannot downsize (requested: ", new_capacity, |
| 293 | ", current length: ", length_, ")"); |
| 294 | } |
| 295 | |
| 296 | return Status::OK(); |
| 297 | } |
| 298 | |
| 299 | // Check for array type |
| 300 | Status CheckArrayType(const std::shared_ptr<DataType>& expected_type, |