ldudas-marx commented on code in PR #17121:
URL: https://github.com/apache/iceberg/pull/17121#discussion_r3537097806


##########
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedDeltaEncodedValuesReader.java:
##########


Review Comment:
   Nit: I noticed that valuesRead is always 0, so the code can be simplified 
here.



##########
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedDeltaEncodedValuesReader.java:
##########
@@ -166,7 +166,7 @@ private void readValues(
       currentRowId += loadedRows;
       remaining -= loadedRows;
     }
-    valuesRead = total - remaining;
+    valuesRead += total - remaining;

Review Comment:
   I think `remaining` is always 0 here. The while loop exit criteria ensures 
that it is non-positive. In`loadMiniBlockToOutput` `remaining` is an upper 
bound for the return value `loadedRows` so `remaining -= loadedRows` cannot be 
negative either.
   
   It could be only negative if `valuesRead = 0` and `total = 0`. In this case 
it throws an exception now because we try to write the first value to a zero 
size array. So even if it's a valid use it's buggy anyway. I would add a check 
or early return if `total` is 0 or less.



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