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

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

icexelloss commented on a change in pull request #1316: ARROW-1476: [JAVA] 
Implement Final ValueVector Updates
URL: https://github.com/apache/arrow/pull/1316#discussion_r151150694
 
 

 ##########
 File path: 
java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java
 ##########
 @@ -363,86 +481,114 @@ public UnionVector promoteToUnion() {
     return vector;
   }
 
-  private int lastSet = 0;
+  @Override
+  public Object getObject(int index) {
+    if (isSet(index) == 0) {
+      return null;
+    }
+    final List<Object> vals = new JsonStringArrayList<>();
+    final int start = offsetBuffer.getInt(index * OFFSET_WIDTH);
+    final int end = offsetBuffer.getInt((index + 1) * OFFSET_WIDTH);
+    final ValueVector vv = getDataVector();
+    for (int i = start; i < end; i++) {
+      vals.add(vv.getObject(i));
+    }
 
-  public class Accessor extends BaseRepeatedAccessor {
+    return vals;
+  }
 
-    @Override
-    public Object getObject(int index) {
-      if (isNull(index)) {
-        return null;
-      }
-      final List<Object> vals = new JsonStringArrayList<>();
-      final UInt4Vector.Accessor offsetsAccessor = offsets.getAccessor();
-      final int start = offsetsAccessor.get(index);
-      final int end = offsetsAccessor.get(index + 1);
-      final ValueVector.Accessor valuesAccessor = 
getDataVector().getAccessor();
-      for (int i = start; i < end; i++) {
-        vals.add(valuesAccessor.getObject(i));
-      }
-      return vals;
-    }
+  @Override
+  public boolean isNull(int index) {
+    return (isSet(index) == 0);
+  }
 
-    @Override
-    public boolean isNull(int index) {
-      return bits.getAccessor().get(index) == 0;
-    }
+  public int isSet(int index) {
+    final int byteIndex = index >> 3;
+    final byte b = validityBuffer.getByte(byteIndex);
+    final int bitIndex = index & 7;
+    return Long.bitCount(b & (1L << bitIndex));
+  }
 
-    @Override
-    public int getNullCount() {
-      return bits.getAccessor().getNullCount();
-    }
+  @Override
+  public int getNullCount() {
+    return BitVectorHelper.getNullCount(validityBuffer, valueCount);
   }
 
-  public class Mutator extends BaseRepeatedMutator {
-    public void setNotNull(int index) {
-      bits.getMutator().setSafe(index, 1);
-      lastSet = index + 1;
-    }
+  @Override
+  public int getValueCapacity() {
+    return Math.min(getValidityBufferValueCapacity(), 
super.getValueCapacity());
+  }
 
-    @Override
-    public int startNewValue(int index) {
-      for (int i = lastSet; i <= index; i++) {
-        offsets.getMutator().setSafe(i + 1, offsets.getAccessor().get(i));
-      }
-      setNotNull(index);
-      lastSet = index + 1;
-      return offsets.getAccessor().get(lastSet);
-    }
+  public int getValidityAndOffsetValueCapacity() {
 
 Review comment:
   @siddharthteotia I think we want to make this private, is that correct?

----------------------------------------------------------------
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:
[email protected]


> [JAVA] Implement final ValueVector updates
> ------------------------------------------
>
>                 Key: ARROW-1476
>                 URL: https://issues.apache.org/jira/browse/ARROW-1476
>             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