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

Function PrintArrayDiff

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

Source from the content-addressed store, hash-verified

477}
478
479Result<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
510void AssertTablesEqual(const Table& expected, const Table& actual, bool same_chunk_layout,
511 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