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

Function compareMaterializedRows

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

Compare left and right without epsilon and returns true if they are equal.

Source from the content-addressed store, hash-verified

1016 for (const auto& vector : results) {
1017 totalCount += vector->size();
1018 }
1019 EXPECT_EQ(0, totalCount) << "Expected empty result but received "
1020 << totalCount << " rows";
1021}
1022
1023// Compare left and right without epsilon and returns true if they are equal.
1024static bool compareMaterializedRows(
1025 const MaterializedRowMultiset& left,
1026 const MaterializedRowMultiset& right) {
1027 if (left.size() != right.size()) {
1028 return false;
1029 }
1030
1031 for (auto& it : left) {
1032 if (right.count(it) != left.count(it)) {
1033 return false;
1034 }
1035 }
1036
1037 // In case left has duplicate values and there are values in right but not in
1038 // left, check the other way around. E.g., left = {1, 1, 2}, right = {1, 2,
1039 // 3}.
1040 for (auto& it : right) {
1041 if (left.count(it) != right.count(it)) {
1042 return false;
1043 }
1044 }

Callers 2

assertEqualResultsFunction · 0.85
compareOrderedPartitionsFunction · 0.85

Calls 2

sizeMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected