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

Function CompareBatchWith

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

Source from the content-addressed store, hash-verified

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