You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/12/09 09:30:47 UTC

[GitHub] [arrow] liyafan82 commented on a change in pull request #8876: ARROW-10860: [Java] Avoid integer overflow for generated classes in Vector

liyafan82 commented on a change in pull request #8876:
URL: https://github.com/apache/arrow/pull/8876#discussion_r539146792



##########
File path: java/vector/src/main/codegen/templates/UnionListWriter.java
##########
@@ -194,13 +194,13 @@ public void endList() {
   @Override
   public void startList() {
     vector.startNewValue(idx());
-    writer.setPosition(vector.getOffsetBuffer().getInt((idx() + 1) * OFFSET_WIDTH));
+    writer.setPosition(vector.getOffsetBuffer().getInt(((long) idx() + 1L) * OFFSET_WIDTH));

Review comment:
       nit: By adding 1L, the result of `idx()` is automatically cast to a long, so the explicit cast can be avoided?




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

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