clintropolis commented on code in PR #13854:
URL: https://github.com/apache/druid/pull/13854#discussion_r1136426777


##########
processing/src/main/java/org/apache/druid/segment/data/FrontCodedIndexed.java:
##########
@@ -509,4 +539,177 @@ private static ByteBuffer[] readBucket(ByteBuffer bucket, 
int numValues)
     }
     return bucketBuffers;
   }
+
+  /**
+   * Finds a value in a bucket among the fragments. The first value is assumed 
to have been already compared against
+   * and be smaller than the value we are looking for. This comparison is the 
source of the 'shared prefix', which is
+   * the length which the value has in common with the previous value of the 
bucket.
+   * <p>
+   * This method uses this shared prefix length to skip more expensive byte by 
byte full value comparisons when
+   * possible by comparing the shared prefix length with the prefix length of 
the fragment. Since the bucket is always
+   * sorted, prefix lengths shrink as you progress to higher indexes, and we 
can use this to reason that a fragment
+   * with a longer prefix length than the shared prefix will always sort 
before the value we are looking for, and values
+   * which have a shorter prefix will always be greater than the value we are 
looking for, so we only need to do a
+   * full comparison if the prefix length is the same

Review Comment:
   oops, this javadoc needs adjusted, but i will just do this on a later PR



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