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

Function CompareBatchWith

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

Source from the content-addressed store, hash-verified

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