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

Method getUserFriendlyDiff

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

Source from the content-addressed store, hash-verified

721}
722
723std::string MaterializedRowEpsilonComparator::getUserFriendlyDiff(
724 const TypePtr& type) const {
725 BOLT_CHECK(
726 notEqual_, "This method must be called after compare() returned false.");
727
728 std::vector<MaterializedRow> extraRows;
729 std::vector<MaterializedRow> missingRows;
730 int32_t actualIndex = 0;
731 int32_t expectedIndex = 0;
732
733 while (expectedIndex < expectedSorted_.size() &&
734 actualIndex < actualSorted_.size()) {
735 const auto& expectedRow = expectedSorted_[expectedIndex];
736 const auto& actualRow = actualSorted_[actualIndex];
737 if (equalWithEpsilon(expectedRow, actualRow)) {
738 ++expectedIndex;
739 ++actualIndex;
740 } else if (lessThanWithEpsilon(expectedRow, actualRow)) {
741 missingRows.push_back(expectedRow);
742 ++expectedIndex;
743 } else {
744 extraRows.push_back(actualRow);
745 ++actualIndex;
746 }
747 }
748 for (; actualIndex < actualSorted_.size(); ++actualIndex) {
749 extraRows.push_back(actualSorted_[actualIndex]);
750 }
751 for (; expectedIndex < expectedSorted_.size(); ++expectedIndex) {
752 missingRows.push_back(expectedSorted_[expectedIndex]);
753 }
754
755 return makeErrorMessage(
756 missingRows,
757 extraRows,
758 expectedSorted_.size(),
759 actualSorted_.size(),
760 type);
761}
762
763bool MaterializedRowEpsilonComparator::equalKeys(
764 const MaterializedRow& left,

Callers 1

assertEqualResultsFunction · 0.80

Calls 3

makeErrorMessageFunction · 0.70
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected