You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/04/15 22:26:25 UTC
arrow git commit: ARROW-703: Fix issue where setValueCount(0) doesn’t work in the case that we’ve shipped vectors across the wire
Repository: arrow
Updated Branches:
refs/heads/master 0f9c88f71 -> 30e03a907
ARROW-703: Fix issue where setValueCount(0) doesn\u2019t work in the case that we\u2019ve shipped vectors across the wire
Author: Julien Le Dem <ju...@dremio.com>
Closes #428 from julienledem/arrow_703 and squashes the following commits:
72b0f79 [Julien Le Dem] ARROW-703: Fix issue where setValueCount(0) doesn\u2019t work in the case that we\u2019ve shipped vectors across the wire
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/30e03a90
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/30e03a90
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/30e03a90
Branch: refs/heads/master
Commit: 30e03a90718971c2a1d773145fb042d0c2857036
Parents: 0f9c88f
Author: Julien Le Dem <ju...@dremio.com>
Authored: Sat Apr 15 18:26:19 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Sat Apr 15 18:26:19 2017 -0400
----------------------------------------------------------------------
.../templates/VariableLengthVectors.java | 23 ++++++++++++--------
1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/30e03a90/java/vector/src/main/codegen/templates/VariableLengthVectors.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/VariableLengthVectors.java b/java/vector/src/main/codegen/templates/VariableLengthVectors.java
index bcd639a..4a460c5 100644
--- a/java/vector/src/main/codegen/templates/VariableLengthVectors.java
+++ b/java/vector/src/main/codegen/templates/VariableLengthVectors.java
@@ -613,16 +613,21 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
@Override
public void setValueCount(int valueCount) {
- final int currentByteCapacity = getByteCapacity();
- final int idx = offsetVector.getAccessor().get(valueCount);
- data.writerIndex(idx);
- if (valueCount > 0 && currentByteCapacity > idx * 2) {
- incrementAllocationMonitor();
- } else if (allocationMonitor > 0) {
- allocationMonitor = 0;
+ if (valueCount == 0) {
+ // if no values in vector, don't try to retrieve the current value count.
+ offsetVector.getMutator().setValueCount(0);
+ } else {
+ final int currentByteCapacity = getByteCapacity();
+ final int idx = offsetVector.getAccessor().get(valueCount);
+ data.writerIndex(idx);
+ if (currentByteCapacity > idx * 2) {
+ incrementAllocationMonitor();
+ } else if (allocationMonitor > 0) {
+ allocationMonitor = 0;
+ }
+ VectorTrimmer.trim(data, idx);
+ offsetVector.getMutator().setValueCount(valueCount+1);
}
- VectorTrimmer.trim(data, idx);
- offsetVector.getMutator().setValueCount(valueCount == 0 ? 0 : valueCount+1);
}
@Override