Copilot commented on code in PR #19163:
URL: https://github.com/apache/pinot/pull/19163#discussion_r3723179709
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/realtime/converter/stats/MutableColumnStatistics.java:
##########
@@ -112,6 +123,12 @@ public boolean isSorted() {
return false;
}
+ // A single distinct value is always sorted — no scan needed. Cardinality
cannot be 0 here because the segment is
+ // non-empty and every document of a dictionary-encoded column has a dict
id.
+ if (getCardinality() == 1) {
+ return true;
+ }
+
Review Comment:
When scanning to determine sortedness, avoid calling Dictionary.compare when
the dict id repeats. For string dictionaries this can materialize Strings per
doc; checking `currentDictId != previousDictId` first is equivalent and much
cheaper on long runs of the same value.
This issue also appears on line 126 of the same file.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]