| 456 | namespace { |
| 457 | |
| 458 | Status ValidateBatch(const RecordBatch& batch, bool full_validation) { |
| 459 | for (int i = 0; i < batch.num_columns(); ++i) { |
| 460 | RETURN_NOT_OK(ValidateColumnLength(batch, i)); |
| 461 | // See ValidateColumnLength about avoiding a ArrayData -> Array conversion |
| 462 | const auto& array = *batch.column_data(i); |
| 463 | const auto& schema_type = batch.schema()->field(i)->type(); |
| 464 | if (!array.type->Equals(schema_type)) { |
| 465 | return Status::Invalid("Column ", i, |
| 466 | " type not match schema: ", array.type->ToString(), " vs ", |
| 467 | schema_type->ToString()); |
| 468 | } |
| 469 | const auto st = full_validation ? internal::ValidateArrayFull(array) |
| 470 | : internal::ValidateArray(array); |
| 471 | if (!st.ok()) { |
| 472 | return Status::Invalid("In column ", i, ": ", st.ToString()); |
| 473 | } |
| 474 | } |
| 475 | return Status::OK(); |
| 476 | } |
| 477 | |
| 478 | } // namespace |
| 479 |
no test coverage detected