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

Function PrintArrayDiff

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

Source from the content-addressed store, hash-verified

469}
470
471Result<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
502void AssertTablesEqual(const Table& expected, const Table& actual, bool same_chunk_layout,
503 bool combine_chunks, const EqualOptions& options) {

Callers 1

TEST_FFunction · 0.85

Calls 8

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

Tested by

no test coverage detected