| 260 | namespace { |
| 261 | |
| 262 | Status ValidateChunks(const ArrayVector& chunks, bool full_validation) { |
| 263 | if (chunks.size() == 0) { |
| 264 | return Status::OK(); |
| 265 | } |
| 266 | |
| 267 | const auto& type = *chunks[0]->type(); |
| 268 | // Make sure chunks all have the same type |
| 269 | for (size_t i = 1; i < chunks.size(); ++i) { |
| 270 | const Array& chunk = *chunks[i]; |
| 271 | if (!chunk.type()->Equals(type)) { |
| 272 | return Status::Invalid("In chunk ", i, " expected type ", type.ToString(), |
| 273 | " but saw ", chunk.type()->ToString()); |
| 274 | } |
| 275 | } |
| 276 | // Validate the chunks themselves |
| 277 | for (size_t i = 0; i < chunks.size(); ++i) { |
| 278 | const Array& chunk = *chunks[i]; |
| 279 | const Status st = full_validation ? internal::ValidateArrayFull(chunk) |
| 280 | : internal::ValidateArray(chunk); |
| 281 | if (!st.ok()) { |
| 282 | return Status::Invalid("In chunk ", i, ": ", st.ToString()); |
| 283 | } |
| 284 | } |
| 285 | return Status::OK(); |
| 286 | } |
| 287 | |
| 288 | } // namespace |
| 289 |
no test coverage detected