| 721 | } |
| 722 | |
| 723 | std::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 | |
| 763 | bool MaterializedRowEpsilonComparator::equalKeys( |
| 764 | const MaterializedRow& left, |
no test coverage detected