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