MCPcopy Create free account
hub / github.com/bytedance/bolt / areEqual

Method areEqual

bolt/exec/tests/utils/QueryAssertions.cpp:832–860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

830}
831
832std::optional<bool> MaterializedRowEpsilonComparator::areEqual(
833 const MaterializedRowMultiset& expected,
834 const MaterializedRowMultiset& actual) {
835 BOLT_CHECK(!expected.empty());
836 BOLT_CHECK(!actual.empty());
837 BOLT_CHECK(equalTypeKinds(*expected.begin(), *actual.begin()));
838
839 if (!sortByUniqueKey(expected, actual)) {
840 return std::nullopt;
841 }
842
843 const auto numColumns = columns_.size();
844 const auto size = expectedSorted_.size();
845 if (size != actualSorted_.size()) {
846 notEqual_ = true;
847 return false;
848 }
849
850 // Compare row-by-row with epsilon.
851 for (auto i = 0; i < size; ++i) {
852 for (auto j = 0; j < numColumns; ++j) {
853 if (!expectedSorted_[i][j].equalsWithEpsilon(actualSorted_[i][j])) {
854 notEqual_ = true;
855 return false;
856 }
857 }
858 }
859 return true;
860}
861
862std::string generateUserFriendlyDiff(
863 const MaterializedRowMultiset& expectedRows,

Callers 2

assertEqualResultsFunction · 0.80
compareOrderedPartitionsFunction · 0.80

Calls 5

equalTypeKindsFunction · 0.85
equalsWithEpsilonMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected