drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [3/3] drill git commit: DRILL-2731: Repeat realloc until enough space
Date Sat, 11 Apr 2015 08:51:27 GMT
DRILL-2731: Repeat realloc until enough space

Repeat realloc for variable length vectors as well


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/4993bd2b
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/4993bd2b
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/4993bd2b

Branch: refs/heads/master
Commit: 4993bd2bbe841930432a76ab4b01d72b2ba5b2ae
Parents: 6edf6eb
Author: Steven Phillips <sphillips@maprtech.com>
Authored: Tue Mar 17 15:48:15 2015 -0700
Committer: Steven Phillips <sphillips@maprtech.com>
Committed: Sat Apr 11 00:34:11 2015 -0700

----------------------------------------------------------------------
 .../codegen/templates/FixedValueVectors.java    | 20 ++++++++++----------
 .../templates/VariableLengthVectors.java        | 14 +++++++-------
 .../org/apache/drill/exec/vector/BitVector.java |  6 +++---
 3 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/4993bd2b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
index f7260e7..e9ec220 100644
--- a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
@@ -230,7 +230,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
   }
   
   public void copyFromSafe(int fromIndex, int thisIndex, ${minor.class}Vector from){
-    if(thisIndex >= getValueCapacity()) {
+    while(thisIndex >= getValueCapacity()) {
         reAlloc();
     }
     copyFrom(fromIndex, thisIndex, from);
@@ -544,7 +544,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
    }
 
    public void setSafe(int index, <#if (type.width > 4)>${minor.javaType!type.javaType}<#else>int</#if>
value) {
-     if(index >= getValueCapacity()) {
+     while(index >= getValueCapacity()) {
        reAlloc();
      }
      data.setBytes(index * ${type.width}, value, 0, ${type.width});
@@ -567,7 +567,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
    }
 
    public void setSafe(int index, int months, int days, int milliseconds){
-     if(index >= getValueCapacity()) {
+     while(index >= getValueCapacity()) {
        reAlloc();
      }
      set(index, months, days, milliseconds);
@@ -596,7 +596,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
    }
 
    public void setSafe(int index, int days, int milliseconds){
-     if(index >= getValueCapacity()) {
+     while(index >= getValueCapacity()) {
        reAlloc();
      }
      set(index, days, milliseconds);
@@ -628,7 +628,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
    }
    
    public void setSafe(int index, int start, DrillBuf buffer){
-     if(index >= getValueCapacity()) {
+     while(index >= getValueCapacity()) {
        reAlloc();
      }
      set(index, start, buffer);
@@ -660,7 +660,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
    }
    
    public void setSafe(int index, int start, DrillBuf buffer){
-     if(index >= getValueCapacity()) {
+     while(index >= getValueCapacity()) {
        reAlloc();
      }
      set(index, holder);
@@ -692,7 +692,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
    }
 
    public void setSafe(int index, <#if (type.width >= 4)>${minor.javaType!type.javaType}<#else>int</#if>
value) {
-     if(index >= getValueCapacity()) {
+     while(index >= getValueCapacity()) {
        reAlloc();
      }
      set(index, value);
@@ -703,7 +703,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
    }
 
    public void setSafe(int index, ${minor.class}Holder holder){
-     if(index >= getValueCapacity()) {
+     while(index >= getValueCapacity()) {
        reAlloc();
      }
      set(index, holder);
@@ -714,7 +714,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
    }
 
    public void setSafe(int index, Nullable${minor.class}Holder holder){
-     if(index >= getValueCapacity()) {
+     while(index >= getValueCapacity()) {
        reAlloc();
      }
      set(index, holder);
@@ -774,4 +774,4 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
F
 
 </#if> <#-- type.major -->
 </#list>
-</#list>
\ No newline at end of file
+</#list>

http://git-wip-us.apache.org/repos/asf/drill/blob/4993bd2b/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java b/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
index 61a2481..edb851e 100644
--- a/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
@@ -210,7 +210,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
V
     
     int outputStart = offsetVector.data.get${(minor.javaType!type.javaType)?cap_first}(thisIndex
* ${type.width});
     
-    if(data.capacity() < outputStart + len) {
+    while(data.capacity() < outputStart + len) {
         reAlloc();
     }
 
@@ -423,7 +423,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
V
       assert index >= 0;
 
       int currentOffset = offsetVector.getAccessor().get(index);
-      if (data.capacity() < currentOffset + bytes.length) {
+      while (data.capacity() < currentOffset + bytes.length) {
         reAlloc();
       }
       offsetVector.getMutator().setSafe(index + 1, currentOffset + bytes.length);
@@ -451,7 +451,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
V
 
       int currentOffset = offsetVector.getAccessor().get(index);
 
-      if (data.capacity() < currentOffset + length) {
+      while (data.capacity() < currentOffset + length) {
         reAlloc();
       }
       offsetVector.getMutator().setSafe(index + 1, currentOffset + length);
@@ -460,7 +460,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
V
 
     public void setValueLengthSafe(int index, int length) {
       int offset = offsetVector.getAccessor().get(index);
-      if(data.capacity() < offset + length ) {
+      while(data.capacity() < offset + length ) {
         reAlloc();
       }
       offsetVector.getMutator().setSafe(index + 1, offsetVector.getAccessor().get(index)
+ length);
@@ -472,7 +472,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
V
       
       int outputStart = offsetVector.data.get${(minor.javaType!type.javaType)?cap_first}(index
* ${type.width});
       
-      if(data.capacity() < outputStart + len) {
+      while(data.capacity() < outputStart + len) {
         reAlloc();
       }
       
@@ -490,7 +490,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
V
       
       int outputStart = offsetVector.data.get${(minor.javaType!type.javaType)?cap_first}(index
* ${type.width});
       
-      if(data.capacity() < outputStart + len) {
+      while(data.capacity() < outputStart + len) {
         reAlloc();
       }
       
@@ -506,7 +506,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
V
       
       int outputStart = offsetVector.data.get${(minor.javaType!type.javaType)?cap_first}(index
* ${type.width});
       
-      if(data.capacity() < outputStart + len) {
+      while(data.capacity() < outputStart + len) {
         reAlloc();
       }
       

http://git-wip-us.apache.org/repos/asf/drill/blob/4993bd2b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java
index 1558e19..d8bd972 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java
@@ -351,21 +351,21 @@ public final class BitVector extends BaseDataValueVector implements
FixedWidthVe
     }
 
     public void setSafe(int index, int value) {
-      if(index >= getValueCapacity()) {
+      while(index >= getValueCapacity()) {
         reAlloc();
       }
       set(index, value);
     }
 
     public void setSafe(int index, BitHolder holder) {
-      if(index >= getValueCapacity()) {
+      while(index >= getValueCapacity()) {
         reAlloc();
       }
       set(index, holder.value);
     }
 
     public void setSafe(int index, NullableBitHolder holder) {
-      if(index >= getValueCapacity()) {
+      while(index >= getValueCapacity()) {
         reAlloc();
       }
       set(index, holder.value);


Mime
View raw message