Repository: incubator-drill
Updated Branches:
  refs/heads/master 17a4d9214 -> 5d3a22911


DRILL-1303 - Fix Drill Client assertion on getting bad metadata


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

Branch: refs/heads/master
Commit: e302d98150d85a69ae08aba4cbf025c3bf032344
Parents: 17a4d92
Author: Parth Chandra <pchan...@maprtech.com>
Authored: Thu Aug 21 22:22:15 2014 -0700
Committer: Parth Chandra <pchan...@maprtech.com>
Committed: Wed Oct 15 22:47:54 2014 -0700

----------------------------------------------------------------------
 contrib/native/client/example/querySubmitter.cpp               | 4 ++--
 contrib/native/client/src/include/drill/recordBatch.hpp        | 6 ++++--
 .../src/main/codegen/templates/NullableValueVectors.java       | 1 +
 .../src/main/codegen/templates/RepeatedValueVectors.java       | 5 ++++-
 .../src/main/java/org/apache/drill/exec/vector/BitVector.java  | 1 +
 5 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e302d981/contrib/native/client/example/querySubmitter.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/example/querySubmitter.cpp 
b/contrib/native/client/example/querySubmitter.cpp
index f886e81..7154dda 100644
--- a/contrib/native/client/example/querySubmitter.cpp
+++ b/contrib/native/client/example/querySubmitter.cpp
@@ -66,7 +66,7 @@ Drill::status_t QueryResultsListener(void* ctx, 
Drill::RecordBatch* b, Drill::Dr
         if(bTestCancel){
             return Drill::QRY_FAILURE;
         }else{
-            return Drill::QRY_SUCCESS ;
+        return Drill::QRY_SUCCESS ;
         }
     }else{
         std::cerr<< "ERROR: " << err->msg << std::endl;
@@ -334,7 +334,7 @@ int main(int argc, char* argv[]) {
                     if(bTestCancel && row%100==1){
                         pRecIter->cancel();
                         printf("Application canceled the query.\n");
-                    }
+                }
                 }
                 if(ret!=Drill::QRY_NO_MORE_DATA && ret!=Drill::QRY_CANCEL){
                     std::cerr<< pRecIter->getError() << std::endl;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e302d981/contrib/native/client/src/include/drill/recordBatch.hpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/include/drill/recordBatch.hpp 
b/contrib/native/client/src/include/drill/recordBatch.hpp
index 1c89cea..de65202 100644
--- a/contrib/native/client/src/include/drill/recordBatch.hpp
+++ b/contrib/native/client/src/include/drill/recordBatch.hpp
@@ -72,6 +72,7 @@ class SlicedByteBuf{
     public:
         //TODO: check the size and offset parameters. What is the largest they 
can be?
         SlicedByteBuf(const ByteBuf_t b, size_t offset, size_t length){
+            assert(length>0);
             this->m_buffer=b;
             this->m_start=offset;
             this->m_end=offset+length-1;
@@ -80,9 +81,10 @@ class SlicedByteBuf{
 
         // Carve a sliced buffer out of another sliced buffer
         SlicedByteBuf(const SlicedByteBuf& sb, size_t offset, size_t length){
+            assert(length>0);
             this->m_buffer=sb.m_buffer;
             this->m_start=sb.m_start+offset;
-            this->m_end=sb.m_start+offset+length;
+            this->m_end=sb.m_start+offset+length-1;
             this->m_length=length;
         }
 
@@ -652,7 +654,7 @@ class DECLSPEC_DRILL_CLIENT ValueVectorVarWidth:public 
ValueVectorBase{
         ValueVectorVarWidth(SlicedByteBuf *b, size_t 
rowCount):ValueVectorBase(b, rowCount){
             size_t offsetEnd = (rowCount+1)*sizeof(uint32_t);
             this->m_pOffsetArray= new SlicedByteBuf(*b, 0, offsetEnd);
-            this->m_pData= new SlicedByteBuf(*b, offsetEnd, b->getLength());
+            this->m_pData= new SlicedByteBuf(*b, offsetEnd, 
b->getLength()-offsetEnd);
         }
         ~ValueVectorVarWidth(){
             delete this->m_pOffsetArray;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e302d981/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java 
b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
index 492d495..3989149 100644
--- a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
@@ -258,6 +258,7 @@ public final class ${className} extends BaseValueVector 
implements <#if type.maj
   public void splitAndTransferTo(int startIndex, int length, 
Nullable${minor.class}Vector target) {
     bits.splitAndTransferTo(startIndex, length, target.bits);
     values.splitAndTransferTo(startIndex, length, target.values);
+    target.valueCount = length;
     <#if type.major == "VarLen">
     target.mutator.lastSet = length - 1;
     </#if>

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e302d981/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java 
b/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
index 195f182..2132212 100644
--- a/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/RepeatedValueVectors.java
@@ -112,6 +112,9 @@ package org.apache.drill.exec.vector;
       normalizedPos = offsets.getAccessor().get(startIndex+i) - startPos;
       target.offsets.getMutator().set(i, normalizedPos);
     }
+    target.parentValueCount = length;
+    target.childValueCount  = offsets.getAccessor().get(startIndex+length) - 
startPos;
+    target.offsets.getMutator().setValueCount(length);
   }
   
   private class TransferImpl implements TransferPair{
@@ -517,4 +520,4 @@ package org.apache.drill.exec.vector;
   }
 }
 </#list>
-</#list>
\ No newline at end of file
+</#list>

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e302d981/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 6542fe7..d2523c5 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
@@ -206,6 +206,7 @@ public final class BitVector extends BaseDataValueVector 
implements FixedWidthVe
             (((this.data.getByte(firstByte + byteSize - 1) & 0xFF) >>> offset) 
+ (this.data.getByte(firstByte + byteSize) <<  (8 - offset))));
       }
     }
+    target.getMutator().setValueCount(length);
   }
 
   private class TransferImpl implements TransferPair {

Reply via email to