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/20 19:41:54 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #8926: reduce positioning operation to single operation

Jackie-Jiang commented on code in PR #8926:
URL: https://github.com/apache/pinot/pull/8926#discussion_r901961005


##########
pinot-core/src/main/java/org/apache/pinot/core/common/datablock/BaseDataBlock.java:
##########
@@ -221,7 +221,7 @@ public BaseDataBlock(ByteBuffer byteBuffer)
    * @param colId column ID
    * @return the length to extract from variable size buffer.
    */
-  protected abstract int positionCursorInVariableBuffer(int rowId, int colId);
+  protected abstract int computePositionCursorInVariableBuffer(int rowId, int colId);

Review Comment:
   Don't change this method name. It does not return the offset, but actually position the cursor



##########
pinot-core/src/main/java/org/apache/pinot/core/common/datatable/BaseDataTable.java:
##########
@@ -158,26 +158,22 @@ public int getNumberOfRows() {
 
   @Override
   public int getInt(int rowId, int colId) {
-    _fixedSizeData.position(rowId * _rowSizeInBytes + _columnOffsets[colId]);
-    return _fixedSizeData.getInt();
+    return _fixedSizeData.getInt(rowId * _rowSizeInBytes + _columnOffsets[colId]);
   }
 
   @Override
   public long getLong(int rowId, int colId) {
-    _fixedSizeData.position(rowId * _rowSizeInBytes + _columnOffsets[colId]);
-    return _fixedSizeData.getLong();
+    return _fixedSizeData.getLong(rowId * _rowSizeInBytes + _columnOffsets[colId]);
   }
 
   @Override
   public float getFloat(int rowId, int colId) {
-    _fixedSizeData.position(rowId * _rowSizeInBytes + _columnOffsets[colId]);
-    return _fixedSizeData.getFloat();
+    return _fixedSizeData.getFloat(rowId * _rowSizeInBytes + _columnOffsets[colId]);
   }
 
   @Override
   public double getDouble(int rowId, int colId) {
-    _fixedSizeData.position(rowId * _rowSizeInBytes + _columnOffsets[colId]);
-    return _fixedSizeData.getDouble();
+    return _fixedSizeData.getDouble(rowId * _rowSizeInBytes + _columnOffsets[colId]);
   }
 
   @Override

Review Comment:
   Let's also fix the `getString()`



##########
pinot-core/src/main/java/org/apache/pinot/core/common/datablock/BaseDataBlock.java:
##########
@@ -211,7 +211,7 @@ public BaseDataBlock(ByteBuffer byteBuffer)
    * @param rowId row ID
    * @param colId column ID
    */
-  protected abstract void positionCursorInFixSizedBuffer(int rowId, int colId);
+  protected abstract int computePositionCursorInFixSizedBuffer(int rowId, int colId);

Review Comment:
   Suggest renaming it to `getOffsetInFixedBuffer`



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