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

Function CompareBatchWith

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

Source from the content-addressed store, hash-verified

532
533template <typename CompareFunctor>
534void CompareBatchWith(const RecordBatch& left, const RecordBatch& right,
535 bool compare_metadata, CompareFunctor&& compare) {
536 if (!left.schema()->Equals(*right.schema(), compare_metadata)) {
537 FAIL() << "Left schema: " << left.schema()->ToString(compare_metadata)
538 << "\nRight schema: " << right.schema()->ToString(compare_metadata);
539 }
540 ASSERT_EQ(left.num_columns(), right.num_columns())
541 << left.schema()->ToString() << " result: " << right.schema()->ToString();
542 ASSERT_EQ(left.num_rows(), right.num_rows());
543 for (int i = 0; i < left.num_columns(); ++i) {
544 if (!compare(*left.column(i), *right.column(i))) {
545 std::stringstream ss;
546 ss << "Idx: " << i << " Name: " << left.column_name(i);
547 ss << std::endl << "Left: ";
548 ASSERT_OK(PrettyPrint(*left.column(i), 0, &ss));
549 ss << std::endl << "Right: ";
550 ASSERT_OK(PrettyPrint(*right.column(i), 0, &ss));
551 FAIL() << ss.str();
552 }
553 }
554}
555
556void CompareBatch(const RecordBatch& left, const RecordBatch& right,
557 bool compare_metadata, const EqualOptions& options) {

Callers 2

CompareBatchFunction · 0.85
ApproxCompareBatchFunction · 0.85

Calls 8

strMethod · 0.80
PrettyPrintFunction · 0.50
EqualsMethod · 0.45
schemaMethod · 0.45
ToStringMethod · 0.45
num_columnsMethod · 0.45
num_rowsMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected