MCPcopy Create free account
hub / github.com/apache/arrow / PrintArrayDiff

Function PrintArrayDiff

cpp/src/arrow/testing/gtest_util.cc:475–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

TEST_FFunction · 0.85

Calls 7

ApplyBinaryChunkedFunction · 0.85
EqualOptionsClass · 0.85
strMethod · 0.80
PrettyPrintFunction · 0.50
OKFunction · 0.50
EqualsMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected