bodduv commented on code in PR #1136:
URL: https://github.com/apache/arrow-java/pull/1136#discussion_r3201483168


##########
vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionLargeListReader.java:
##########
@@ -53,9 +53,24 @@ public boolean isSet() {
 
   @Override
   public void setPosition(int index) {
+    int valueCount = vector.getValueCount();
+    if (UnionListReaderBoundsChecker.isEmptyVectorPosition(index, valueCount)) 
{
+      setEmptyPosition(index);
+      return;
+    }
+
+    UnionListReaderBoundsChecker.checkIndex(index, valueCount);
+    UnionListReaderBoundsChecker.checkOffsetBuffer(vector.getOffsetBuffer(), 
index, OFFSET_WIDTH);
+
+    super.setPosition(index);
+    currentOffset = vector.getElementStartIndex(index) - 1;
+    maxOffset = vector.getElementEndIndex(index);
+  }
+
+  private void setEmptyPosition(int index) {
     super.setPosition(index);
-    currentOffset = vector.getOffsetBuffer().getLong((long) index * 
OFFSET_WIDTH) - 1;
-    maxOffset = vector.getOffsetBuffer().getLong(((long) index + 1L) * 
OFFSET_WIDTH);
+    currentOffset = 0;

Review Comment:
   I reworked this.



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

Reply via email to