| 477 | } |
| 478 | |
| 479 | Result<std::optional<std::string>> PrintArrayDiff(const ChunkedArray& expected, |
| 480 | const ChunkedArray& actual) { |
| 481 | if (actual.Equals(expected)) { |
| 482 | return std::nullopt; |
| 483 | } |
| 484 | |
| 485 | std::stringstream ss; |
| 486 | if (expected.length() != actual.length()) { |
| 487 | ss << "Expected length " << expected.length() << " but was actually " |
| 488 | << actual.length(); |
| 489 | return ss.str(); |
| 490 | } |
| 491 | |
| 492 | PrettyPrintOptions options(/*indent=*/2); |
| 493 | options.window = 50; |
| 494 | RETURN_NOT_OK(internal::ApplyBinaryChunked( |
| 495 | actual, expected, |
| 496 | [&](const Array& left_piece, const Array& right_piece, int64_t position) { |
| 497 | std::stringstream diff; |
| 498 | if (!left_piece.Equals(right_piece, EqualOptions().diff_sink(&diff))) { |
| 499 | ss << "Unequal at absolute position " << position << "\n" << diff.str(); |
| 500 | ss << "Expected:\n"; |
| 501 | ARROW_EXPECT_OK(PrettyPrint(right_piece, options, &ss)); |
| 502 | ss << "\nActual:\n"; |
| 503 | ARROW_EXPECT_OK(PrettyPrint(left_piece, options, &ss)); |
| 504 | } |
| 505 | return Status::OK(); |
| 506 | })); |
| 507 | return ss.str(); |
| 508 | } |
| 509 | |
| 510 | void AssertTablesEqual(const Table& expected, const Table& actual, bool same_chunk_layout, |
| 511 | bool combine_chunks, const EqualOptions& options) { |
no test coverage detected