Jackie-Jiang commented on code in PR #10704: URL: https://github.com/apache/pinot/pull/10704#discussion_r1204767490
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ComparisonColumns.java: ########## @@ -37,10 +38,45 @@ public int getComparableIndex() { return _comparableIndex; } + public int compareToSealed(ComparisonColumns other) { + /* + - iterate over all columns + - if any value in _values is greater than its counterpart in _other._values, keep _values as-is and return 1 + - if any value in _values is less than its counterpart in _other._values _and_ none are greater than their + counterpart in _other._values, keep _values as-is and return -1 + - i.e. no value in _this_ is greater than its counterpart in _other + - if all values between the two sets of Comparables are equal (compareTo == 0), keep _values as-is and return 0 + */ + int comparisonResult; + int accumResult = 0; + + for (int i = 0; i < _values.length; i++) { + Comparable comparisonValue = _values[i]; + Comparable otherComparisonValue = other.getValues()[i]; + if (otherComparisonValue == null) { + continue; + } else { + comparisonResult = comparisonValue.compareTo(otherComparisonValue); Review Comment: This can throw NPE when `comparisonValue` is `null` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org