| 248 | namespace { |
| 249 | |
| 250 | Status ValidateChunks(const ArrayVector& chunks, bool full_validation) { |
| 251 | if (chunks.size() == 0) { |
| 252 | return Status::OK(); |
| 253 | } |
| 254 | |
| 255 | const auto& type = *chunks[0]->type(); |
| 256 | // Make sure chunks all have the same type |
| 257 | for (size_t i = 1; i < chunks.size(); ++i) { |
| 258 | const Array& chunk = *chunks[i]; |
| 259 | if (!chunk.type()->Equals(type)) { |
| 260 | return Status::Invalid("In chunk ", i, " expected type ", type.ToString(), |
| 261 | " but saw ", chunk.type()->ToString()); |
| 262 | } |
| 263 | } |
| 264 | // Validate the chunks themselves |
| 265 | for (size_t i = 0; i < chunks.size(); ++i) { |
| 266 | const Array& chunk = *chunks[i]; |
| 267 | const Status st = full_validation ? internal::ValidateArrayFull(chunk) |
| 268 | : internal::ValidateArray(chunk); |
| 269 | if (!st.ok()) { |
| 270 | return Status::Invalid("In chunk ", i, ": ", st.ToString()); |
| 271 | } |
| 272 | } |
| 273 | return Status::OK(); |
| 274 | } |
| 275 | |
| 276 | } // namespace |
| 277 |
no test coverage detected