[ 
https://issues.apache.org/jira/browse/ARROW-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16214859#comment-16214859
 ] 

ASF GitHub Bot commented on ARROW-1474:
---------------------------------------

siddharthteotia commented on a change in pull request #1203: ARROW-1474:[WIP] 
Java Vector Refactor (Implementation Phase 2)
URL: https://github.com/apache/arrow/pull/1203#discussion_r146209120
 
 

 ##########
 File path: 
java/vector/src/main/java/org/apache/arrow/vector/complex/BaseRepeatedValueVector.java
 ##########
 @@ -187,54 +227,58 @@ protected void replaceDataVector(FieldVector v) {
     vector = v;
   }
 
-  public abstract class BaseRepeatedAccessor extends 
BaseValueVector.BaseAccessor implements RepeatedAccessor {
 
-    @Override
-    public int getValueCount() {
-      return Math.max(offsets.getAccessor().getValueCount() - 1, 0);
-    }
+  @Override
+  public int getValueCount() {
+    return valueCount;
+  }
 
-    @Override
-    public int getInnerValueCount() {
-      return vector.getAccessor().getValueCount();
-    }
+  /* returns the value count for inner data vector for this list vector */
+  public int getInnerValueCount() {
+    return vector.getValueCount();
+  }
 
-    @Override
-    public int getInnerValueCountAt(int index) {
-      return offsets.getAccessor().get(index + 1) - 
offsets.getAccessor().get(index);
-    }
 
-    @Override
-    public boolean isNull(int index) {
-      return false;
-    }
+  /* returns the value count for inner data vector at a particular index */
+  public int getInnerValueCountAt(int index) {
+    return offsetBuffer.getInt((index + 1) * OFFSET_WIDTH) -
+            offsetBuffer.getInt(index * OFFSET_WIDTH);
+  }
 
-    @Override
-    public boolean isEmpty(int index) {
-      return false;
-    }
+  public boolean isNull(int index) {
+    return false;
   }
 
-  public abstract class BaseRepeatedMutator extends 
BaseValueVector.BaseMutator implements RepeatedMutator {
+  public boolean isEmpty(int index) {
+    return false;
+  }
 
-    @Override
-    public int startNewValue(int index) {
-      while (offsets.getValueCapacity() <= index) {
-        offsets.reAlloc();
-      }
-      int offset = offsets.getAccessor().get(index);
-      offsets.getMutator().setSafe(index + 1, offset);
-      setValueCount(index + 1);
-      return offset;
+  public int startNewValue(int index) {
+    while (index >= getOffsetBufferValueCapacity()) {
+      reallocOffsetBuffer();
     }
+    int offset = offsetBuffer.getInt(index * OFFSET_WIDTH);
+    offsetBuffer.setInt((index + 1) * OFFSET_WIDTH, offset);
+    setValueCount(index + 1);
+    return offset;
+  }
 
-    @Override
-    public void setValueCount(int valueCount) {
-      // TODO: populate offset end points
-      offsets.getMutator().setValueCount(valueCount == 0 ? 0 : valueCount + 1);
-      final int childValueCount = valueCount == 0 ? 0 : 
offsets.getAccessor().get(valueCount);
-      vector.getMutator().setValueCount(childValueCount);
+  public void setValueCount(int valueCount) {
+    // TODO: populate offset end points
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [JAVA] ValueVector hierarchy (Implementation Phase 2)
> -----------------------------------------------------
>
>                 Key: ARROW-1474
>                 URL: https://issues.apache.org/jira/browse/ARROW-1474
>             Project: Apache Arrow
>          Issue Type: Sub-task
>            Reporter: Jacques Nadeau
>            Assignee: Siddharth Teotia
>              Labels: pull-request-available
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to