Check the requested capacity for validity
| 273 | |
| 274 | // Check the requested capacity for validity |
| 275 | Status CheckCapacity(int64_t new_capacity) { |
| 276 | if (ARROW_PREDICT_FALSE(new_capacity < 0)) { |
| 277 | return Status::Invalid( |
| 278 | "Resize capacity must be positive (requested: ", new_capacity, ")"); |
| 279 | } |
| 280 | |
| 281 | if (ARROW_PREDICT_FALSE(new_capacity < length_)) { |
| 282 | return Status::Invalid("Resize cannot downsize (requested: ", new_capacity, |
| 283 | ", current length: ", length_, ")"); |
| 284 | } |
| 285 | |
| 286 | return Status::OK(); |
| 287 | } |
| 288 | |
| 289 | // Check for array type |
| 290 | Status CheckArrayType(const std::shared_ptr<DataType>& expected_type, |