xiangfu0 commented on code in PR #19795:
URL: https://github.com/apache/pinot/pull/19795#discussion_r4221356963


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/customobject/PercentileTDigestAccumulator.java:
##########
@@ -1041,22 +986,40 @@ private void ensureIncomingCapacity(int capacity) {
   private void ensureIncomingSortCapacity(int capacity) {
     ensureSortedIncomingCapacity(capacity);
     if (_incomingOrder == null || capacity > _incomingOrder.length) {
-      int newCapacity = _incomingOrder == null ? Math.max(capacity, 
_centroidCapacity)
+      int newCapacity = _incomingOrder == null
+          ? Math.max(capacity, Math.min(_centroidCapacity, 
_pendingCentroidCapacity))
           : Math.max(capacity, Math.multiplyExact(_incomingOrder.length, 2));
       _incomingOrder = new int[newCapacity];
     }
   }
 
+  private void stableSortIncoming(int count) {

Review Comment:
   Replaced the index-array/lambda sort with stable primitive mean/weight pair 
merges using the existing scratch arrays. The order array, identity 
initialization and gather pass are gone; regressions verify equal-mean order 
and weight pairing across successive flushes.
   
   Addressed in 
[6246a60b4b](https://github.com/apache/pinot/commit/6246a60b4bdbaf59deb89986d2644a41178e1a89).
 All 483 targeted tests and both legacy-reader checks pass.



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/customobject/PercentileTDigestAccumulator.java:
##########
@@ -640,8 +632,13 @@ public int byteSize() {
 
   @Override
   public int smallByteSize() {
+    if (_legacyDegraded) {

Review Comment:
   Documented the encoding contract on both small-byte methods and the SPI: 
degraded state preserves untouched original bytes, then uses canonical verbose 
bytes after mutation. Callers must inspect the encoding identifier; precise 
poisoned values and weights are retained.
   
   Addressed in 
[6246a60b4b](https://github.com/apache/pinot/commit/6246a60b4bdbaf59deb89986d2644a41178e1a89).
 All 483 targeted tests and both legacy-reader checks pass.



-- 
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]

Reply via email to