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