You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/06/10 08:24:58 UTC

[GitHub] [pinot] richardstartin commented on a diff in pull request #8879: [Draft] extract sort fields into a temp file for better data locality for sorting

richardstartin commented on code in PR #8879:
URL: https://github.com/apache/pinot/pull/8879#discussion_r894281662


##########
pinot-core/src/main/java/org/apache/pinot/core/segment/processing/genericrow/GenericRowFileReader.java:
##########
@@ -77,6 +133,13 @@ public void read(int rowId, GenericRow buffer) {
    * Compares the rows at the given row ids. Only compare the values for the sort fields.
    */
   public int compare(int rowId1, int rowId2) {
+    // Sort with the extracted sort fields for better data locality.
+    if (_sortFieldsOffsetBuffer != null) {
+      long offset1 = _sortFieldsOffsetBuffer.getLong((long) rowId1 << 3); // rowId1 * Long.BYTES
+      long offset2 = _sortFieldsOffsetBuffer.getLong((long) rowId2 << 3); // rowId2 * Long.BYTES

Review Comment:
   because `Long.BYTES` is a constant (it is `static final`) `* Long.BYTES` will get strength reduced to `<< 3` anyway.



-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org