You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by jn...@apache.org on 2014/11/08 01:03:02 UTC

[01/16] incubator-drill git commit: DRILL-1324: Add mechanism to detect schema changes when adding a new primitive vector in a Map, RepeatedMap, RepeatedList vector

Repository: incubator-drill
Updated Branches:
  refs/heads/master c4e1c58f3 -> a8fd9758b


DRILL-1324: Add mechanism to detect schema changes when adding a new primitive vector in a Map, RepeatedMap, RepeatedList vector


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

Branch: refs/heads/master
Commit: 61053a8c9c22e7cce45bb74e3e1894f2cfd42041
Parents: c4e1c58
Author: Mehant Baid <me...@gmail.com>
Authored: Wed Aug 13 18:50:07 2014 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Fri Nov 7 08:59:05 2014 -0800

----------------------------------------------------------------------
 .../src/main/codegen/templates/TypeHelper.java  | 10 ++++--
 .../drill/exec/physical/impl/ScanBatch.java     |  8 +++--
 .../impl/project/ProjectRecordBatch.java        |  4 +--
 .../exec/record/AbstractSingleRecordBatch.java  | 10 +++++-
 .../drill/exec/record/VectorContainer.java      |  8 ++++-
 .../org/apache/drill/exec/util/CallBack.java    | 23 +++++++++++++
 .../drill/exec/vector/SchemaChangeCallBack.java | 36 ++++++++++++++++++++
 .../drill/exec/vector/complex/MapVector.java    | 14 +++++---
 .../exec/vector/complex/RepeatedListVector.java | 22 +++++++-----
 .../exec/vector/complex/RepeatedMapVector.java  | 14 +++++---
 .../vector/complex/impl/ComplexWriterImpl.java  |  2 +-
 .../complex/impl/VectorContainerWriter.java     |  2 +-
 .../vector/complex/writer/TestJsonReader.java   |  2 +-
 .../vector/complex/writer/TestRepeated.java     |  2 +-
 14 files changed, 128 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/codegen/templates/TypeHelper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/TypeHelper.java b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
index cb6a030..c83c301 100644
--- a/exec/java-exec/src/main/codegen/templates/TypeHelper.java
+++ b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
@@ -31,6 +31,7 @@ import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.vector.accessor.*;
 import org.apache.drill.exec.vector.complex.RepeatedMapVector;
+import org.apache.drill.exec.util.CallBack;
 
 public class TypeHelper {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TypeHelper.class);
@@ -258,6 +259,9 @@ public class TypeHelper {
   }
 
   public static ValueVector getNewVector(MaterializedField field, BufferAllocator allocator){
+    return getNewVector(field, allocator, null);
+  }
+  public static ValueVector getNewVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
     MajorType type = field.getType();
 
     switch (type.getMinorType()) {
@@ -266,14 +270,14 @@ public class TypeHelper {
     case MAP:
       switch (type.getMode()) {
       case REQUIRED:
-        return new MapVector(field, allocator);
+        return new MapVector(field, allocator, callBack);
       case REPEATED:
-        return new RepeatedMapVector(field, allocator);
+        return new RepeatedMapVector(field, allocator, callBack);
       }
     case LIST:
       switch (type.getMode()) {
       case REPEATED:
-        return new RepeatedListVector(field, allocator);
+        return new RepeatedListVector(field, allocator, callBack);
       }    
 <#list vv.  types as type>
   <#list type.minor as minor>

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
index ac65e40..4ed1180 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
@@ -47,8 +47,10 @@ import org.apache.drill.exec.record.WritableBatch;
 import org.apache.drill.exec.record.selection.SelectionVector2;
 import org.apache.drill.exec.record.selection.SelectionVector4;
 import org.apache.drill.exec.store.RecordReader;
+import org.apache.drill.exec.util.CallBack;
 import org.apache.drill.exec.vector.AllocationHelper;
 import org.apache.drill.exec.vector.NullableVarCharVector;
+import org.apache.drill.exec.vector.SchemaChangeCallBack;
 import org.apache.drill.exec.vector.ValueVector;
 
 import com.google.common.collect.Lists;
@@ -80,6 +82,7 @@ public class ScanBatch implements RecordBatch {
   private String partitionColumnDesignator;
   private boolean first = false;
   private boolean done = false;
+  private SchemaChangeCallBack callBack = new SchemaChangeCallBack();
 
   public ScanBatch(PhysicalOperator subScanConfig, FragmentContext context, Iterator<RecordReader> readers, List<String[]> partitionColumns, List<Integer> selectedPartitionColumns) throws ExecutionSetupException {
     this.context = context;
@@ -313,7 +316,7 @@ public class ScanBatch implements RecordBatch {
 
       if (v == null || v.getClass() != clazz) {
         // Field does not exist add it to the map and the output container
-        v = TypeHelper.getNewVector(field, oContext.getAllocator());
+        v = TypeHelper.getNewVector(field, oContext.getAllocator(), callBack);
         if (!clazz.isAssignableFrom(v.getClass())) {
           throw new SchemaChangeException(String.format("The class that was provided %s does not correspond to the expected vector type of %s.", clazz.getSimpleName(), v.getClass().getSimpleName()));
         }
@@ -345,7 +348,8 @@ public class ScanBatch implements RecordBatch {
 
     @Override
     public boolean isNewSchema() {
-      if (schemaChange == true) {
+      // Check if top level schema has changed, second condition checks if one of the deeper map schema has changed
+      if (schemaChange == true || callBack.getSchemaChange()) {
         schemaChange = false;
         return true;
       }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
index 486fb12..27cb1f2 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
@@ -343,7 +343,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project> {
               }
 
               MaterializedField outputField = MaterializedField.create(name, expr.getMajorType());
-              ValueVector vv = container.addOrGet(outputField);
+              ValueVector vv = container.addOrGet(outputField, callBack);
               allocationVectors.add(vv);
               TypedFieldId fid = container.getValueVectorId(outputField.getPath());
               ValueVectorWriteExpression write = new ValueVectorWriteExpression(fid, expr, true);
@@ -407,7 +407,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project> {
         }
       } else{
         // need to do evaluation.
-        ValueVector vector = container.addOrGet(outputField);
+        ValueVector vector = container.addOrGet(outputField, callBack);
         allocationVectors.add(vector);
         TypedFieldId fid = container.getValueVectorId(outputField.getPath());
         ValueVectorWriteExpression write = new ValueVectorWriteExpression(fid, expr, true);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java
index f6ae14f..1ef0345 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java
@@ -21,7 +21,7 @@ import org.apache.drill.exec.exception.SchemaChangeException;
 import org.apache.drill.exec.memory.OutOfMemoryException;
 import org.apache.drill.exec.ops.FragmentContext;
 import org.apache.drill.exec.physical.base.PhysicalOperator;
-import org.apache.drill.exec.physical.config.Project;
+import org.apache.drill.exec.vector.SchemaChangeCallBack;
 
 public abstract class AbstractSingleRecordBatch<T extends PhysicalOperator> extends AbstractRecordBatch<T> {
   final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(this.getClass());
@@ -30,6 +30,7 @@ public abstract class AbstractSingleRecordBatch<T extends PhysicalOperator> exte
   private boolean first = true;
   protected boolean done = false;
   protected boolean outOfMemory = false;
+  protected SchemaChangeCallBack callBack = new SchemaChangeCallBack();
 
   public AbstractSingleRecordBatch(T popConfig, FragmentContext context, RecordBatch incoming) throws OutOfMemoryException {
     super(popConfig, context);
@@ -86,10 +87,17 @@ public abstract class AbstractSingleRecordBatch<T extends PhysicalOperator> exte
       assert !first : "First batch should be OK_NEW_SCHEMA";
       container.zeroVectors();
       doWork();
+
       if (outOfMemory) {
         outOfMemory = false;
         return IterOutcome.OUT_OF_MEMORY;
       }
+
+      // Check if schema has changed
+      if (callBack.getSchemaChange()) {
+        return IterOutcome.OK_NEW_SCHEMA;
+      }
+
       return upstream; // change if upstream changed, otherwise normal.
     default:
       throw new UnsupportedOperationException();

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
index 8e269b8..fde727f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java
@@ -30,6 +30,7 @@ import org.apache.drill.exec.expr.TypeHelper;
 import org.apache.drill.exec.ops.OperatorContext;
 import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
 import org.apache.drill.exec.record.MaterializedField.Key;
+import org.apache.drill.exec.vector.SchemaChangeCallBack;
 import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.exec.vector.complex.AbstractMapVector;
 
@@ -80,14 +81,19 @@ public class VectorContainer extends AbstractMapVector implements Iterable<Vecto
     add(vv, releasable);
   }
 
+
   public <T extends ValueVector> T addOrGet(MaterializedField field) {
+    return addOrGet(field, null);
+  }
+
+  public <T extends ValueVector> T addOrGet(MaterializedField field, SchemaChangeCallBack callBack) {
     TypedFieldId id = getValueVectorId(field.getPath());
     ValueVector v = null;
     Class clazz = TypeHelper.getValueVectorClass(field.getType().getMinorType(), field.getType().getMode());
     if (id != null) {
       v = getValueAccessorById(id.getFieldIds()).getValueVector();
       if (id.getFieldIds().length == 1 && clazz != null && !clazz.isAssignableFrom(v.getClass())) {
-        ValueVector newVector = TypeHelper.getNewVector(field, this.oContext.getAllocator());
+        ValueVector newVector = TypeHelper.getNewVector(field, this.oContext.getAllocator(), callBack);
         replace(v, newVector);
         return (T) newVector;
       }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/util/CallBack.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/CallBack.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/CallBack.java
new file mode 100644
index 0000000..0243f8a
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/CallBack.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.util;
+
+
+public interface CallBack {
+  public void doWork();
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/vector/SchemaChangeCallBack.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/SchemaChangeCallBack.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/SchemaChangeCallBack.java
new file mode 100644
index 0000000..386ee34
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/SchemaChangeCallBack.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.drill.exec.vector;
+
+import org.apache.drill.exec.util.CallBack;
+
+public class SchemaChangeCallBack implements CallBack {
+  private boolean schemaChange = false;
+
+  public void doWork() {
+    schemaChange = true;
+  }
+
+  public boolean getSchemaChange() {
+    boolean schemaChange = this.schemaChange;
+    this.schemaChange = false;
+    return schemaChange;
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
index 1e4c8c4..7a0afdb 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
@@ -40,6 +40,7 @@ import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
+import org.apache.drill.exec.util.CallBack;
 import org.apache.drill.exec.util.JsonStringHashMap;
 import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.exec.vector.complex.RepeatedMapVector.MapSingleCopier;
@@ -65,16 +66,18 @@ public class MapVector extends AbstractContainerVector {
   private final BufferAllocator allocator;
   private MaterializedField field;
   private int valueCount;
+  private CallBack callBack;
 
-  public MapVector(String path, BufferAllocator allocator) {
+  public MapVector(String path, BufferAllocator allocator, CallBack callBack){
     this.field = MaterializedField.create(SchemaPath.getSimplePath(path), TYPE);
     this.allocator = allocator;
+    this.callBack = callBack;
   }
-  public MapVector(MaterializedField field, BufferAllocator allocator) {
+  public MapVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
     this.field = field;
     this.allocator = allocator;
+    this.callBack = callBack;
   }
-
   @Override
   public int size() {
     return vectors.size();
@@ -120,6 +123,9 @@ public class MapVector extends AbstractContainerVector {
       v = TypeHelper.getNewVector(field.getPath(), name, allocator, type);
       Preconditions.checkNotNull(v, String.format("Failure to create vector of type %s.", type));
       put(name, v);
+      if (callBack != null) {
+        callBack.doWork();
+      }
     }
     return typeify(v, clazz);
 
@@ -222,7 +228,7 @@ public class MapVector extends AbstractContainerVector {
     private MapVector to;
 
     public MapTransferPair(SchemaPath path) {
-      MapVector v = new MapVector(MaterializedField.create(path, TYPE), allocator);
+      MapVector v = new MapVector(MaterializedField.create(path, TYPE), allocator, callBack);
       pairs = new TransferPair[vectors.size()];
       int i =0;
       for (Map.Entry<String, ValueVector> e : vectors.entrySet()) {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
index c75b359..362d806 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java
@@ -40,6 +40,7 @@ import org.apache.drill.exec.record.TransferPair;
 import org.apache.drill.exec.util.JsonStringArrayList;
 import org.apache.drill.exec.vector.BaseDataValueVector;
 import org.apache.drill.exec.vector.RepeatedFixedWidthVector;
+import org.apache.drill.exec.util.CallBack;
 import org.apache.drill.exec.vector.UInt4Vector;
 import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.exec.vector.complex.impl.NullReader;
@@ -61,6 +62,7 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
   private final RepeatedListReaderImpl reader = new RepeatedListReaderImpl(null, this);
   private int allocationValueCount = 4000;
   private int allocationMonitor = 0;
+  private CallBack callBack;
 
   private int lastSet = 0;
 
@@ -68,10 +70,15 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
 
   public static MajorType TYPE = Types.repeated(MinorType.LIST);
 
-  public RepeatedListVector(MaterializedField field, BufferAllocator allocator) {
+  public RepeatedListVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
     this.allocator = allocator;
     this.offsets = new UInt4Vector(null, allocator);
     this.field = field;
+    this.callBack = callBack;
+  }
+
+  public RepeatedListVector(SchemaPath path, BufferAllocator allocator, CallBack callBack){
+    this(MaterializedField.create(path, TYPE), allocator, callBack);
   }
 
   @Override
@@ -93,10 +100,6 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
     return primitiveVectors;
   }
 
-  public RepeatedListVector(SchemaPath path, BufferAllocator allocator) {
-    this(MaterializedField.create(path, TYPE), allocator);
-  }
-
   transient private RepeatedListTransferPair ephPair;
 
   public boolean copyFromSafe(int fromIndex, int thisIndex, RepeatedListVector from) {
@@ -313,7 +316,7 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
     }
 
     private RepeatedListTransferPair(SchemaPath path) {
-      this.to = new RepeatedListVector(path, allocator);
+      this.to = new RepeatedListVector(path, allocator, callBack);
       vectorTransfer = vector.getTransferPair();
       this.to.vector = vectorTransfer.getTo();
     }
@@ -437,8 +440,11 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea
   public <T extends ValueVector> T addOrGet(String name, MajorType type, Class<T> clazz) {
     Preconditions.checkArgument(name == null);
 
-    if (vector == null) {
-      vector = TypeHelper.getNewVector(MaterializedField.create(field.getPath().getUnindexedArrayChild(), type), allocator);
+    if(vector == null){
+      vector = TypeHelper.getNewVector(MaterializedField.create(field.getPath().getUnindexedArrayChild(), type), allocator, callBack);
+      if (callBack != null) {
+        callBack.doWork();
+      }
     }
     return typeify(vector, clazz);
   }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
index beb2475..d73aa7f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
@@ -37,6 +37,7 @@ import org.apache.drill.exec.memory.OutOfMemoryRuntimeException;
 import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
+import org.apache.drill.exec.util.CallBack;
 import org.apache.drill.exec.util.JsonStringArrayList;
 import org.apache.drill.exec.vector.AllocationHelper;
 import org.apache.drill.exec.vector.BaseDataValueVector;
@@ -68,12 +69,14 @@ public class RepeatedMapVector extends AbstractContainerVector implements Repeat
   private final BufferAllocator allocator;
   private final MaterializedField field;
   private int lastPopulatedValueIndex = -1;
+  private int lastSet = -1;
+  private CallBack callBack;
 
-  public RepeatedMapVector(MaterializedField field, BufferAllocator allocator) {
+  public RepeatedMapVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
     this.field = field;
     this.allocator = allocator;
     this.offsets = new UInt4Vector(null, allocator);
-
+    this.callBack = callBack;
   }
 
   @Override
@@ -122,6 +125,9 @@ public class RepeatedMapVector extends AbstractContainerVector implements Repeat
       v = TypeHelper.getNewVector(field.getPath(), name, allocator, type);
       Preconditions.checkNotNull(v, String.format("Failure to create vector of type %s.", type));
       put(name, v);
+      if (callBack != null) {
+        callBack.doWork();
+      }
     }
     return typeify(v, clazz);
   }
@@ -243,7 +249,7 @@ public class RepeatedMapVector extends AbstractContainerVector implements Repeat
     public SingleMapTransferPair(SchemaPath path) {
 
       MaterializedField mf = MaterializedField.create(path, Types.required(field.getType().getMinorType()));
-      MapVector v = new MapVector(mf, allocator);
+      MapVector v = new MapVector(mf, allocator, callBack);
       pairs = new TransferPair[vectors.size()];
       int i =0;
       for (Map.Entry<String, ValueVector> e : vectors.entrySet()) {
@@ -310,7 +316,7 @@ public class RepeatedMapVector extends AbstractContainerVector implements Repeat
     private final RepeatedMapVector from = RepeatedMapVector.this;
 
     public MapTransferPair(SchemaPath path) {
-      RepeatedMapVector v = new RepeatedMapVector(MaterializedField.create(path, TYPE), allocator);
+      RepeatedMapVector v = new RepeatedMapVector(MaterializedField.create(path, TYPE), allocator, callBack);
       pairs = new TransferPair[vectors.size()];
       int i =0;
       for (Map.Entry<String, ValueVector> e : vectors.entrySet()) {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java
index 920a4f3..18b5e9e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java
@@ -183,7 +183,7 @@ public class ComplexWriterImpl extends AbstractFieldWriter implements ComplexWri
     private final VectorContainer vc;
 
     public VectorAccessibleFacade(VectorContainer vc) {
-      super("", null);
+      super("", null, null);
       this.vc = vc;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java
index 417d3ef..6b8a523 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java
@@ -91,7 +91,7 @@ public class VectorContainerWriter extends AbstractFieldWriter implements Comple
   private class SpecialMapVector extends MapVector {
 
     public SpecialMapVector() {
-      super("", null);
+      super("", null, null);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
index f207bba..bf81ba2 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
@@ -290,7 +290,7 @@ public class TestJsonReader extends BaseTestQuery {
 //        "{ \"integer\" : -2002,\n" +
 //        "  \"float\"   : -1.2 \n" +
 //        "}";
-    MapVector v = new MapVector("", allocator);
+    MapVector v = new MapVector("", allocator, null);
     ComplexWriterImpl writer = new ComplexWriterImpl("col", v);
     writer.allocate();
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/61053a8c/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
index a85a841..3f125fa 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
@@ -130,7 +130,7 @@ public class TestRepeated {
      *
      */
 
-    MapVector v = new MapVector("", allocator);
+    MapVector v = new MapVector("", allocator, null);
     ComplexWriterImpl writer = new ComplexWriterImpl("col", v);
     writer.allocate();
 


[03/16] incubator-drill git commit: DRILL-1634: Fix issue in complex type expression type resolution, when Drill queries a nested array.

Posted by jn...@apache.org.
DRILL-1634: Fix issue in complex type expression type resolution, when Drill queries a nested array.

code clean up.

add comment of code change.


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

Branch: refs/heads/master
Commit: 3b8dd3b48d52c7499bcdff407d4b407d80fa1720
Parents: 0f069ba
Author: Jinfeng Ni <jn...@maprtech.com>
Authored: Tue Nov 4 16:55:24 2014 -0800
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:55 2014 -0800

----------------------------------------------------------------------
 .../exec/vector/complex/AbstractContainerVector.java  | 14 ++++++++++----
 .../drill/exec/store/json/JsonRecordReader2Test.java  |  7 +++++++
 .../src/test/resources/jsoninput/nestedArray.json     |  2 ++
 3 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/3b8dd3b4/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
index 096db6e..1210d90 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
@@ -55,11 +55,17 @@ public abstract class AbstractContainerVector implements ValueVector{
 
     if (seg.isArray()) {
       if (seg.isLastPath()) {
-        return builder //
-          .remainder(seg) //
+        builder //
           .withIndex() //
-          .finalType(getLastPathType()) //
-          .build();
+          .finalType(getLastPathType());
+
+        // remainder starts with the 1st array segment in SchemaPath.
+        // only set remainder when it's the only array segment.
+        if (addToBreadCrumb) {
+          addToBreadCrumb = false;
+          builder.remainder(seg);
+        }
+        return builder.build();
       } else {
         if (addToBreadCrumb) {
           addToBreadCrumb = false;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/3b8dd3b4/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java
index c83a3ab..9df6cf0 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java
@@ -44,4 +44,11 @@ public class JsonRecordReader2Test extends BaseTestQuery{
   public void trySimpleQueryWithLimit() throws Exception{
     test("select * from cp.`limit/test1.json` limit 10");
   }
+
+  @Test// DRILL-1634 : retrieve an element in a nested array in a repeated map.  RepeatedMap (Repeated List (Repeated varchar))
+  public void testNestedArrayInRepeatedMap() throws Exception {
+    test("select a[0].b[0] from cp.`jsoninput/nestedArray.json`");
+    test("select a[0].b[1] from cp.`jsoninput/nestedArray.json`");
+    test("select a[1].b[1] from cp.`jsoninput/nestedArray.json`");  // index out of the range. Should return empty list.
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/3b8dd3b4/exec/java-exec/src/test/resources/jsoninput/nestedArray.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/jsoninput/nestedArray.json b/exec/java-exec/src/test/resources/jsoninput/nestedArray.json
new file mode 100644
index 0000000..ffd3e9f
--- /dev/null
+++ b/exec/java-exec/src/test/resources/jsoninput/nestedArray.json
@@ -0,0 +1,2 @@
+{ "a":[{"b": [["str1","str2"], ["str3", "str4"]]}] }
+{ "a":[{"b": [["str10","str20"], ["str30", "str40"]]}] }


[08/16] incubator-drill git commit: DRILL-1585: C++ Client - Update RPC version and protobuf definitions for RPC version 3

Posted by jn...@apache.org.
DRILL-1585: C++ Client - Update RPC version and protobuf definitions for RPC version 3


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

Branch: refs/heads/master
Commit: 1d7f6211c19712f2db12a913ea5cb990d4963ec3
Parents: 76df2ff
Author: Parth Chandra <pc...@maprtech.com>
Authored: Thu Nov 6 18:20:17 2014 -0800
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:56 2014 -0800

----------------------------------------------------------------------
 .../native/client/src/include/drill/common.hpp  |    2 +-
 .../native/client/src/protobuf/BitControl.pb.cc |  287 ++++-
 .../native/client/src/protobuf/BitControl.pb.h  |  117 +-
 .../native/client/src/protobuf/GeneralRPC.pb.cc |  399 +------
 .../native/client/src/protobuf/GeneralRPC.pb.h  |  311 -----
 .../client/src/protobuf/UserBitShared.pb.cc     | 1106 ++++++++++++++++--
 .../client/src/protobuf/UserBitShared.pb.h      |  795 ++++++++++++-
 7 files changed, 2169 insertions(+), 848 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1d7f6211/contrib/native/client/src/include/drill/common.hpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/include/drill/common.hpp b/contrib/native/client/src/include/drill/common.hpp
index c49240e..59537f1 100644
--- a/contrib/native/client/src/include/drill/common.hpp
+++ b/contrib/native/client/src/include/drill/common.hpp
@@ -33,7 +33,7 @@
 #include <vector>
 #include <boost/shared_ptr.hpp>
 
-#define DRILL_RPC_VERSION 2
+#define DRILL_RPC_VERSION 3
 
 #define LENGTH_PREFIX_MAX_LENGTH 5
 #define LEN_PREFIX_BUFLEN LENGTH_PREFIX_MAX_LENGTH

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1d7f6211/contrib/native/client/src/protobuf/BitControl.pb.cc
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/protobuf/BitControl.pb.cc b/contrib/native/client/src/protobuf/BitControl.pb.cc
index a762386..64ab783 100644
--- a/contrib/native/client/src/protobuf/BitControl.pb.cc
+++ b/contrib/native/client/src/protobuf/BitControl.pb.cc
@@ -31,6 +31,9 @@ const ::google::protobuf::internal::GeneratedMessageReflection*
 const ::google::protobuf::Descriptor* FragmentStatus_descriptor_ = NULL;
 const ::google::protobuf::internal::GeneratedMessageReflection*
   FragmentStatus_reflection_ = NULL;
+const ::google::protobuf::Descriptor* InitializeFragments_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  InitializeFragments_reflection_ = NULL;
 const ::google::protobuf::Descriptor* PlanFragment_descriptor_ = NULL;
 const ::google::protobuf::internal::GeneratedMessageReflection*
   PlanFragment_reflection_ = NULL;
@@ -99,7 +102,22 @@ void protobuf_AssignDesc_BitControl_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(FragmentStatus));
-  PlanFragment_descriptor_ = file->message_type(3);
+  InitializeFragments_descriptor_ = file->message_type(3);
+  static const int InitializeFragments_offsets_[1] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(InitializeFragments, fragment_),
+  };
+  InitializeFragments_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      InitializeFragments_descriptor_,
+      InitializeFragments::default_instance_,
+      InitializeFragments_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(InitializeFragments, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(InitializeFragments, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(InitializeFragments));
+  PlanFragment_descriptor_ = file->message_type(4);
   static const int PlanFragment_offsets_[15] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PlanFragment, handle_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PlanFragment, network_cost_),
@@ -128,7 +146,7 @@ void protobuf_AssignDesc_BitControl_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(PlanFragment));
-  WorkQueueStatus_descriptor_ = file->message_type(4);
+  WorkQueueStatus_descriptor_ = file->message_type(5);
   static const int WorkQueueStatus_offsets_[3] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(WorkQueueStatus, endpoint_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(WorkQueueStatus, queue_length_),
@@ -145,7 +163,7 @@ void protobuf_AssignDesc_BitControl_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(WorkQueueStatus));
-  FinishedReceiver_descriptor_ = file->message_type(5);
+  FinishedReceiver_descriptor_ = file->message_type(6);
   static const int FinishedReceiver_offsets_[2] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FinishedReceiver, receiver_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FinishedReceiver, sender_),
@@ -181,6 +199,8 @@ void protobuf_RegisterTypes(const ::std::string&) {
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
     FragmentStatus_descriptor_, &FragmentStatus::default_instance());
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    InitializeFragments_descriptor_, &InitializeFragments::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
     PlanFragment_descriptor_, &PlanFragment::default_instance());
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
     WorkQueueStatus_descriptor_, &WorkQueueStatus::default_instance());
@@ -197,6 +217,8 @@ void protobuf_ShutdownFile_BitControl_2eproto() {
   delete BitStatus_reflection_;
   delete FragmentStatus::default_instance_;
   delete FragmentStatus_reflection_;
+  delete InitializeFragments::default_instance_;
+  delete InitializeFragments_reflection_;
   delete PlanFragment::default_instance_;
   delete PlanFragment_reflection_;
   delete WorkQueueStatus::default_instance_;
@@ -225,43 +247,47 @@ void protobuf_AddDesc_BitControl_2eproto() {
     "2 .exec.bit.control.FragmentStatus\"n\n\016Fr"
     "agmentStatus\0222\n\007profile\030\001 \001(\0132!.exec.sha"
     "red.MinorFragmentProfile\022(\n\006handle\030\002 \001(\013"
-    "2\030.exec.bit.FragmentHandle\"\275\003\n\014PlanFragm"
-    "ent\022(\n\006handle\030\001 \001(\0132\030.exec.bit.FragmentH"
-    "andle\022\024\n\014network_cost\030\004 \001(\002\022\020\n\010cpu_cost\030"
-    "\005 \001(\002\022\021\n\tdisk_cost\030\006 \001(\002\022\023\n\013memory_cost\030"
-    "\007 \001(\002\022\025\n\rfragment_json\030\010 \001(\t\022*\n\nassignme"
-    "nt\030\n \001(\0132\026.exec.DrillbitEndpoint\022\025\n\rleaf"
-    "_fragment\030\t \001(\010\022\'\n\007foreman\030\013 \001(\0132\026.exec."
-    "DrillbitEndpoint\022\035\n\013mem_initial\030\014 \001(\003:\0102"
-    "0000000\022\033\n\007mem_max\030\r \001(\003:\n2000000000\022\030\n\020"
-    "query_start_time\030\016 \001(\003\0221\n\013credentials\030\017 "
-    "\001(\0132\034.exec.shared.UserCredentials\022\021\n\ttim"
-    "e_zone\030\020 \001(\005\022\024\n\014options_json\030\021 \001(\t\"f\n\017Wo"
-    "rkQueueStatus\022(\n\010endpoint\030\001 \001(\0132\026.exec.D"
-    "rillbitEndpoint\022\024\n\014queue_length\030\002 \001(\005\022\023\n"
-    "\013report_time\030\003 \001(\003\"h\n\020FinishedReceiver\022*"
-    "\n\010receiver\030\001 \001(\0132\030.exec.bit.FragmentHand"
-    "le\022(\n\006sender\030\002 \001(\0132\030.exec.bit.FragmentHa"
-    "ndle*\242\002\n\007RpcType\022\r\n\tHANDSHAKE\020\000\022\007\n\003ACK\020\001"
-    "\022\013\n\007GOODBYE\020\002\022\033\n\027REQ_INIATILIZE_FRAGMENT"
-    "\020\003\022\027\n\023REQ_CANCEL_FRAGMENT\020\006\022\031\n\025REQ_RECEI"
-    "VER_FINISHED\020\007\022\027\n\023REQ_FRAGMENT_STATUS\020\010\022"
-    "\022\n\016REQ_BIT_STATUS\020\t\022\024\n\020REQ_QUERY_STATUS\020"
-    "\n\022\030\n\024RESP_FRAGMENT_HANDLE\020\013\022\030\n\024RESP_FRAG"
-    "MENT_STATUS\020\014\022\023\n\017RESP_BIT_STATUS\020\r\022\025\n\021RE"
-    "SP_QUERY_STATUS\020\016B+\n\033org.apache.drill.ex"
-    "ec.protoB\nBitControlH\001", 1422);
+    "2\030.exec.bit.FragmentHandle\"G\n\023Initialize"
+    "Fragments\0220\n\010fragment\030\001 \003(\0132\036.exec.bit.c"
+    "ontrol.PlanFragment\"\275\003\n\014PlanFragment\022(\n\006"
+    "handle\030\001 \001(\0132\030.exec.bit.FragmentHandle\022\024"
+    "\n\014network_cost\030\004 \001(\002\022\020\n\010cpu_cost\030\005 \001(\002\022\021"
+    "\n\tdisk_cost\030\006 \001(\002\022\023\n\013memory_cost\030\007 \001(\002\022\025"
+    "\n\rfragment_json\030\010 \001(\t\022*\n\nassignment\030\n \001("
+    "\0132\026.exec.DrillbitEndpoint\022\025\n\rleaf_fragme"
+    "nt\030\t \001(\010\022\'\n\007foreman\030\013 \001(\0132\026.exec.Drillbi"
+    "tEndpoint\022\035\n\013mem_initial\030\014 \001(\003:\01020000000"
+    "\022\033\n\007mem_max\030\r \001(\003:\n2000000000\022\030\n\020query_s"
+    "tart_time\030\016 \001(\003\0221\n\013credentials\030\017 \001(\0132\034.e"
+    "xec.shared.UserCredentials\022\021\n\ttime_zone\030"
+    "\020 \001(\005\022\024\n\014options_json\030\021 \001(\t\"f\n\017WorkQueue"
+    "Status\022(\n\010endpoint\030\001 \001(\0132\026.exec.Drillbit"
+    "Endpoint\022\024\n\014queue_length\030\002 \001(\005\022\023\n\013report"
+    "_time\030\003 \001(\003\"h\n\020FinishedReceiver\022*\n\010recei"
+    "ver\030\001 \001(\0132\030.exec.bit.FragmentHandle\022(\n\006s"
+    "ender\030\002 \001(\0132\030.exec.bit.FragmentHandle*\243\002"
+    "\n\007RpcType\022\r\n\tHANDSHAKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOO"
+    "DBYE\020\002\022\034\n\030REQ_INIATILIZE_FRAGMENTS\020\003\022\027\n\023"
+    "REQ_CANCEL_FRAGMENT\020\006\022\031\n\025REQ_RECEIVER_FI"
+    "NISHED\020\007\022\027\n\023REQ_FRAGMENT_STATUS\020\010\022\022\n\016REQ"
+    "_BIT_STATUS\020\t\022\024\n\020REQ_QUERY_STATUS\020\n\022\030\n\024R"
+    "ESP_FRAGMENT_HANDLE\020\013\022\030\n\024RESP_FRAGMENT_S"
+    "TATUS\020\014\022\023\n\017RESP_BIT_STATUS\020\r\022\025\n\021RESP_QUE"
+    "RY_STATUS\020\016B+\n\033org.apache.drill.exec.pro"
+    "toB\nBitControlH\001", 1496);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "BitControl.proto", &protobuf_RegisterTypes);
   BitControlHandshake::default_instance_ = new BitControlHandshake();
   BitStatus::default_instance_ = new BitStatus();
   FragmentStatus::default_instance_ = new FragmentStatus();
+  InitializeFragments::default_instance_ = new InitializeFragments();
   PlanFragment::default_instance_ = new PlanFragment();
   WorkQueueStatus::default_instance_ = new WorkQueueStatus();
   FinishedReceiver::default_instance_ = new FinishedReceiver();
   BitControlHandshake::default_instance_->InitAsDefaultInstance();
   BitStatus::default_instance_->InitAsDefaultInstance();
   FragmentStatus::default_instance_->InitAsDefaultInstance();
+  InitializeFragments::default_instance_->InitAsDefaultInstance();
   PlanFragment::default_instance_->InitAsDefaultInstance();
   WorkQueueStatus::default_instance_->InitAsDefaultInstance();
   FinishedReceiver::default_instance_->InitAsDefaultInstance();
@@ -1063,6 +1089,209 @@ void FragmentStatus::Swap(FragmentStatus* other) {
 // ===================================================================
 
 #ifndef _MSC_VER
+const int InitializeFragments::kFragmentFieldNumber;
+#endif  // !_MSC_VER
+
+InitializeFragments::InitializeFragments()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void InitializeFragments::InitAsDefaultInstance() {
+}
+
+InitializeFragments::InitializeFragments(const InitializeFragments& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void InitializeFragments::SharedCtor() {
+  _cached_size_ = 0;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+InitializeFragments::~InitializeFragments() {
+  SharedDtor();
+}
+
+void InitializeFragments::SharedDtor() {
+  if (this != default_instance_) {
+  }
+}
+
+void InitializeFragments::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* InitializeFragments::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return InitializeFragments_descriptor_;
+}
+
+const InitializeFragments& InitializeFragments::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_BitControl_2eproto();
+  return *default_instance_;
+}
+
+InitializeFragments* InitializeFragments::default_instance_ = NULL;
+
+InitializeFragments* InitializeFragments::New() const {
+  return new InitializeFragments;
+}
+
+void InitializeFragments::Clear() {
+  fragment_.Clear();
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool InitializeFragments::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // repeated .exec.bit.control.PlanFragment fragment = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_fragment:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+                input, add_fragment()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(10)) goto parse_fragment;
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void InitializeFragments::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // repeated .exec.bit.control.PlanFragment fragment = 1;
+  for (int i = 0; i < this->fragment_size(); i++) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      1, this->fragment(i), output);
+  }
+
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* InitializeFragments::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // repeated .exec.bit.control.PlanFragment fragment = 1;
+  for (int i = 0; i < this->fragment_size(); i++) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        1, this->fragment(i), target);
+  }
+
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int InitializeFragments::ByteSize() const {
+  int total_size = 0;
+
+  // repeated .exec.bit.control.PlanFragment fragment = 1;
+  total_size += 1 * this->fragment_size();
+  for (int i = 0; i < this->fragment_size(); i++) {
+    total_size +=
+      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+        this->fragment(i));
+  }
+
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void InitializeFragments::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const InitializeFragments* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const InitializeFragments*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void InitializeFragments::MergeFrom(const InitializeFragments& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  fragment_.MergeFrom(from.fragment_);
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void InitializeFragments::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void InitializeFragments::CopyFrom(const InitializeFragments& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool InitializeFragments::IsInitialized() const {
+
+  return true;
+}
+
+void InitializeFragments::Swap(InitializeFragments* other) {
+  if (other != this) {
+    fragment_.Swap(&other->fragment_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata InitializeFragments::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = InitializeFragments_descriptor_;
+  metadata.reflection = InitializeFragments_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
 const int PlanFragment::kHandleFieldNumber;
 const int PlanFragment::kNetworkCostFieldNumber;
 const int PlanFragment::kCpuCostFieldNumber;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1d7f6211/contrib/native/client/src/protobuf/BitControl.pb.h
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/protobuf/BitControl.pb.h b/contrib/native/client/src/protobuf/BitControl.pb.h
index 011f8a8..798da33 100644
--- a/contrib/native/client/src/protobuf/BitControl.pb.h
+++ b/contrib/native/client/src/protobuf/BitControl.pb.h
@@ -42,6 +42,7 @@ void protobuf_ShutdownFile_BitControl_2eproto();
 class BitControlHandshake;
 class BitStatus;
 class FragmentStatus;
+class InitializeFragments;
 class PlanFragment;
 class WorkQueueStatus;
 class FinishedReceiver;
@@ -50,7 +51,7 @@ enum RpcType {
   HANDSHAKE = 0,
   ACK = 1,
   GOODBYE = 2,
-  REQ_INIATILIZE_FRAGMENT = 3,
+  REQ_INIATILIZE_FRAGMENTS = 3,
   REQ_CANCEL_FRAGMENT = 6,
   REQ_RECEIVER_FINISHED = 7,
   REQ_FRAGMENT_STATUS = 8,
@@ -363,6 +364,91 @@ class FragmentStatus : public ::google::protobuf::Message {
 };
 // -------------------------------------------------------------------
 
+class InitializeFragments : public ::google::protobuf::Message {
+ public:
+  InitializeFragments();
+  virtual ~InitializeFragments();
+
+  InitializeFragments(const InitializeFragments& from);
+
+  inline InitializeFragments& operator=(const InitializeFragments& from) {
+    CopyFrom(from);
+    return *this;
+  }
+
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const InitializeFragments& default_instance();
+
+  void Swap(InitializeFragments* other);
+
+  // implements Message ----------------------------------------------
+
+  InitializeFragments* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const InitializeFragments& from);
+  void MergeFrom(const InitializeFragments& from);
+  void Clear();
+  bool IsInitialized() const;
+
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // repeated .exec.bit.control.PlanFragment fragment = 1;
+  inline int fragment_size() const;
+  inline void clear_fragment();
+  static const int kFragmentFieldNumber = 1;
+  inline const ::exec::bit::control::PlanFragment& fragment(int index) const;
+  inline ::exec::bit::control::PlanFragment* mutable_fragment(int index);
+  inline ::exec::bit::control::PlanFragment* add_fragment();
+  inline const ::google::protobuf::RepeatedPtrField< ::exec::bit::control::PlanFragment >&
+      fragment() const;
+  inline ::google::protobuf::RepeatedPtrField< ::exec::bit::control::PlanFragment >*
+      mutable_fragment();
+
+  // @@protoc_insertion_point(class_scope:exec.bit.control.InitializeFragments)
+ private:
+
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+
+  ::google::protobuf::RepeatedPtrField< ::exec::bit::control::PlanFragment > fragment_;
+
+  mutable int _cached_size_;
+  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+
+  friend void  protobuf_AddDesc_BitControl_2eproto();
+  friend void protobuf_AssignDesc_BitControl_2eproto();
+  friend void protobuf_ShutdownFile_BitControl_2eproto();
+
+  void InitAsDefaultInstance();
+  static InitializeFragments* default_instance_;
+};
+// -------------------------------------------------------------------
+
 class PlanFragment : public ::google::protobuf::Message {
  public:
   PlanFragment();
@@ -1002,6 +1088,35 @@ inline void FragmentStatus::set_allocated_handle(::exec::bit::FragmentHandle* ha
 
 // -------------------------------------------------------------------
 
+// InitializeFragments
+
+// repeated .exec.bit.control.PlanFragment fragment = 1;
+inline int InitializeFragments::fragment_size() const {
+  return fragment_.size();
+}
+inline void InitializeFragments::clear_fragment() {
+  fragment_.Clear();
+}
+inline const ::exec::bit::control::PlanFragment& InitializeFragments::fragment(int index) const {
+  return fragment_.Get(index);
+}
+inline ::exec::bit::control::PlanFragment* InitializeFragments::mutable_fragment(int index) {
+  return fragment_.Mutable(index);
+}
+inline ::exec::bit::control::PlanFragment* InitializeFragments::add_fragment() {
+  return fragment_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::exec::bit::control::PlanFragment >&
+InitializeFragments::fragment() const {
+  return fragment_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::exec::bit::control::PlanFragment >*
+InitializeFragments::mutable_fragment() {
+  return &fragment_;
+}
+
+// -------------------------------------------------------------------
+
 // PlanFragment
 
 // optional .exec.bit.FragmentHandle handle = 1;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1d7f6211/contrib/native/client/src/protobuf/GeneralRPC.pb.cc
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/protobuf/GeneralRPC.pb.cc b/contrib/native/client/src/protobuf/GeneralRPC.pb.cc
index 68929cc..0ebb3a9 100644
--- a/contrib/native/client/src/protobuf/GeneralRPC.pb.cc
+++ b/contrib/native/client/src/protobuf/GeneralRPC.pb.cc
@@ -30,9 +30,6 @@ const ::google::protobuf::internal::GeneratedMessageReflection*
 const ::google::protobuf::Descriptor* CompleteRpcMessage_descriptor_ = NULL;
 const ::google::protobuf::internal::GeneratedMessageReflection*
   CompleteRpcMessage_reflection_ = NULL;
-const ::google::protobuf::Descriptor* RpcFailure_descriptor_ = NULL;
-const ::google::protobuf::internal::GeneratedMessageReflection*
-  RpcFailure_reflection_ = NULL;
 const ::google::protobuf::EnumDescriptor* RpcMode_descriptor_ = NULL;
 
 }  // namespace
@@ -93,24 +90,6 @@ void protobuf_AssignDesc_GeneralRPC_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(CompleteRpcMessage));
-  RpcFailure_descriptor_ = file->message_type(3);
-  static const int RpcFailure_offsets_[4] = {
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RpcFailure, error_id_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RpcFailure, error_code_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RpcFailure, short_error_),
-    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RpcFailure, long_error_),
-  };
-  RpcFailure_reflection_ =
-    new ::google::protobuf::internal::GeneratedMessageReflection(
-      RpcFailure_descriptor_,
-      RpcFailure::default_instance_,
-      RpcFailure_offsets_,
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RpcFailure, _has_bits_[0]),
-      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RpcFailure, _unknown_fields_),
-      -1,
-      ::google::protobuf::DescriptorPool::generated_pool(),
-      ::google::protobuf::MessageFactory::generated_factory(),
-      sizeof(RpcFailure));
   RpcMode_descriptor_ = file->enum_type(0);
 }
 
@@ -130,8 +109,6 @@ void protobuf_RegisterTypes(const ::std::string&) {
     RpcHeader_descriptor_, &RpcHeader::default_instance());
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
     CompleteRpcMessage_descriptor_, &CompleteRpcMessage::default_instance());
-  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
-    RpcFailure_descriptor_, &RpcFailure::default_instance());
 }
 
 }  // namespace
@@ -143,8 +120,6 @@ void protobuf_ShutdownFile_GeneralRPC_2eproto() {
   delete RpcHeader_reflection_;
   delete CompleteRpcMessage::default_instance_;
   delete CompleteRpcMessage_reflection_;
-  delete RpcFailure::default_instance_;
-  delete RpcFailure_reflection_;
 }
 
 void protobuf_AddDesc_GeneralRPC_2eproto() {
@@ -161,22 +136,18 @@ void protobuf_AddDesc_GeneralRPC_2eproto() {
     "rdination_id\030\002 \001(\005\022\020\n\010rpc_type\030\003 \001(\005\"b\n\022"
     "CompleteRpcMessage\022#\n\006header\030\001 \001(\0132\023.exe"
     "c.rpc.RpcHeader\022\025\n\rprotobuf_body\030\002 \001(\014\022\020"
-    "\n\010raw_body\030\003 \001(\014\"[\n\nRpcFailure\022\020\n\010error_"
-    "id\030\001 \001(\003\022\022\n\nerror_code\030\002 \001(\005\022\023\n\013short_er"
-    "ror\030\003 \001(\t\022\022\n\nlong_error\030\004 \001(\t*:\n\007RpcMode"
-    "\022\013\n\007REQUEST\020\000\022\014\n\010RESPONSE\020\001\022\024\n\020RESPONSE_"
-    "FAILURE\020\002B1\n\033org.apache.drill.exec.proto"
-    "B\020GeneralRPCProtosH\001", 460);
+    "\n\010raw_body\030\003 \001(\014*:\n\007RpcMode\022\013\n\007REQUEST\020\000"
+    "\022\014\n\010RESPONSE\020\001\022\024\n\020RESPONSE_FAILURE\020\002B1\n\033"
+    "org.apache.drill.exec.protoB\020GeneralRPCP"
+    "rotosH\001", 367);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "GeneralRPC.proto", &protobuf_RegisterTypes);
   Ack::default_instance_ = new Ack();
   RpcHeader::default_instance_ = new RpcHeader();
   CompleteRpcMessage::default_instance_ = new CompleteRpcMessage();
-  RpcFailure::default_instance_ = new RpcFailure();
   Ack::default_instance_->InitAsDefaultInstance();
   RpcHeader::default_instance_->InitAsDefaultInstance();
   CompleteRpcMessage::default_instance_->InitAsDefaultInstance();
-  RpcFailure::default_instance_->InitAsDefaultInstance();
   ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_GeneralRPC_2eproto);
 }
 
@@ -1011,368 +982,6 @@ void CompleteRpcMessage::Swap(CompleteRpcMessage* other) {
 }
 
 
-// ===================================================================
-
-#ifndef _MSC_VER
-const int RpcFailure::kErrorIdFieldNumber;
-const int RpcFailure::kErrorCodeFieldNumber;
-const int RpcFailure::kShortErrorFieldNumber;
-const int RpcFailure::kLongErrorFieldNumber;
-#endif  // !_MSC_VER
-
-RpcFailure::RpcFailure()
-  : ::google::protobuf::Message() {
-  SharedCtor();
-}
-
-void RpcFailure::InitAsDefaultInstance() {
-}
-
-RpcFailure::RpcFailure(const RpcFailure& from)
-  : ::google::protobuf::Message() {
-  SharedCtor();
-  MergeFrom(from);
-}
-
-void RpcFailure::SharedCtor() {
-  _cached_size_ = 0;
-  error_id_ = GOOGLE_LONGLONG(0);
-  error_code_ = 0;
-  short_error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
-  long_error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-RpcFailure::~RpcFailure() {
-  SharedDtor();
-}
-
-void RpcFailure::SharedDtor() {
-  if (short_error_ != &::google::protobuf::internal::kEmptyString) {
-    delete short_error_;
-  }
-  if (long_error_ != &::google::protobuf::internal::kEmptyString) {
-    delete long_error_;
-  }
-  if (this != default_instance_) {
-  }
-}
-
-void RpcFailure::SetCachedSize(int size) const {
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const ::google::protobuf::Descriptor* RpcFailure::descriptor() {
-  protobuf_AssignDescriptorsOnce();
-  return RpcFailure_descriptor_;
-}
-
-const RpcFailure& RpcFailure::default_instance() {
-  if (default_instance_ == NULL) protobuf_AddDesc_GeneralRPC_2eproto();
-  return *default_instance_;
-}
-
-RpcFailure* RpcFailure::default_instance_ = NULL;
-
-RpcFailure* RpcFailure::New() const {
-  return new RpcFailure;
-}
-
-void RpcFailure::Clear() {
-  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    error_id_ = GOOGLE_LONGLONG(0);
-    error_code_ = 0;
-    if (has_short_error()) {
-      if (short_error_ != &::google::protobuf::internal::kEmptyString) {
-        short_error_->clear();
-      }
-    }
-    if (has_long_error()) {
-      if (long_error_ != &::google::protobuf::internal::kEmptyString) {
-        long_error_->clear();
-      }
-    }
-  }
-  ::memset(_has_bits_, 0, sizeof(_has_bits_));
-  mutable_unknown_fields()->Clear();
-}
-
-bool RpcFailure::MergePartialFromCodedStream(
-    ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
-  ::google::protobuf::uint32 tag;
-  while ((tag = input->ReadTag()) != 0) {
-    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
-      // optional int64 error_id = 1;
-      case 1: {
-        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
-                 input, &error_id_)));
-          set_has_error_id();
-        } else {
-          goto handle_uninterpreted;
-        }
-        if (input->ExpectTag(16)) goto parse_error_code;
-        break;
-      }
-
-      // optional int32 error_code = 2;
-      case 2: {
-        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
-         parse_error_code:
-          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
-                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
-                 input, &error_code_)));
-          set_has_error_code();
-        } else {
-          goto handle_uninterpreted;
-        }
-        if (input->ExpectTag(26)) goto parse_short_error;
-        break;
-      }
-
-      // optional string short_error = 3;
-      case 3: {
-        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
-         parse_short_error:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
-                input, this->mutable_short_error()));
-          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
-            this->short_error().data(), this->short_error().length(),
-            ::google::protobuf::internal::WireFormat::PARSE);
-        } else {
-          goto handle_uninterpreted;
-        }
-        if (input->ExpectTag(34)) goto parse_long_error;
-        break;
-      }
-
-      // optional string long_error = 4;
-      case 4: {
-        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
-         parse_long_error:
-          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
-                input, this->mutable_long_error()));
-          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
-            this->long_error().data(), this->long_error().length(),
-            ::google::protobuf::internal::WireFormat::PARSE);
-        } else {
-          goto handle_uninterpreted;
-        }
-        if (input->ExpectAtEnd()) return true;
-        break;
-      }
-
-      default: {
-      handle_uninterpreted:
-        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
-            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
-          return true;
-        }
-        DO_(::google::protobuf::internal::WireFormat::SkipField(
-              input, tag, mutable_unknown_fields()));
-        break;
-      }
-    }
-  }
-  return true;
-#undef DO_
-}
-
-void RpcFailure::SerializeWithCachedSizes(
-    ::google::protobuf::io::CodedOutputStream* output) const {
-  // optional int64 error_id = 1;
-  if (has_error_id()) {
-    ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->error_id(), output);
-  }
-
-  // optional int32 error_code = 2;
-  if (has_error_code()) {
-    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->error_code(), output);
-  }
-
-  // optional string short_error = 3;
-  if (has_short_error()) {
-    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
-      this->short_error().data(), this->short_error().length(),
-      ::google::protobuf::internal::WireFormat::SERIALIZE);
-    ::google::protobuf::internal::WireFormatLite::WriteString(
-      3, this->short_error(), output);
-  }
-
-  // optional string long_error = 4;
-  if (has_long_error()) {
-    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
-      this->long_error().data(), this->long_error().length(),
-      ::google::protobuf::internal::WireFormat::SERIALIZE);
-    ::google::protobuf::internal::WireFormatLite::WriteString(
-      4, this->long_error(), output);
-  }
-
-  if (!unknown_fields().empty()) {
-    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
-        unknown_fields(), output);
-  }
-}
-
-::google::protobuf::uint8* RpcFailure::SerializeWithCachedSizesToArray(
-    ::google::protobuf::uint8* target) const {
-  // optional int64 error_id = 1;
-  if (has_error_id()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->error_id(), target);
-  }
-
-  // optional int32 error_code = 2;
-  if (has_error_code()) {
-    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->error_code(), target);
-  }
-
-  // optional string short_error = 3;
-  if (has_short_error()) {
-    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
-      this->short_error().data(), this->short_error().length(),
-      ::google::protobuf::internal::WireFormat::SERIALIZE);
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
-        3, this->short_error(), target);
-  }
-
-  // optional string long_error = 4;
-  if (has_long_error()) {
-    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
-      this->long_error().data(), this->long_error().length(),
-      ::google::protobuf::internal::WireFormat::SERIALIZE);
-    target =
-      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
-        4, this->long_error(), target);
-  }
-
-  if (!unknown_fields().empty()) {
-    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
-        unknown_fields(), target);
-  }
-  return target;
-}
-
-int RpcFailure::ByteSize() const {
-  int total_size = 0;
-
-  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    // optional int64 error_id = 1;
-    if (has_error_id()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::Int64Size(
-          this->error_id());
-    }
-
-    // optional int32 error_code = 2;
-    if (has_error_code()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::Int32Size(
-          this->error_code());
-    }
-
-    // optional string short_error = 3;
-    if (has_short_error()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::StringSize(
-          this->short_error());
-    }
-
-    // optional string long_error = 4;
-    if (has_long_error()) {
-      total_size += 1 +
-        ::google::protobuf::internal::WireFormatLite::StringSize(
-          this->long_error());
-    }
-
-  }
-  if (!unknown_fields().empty()) {
-    total_size +=
-      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
-        unknown_fields());
-  }
-  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
-  _cached_size_ = total_size;
-  GOOGLE_SAFE_CONCURRENT_WRITES_END();
-  return total_size;
-}
-
-void RpcFailure::MergeFrom(const ::google::protobuf::Message& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  const RpcFailure* source =
-    ::google::protobuf::internal::dynamic_cast_if_available<const RpcFailure*>(
-      &from);
-  if (source == NULL) {
-    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
-  } else {
-    MergeFrom(*source);
-  }
-}
-
-void RpcFailure::MergeFrom(const RpcFailure& from) {
-  GOOGLE_CHECK_NE(&from, this);
-  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
-    if (from.has_error_id()) {
-      set_error_id(from.error_id());
-    }
-    if (from.has_error_code()) {
-      set_error_code(from.error_code());
-    }
-    if (from.has_short_error()) {
-      set_short_error(from.short_error());
-    }
-    if (from.has_long_error()) {
-      set_long_error(from.long_error());
-    }
-  }
-  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
-}
-
-void RpcFailure::CopyFrom(const ::google::protobuf::Message& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-void RpcFailure::CopyFrom(const RpcFailure& from) {
-  if (&from == this) return;
-  Clear();
-  MergeFrom(from);
-}
-
-bool RpcFailure::IsInitialized() const {
-
-  return true;
-}
-
-void RpcFailure::Swap(RpcFailure* other) {
-  if (other != this) {
-    std::swap(error_id_, other->error_id_);
-    std::swap(error_code_, other->error_code_);
-    std::swap(short_error_, other->short_error_);
-    std::swap(long_error_, other->long_error_);
-    std::swap(_has_bits_[0], other->_has_bits_[0]);
-    _unknown_fields_.Swap(&other->_unknown_fields_);
-    std::swap(_cached_size_, other->_cached_size_);
-  }
-}
-
-::google::protobuf::Metadata RpcFailure::GetMetadata() const {
-  protobuf_AssignDescriptorsOnce();
-  ::google::protobuf::Metadata metadata;
-  metadata.descriptor = RpcFailure_descriptor_;
-  metadata.reflection = RpcFailure_reflection_;
-  return metadata;
-}
-
-
 // @@protoc_insertion_point(namespace_scope)
 
 }  // namespace rpc

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1d7f6211/contrib/native/client/src/protobuf/GeneralRPC.pb.h
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/protobuf/GeneralRPC.pb.h b/contrib/native/client/src/protobuf/GeneralRPC.pb.h
index cfafd65..49f4bf7 100644
--- a/contrib/native/client/src/protobuf/GeneralRPC.pb.h
+++ b/contrib/native/client/src/protobuf/GeneralRPC.pb.h
@@ -39,7 +39,6 @@ void protobuf_ShutdownFile_GeneralRPC_2eproto();
 class Ack;
 class RpcHeader;
 class CompleteRpcMessage;
-class RpcFailure;
 
 enum RpcMode {
   REQUEST = 0,
@@ -359,128 +358,6 @@ class CompleteRpcMessage : public ::google::protobuf::Message {
   void InitAsDefaultInstance();
   static CompleteRpcMessage* default_instance_;
 };
-// -------------------------------------------------------------------
-
-class RpcFailure : public ::google::protobuf::Message {
- public:
-  RpcFailure();
-  virtual ~RpcFailure();
-
-  RpcFailure(const RpcFailure& from);
-
-  inline RpcFailure& operator=(const RpcFailure& from) {
-    CopyFrom(from);
-    return *this;
-  }
-
-  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
-    return _unknown_fields_;
-  }
-
-  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
-    return &_unknown_fields_;
-  }
-
-  static const ::google::protobuf::Descriptor* descriptor();
-  static const RpcFailure& default_instance();
-
-  void Swap(RpcFailure* other);
-
-  // implements Message ----------------------------------------------
-
-  RpcFailure* New() const;
-  void CopyFrom(const ::google::protobuf::Message& from);
-  void MergeFrom(const ::google::protobuf::Message& from);
-  void CopyFrom(const RpcFailure& from);
-  void MergeFrom(const RpcFailure& from);
-  void Clear();
-  bool IsInitialized() const;
-
-  int ByteSize() const;
-  bool MergePartialFromCodedStream(
-      ::google::protobuf::io::CodedInputStream* input);
-  void SerializeWithCachedSizes(
-      ::google::protobuf::io::CodedOutputStream* output) const;
-  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
-  int GetCachedSize() const { return _cached_size_; }
-  private:
-  void SharedCtor();
-  void SharedDtor();
-  void SetCachedSize(int size) const;
-  public:
-
-  ::google::protobuf::Metadata GetMetadata() const;
-
-  // nested types ----------------------------------------------------
-
-  // accessors -------------------------------------------------------
-
-  // optional int64 error_id = 1;
-  inline bool has_error_id() const;
-  inline void clear_error_id();
-  static const int kErrorIdFieldNumber = 1;
-  inline ::google::protobuf::int64 error_id() const;
-  inline void set_error_id(::google::protobuf::int64 value);
-
-  // optional int32 error_code = 2;
-  inline bool has_error_code() const;
-  inline void clear_error_code();
-  static const int kErrorCodeFieldNumber = 2;
-  inline ::google::protobuf::int32 error_code() const;
-  inline void set_error_code(::google::protobuf::int32 value);
-
-  // optional string short_error = 3;
-  inline bool has_short_error() const;
-  inline void clear_short_error();
-  static const int kShortErrorFieldNumber = 3;
-  inline const ::std::string& short_error() const;
-  inline void set_short_error(const ::std::string& value);
-  inline void set_short_error(const char* value);
-  inline void set_short_error(const char* value, size_t size);
-  inline ::std::string* mutable_short_error();
-  inline ::std::string* release_short_error();
-  inline void set_allocated_short_error(::std::string* short_error);
-
-  // optional string long_error = 4;
-  inline bool has_long_error() const;
-  inline void clear_long_error();
-  static const int kLongErrorFieldNumber = 4;
-  inline const ::std::string& long_error() const;
-  inline void set_long_error(const ::std::string& value);
-  inline void set_long_error(const char* value);
-  inline void set_long_error(const char* value, size_t size);
-  inline ::std::string* mutable_long_error();
-  inline ::std::string* release_long_error();
-  inline void set_allocated_long_error(::std::string* long_error);
-
-  // @@protoc_insertion_point(class_scope:exec.rpc.RpcFailure)
- private:
-  inline void set_has_error_id();
-  inline void clear_has_error_id();
-  inline void set_has_error_code();
-  inline void clear_has_error_code();
-  inline void set_has_short_error();
-  inline void clear_has_short_error();
-  inline void set_has_long_error();
-  inline void clear_has_long_error();
-
-  ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
-  ::google::protobuf::int64 error_id_;
-  ::std::string* short_error_;
-  ::std::string* long_error_;
-  ::google::protobuf::int32 error_code_;
-
-  mutable int _cached_size_;
-  ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
-
-  friend void  protobuf_AddDesc_GeneralRPC_2eproto();
-  friend void protobuf_AssignDesc_GeneralRPC_2eproto();
-  friend void protobuf_ShutdownFile_GeneralRPC_2eproto();
-
-  void InitAsDefaultInstance();
-  static RpcFailure* default_instance_;
-};
 // ===================================================================
 
 
@@ -763,194 +640,6 @@ inline void CompleteRpcMessage::set_allocated_raw_body(::std::string* raw_body)
   }
 }
 
-// -------------------------------------------------------------------
-
-// RpcFailure
-
-// optional int64 error_id = 1;
-inline bool RpcFailure::has_error_id() const {
-  return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void RpcFailure::set_has_error_id() {
-  _has_bits_[0] |= 0x00000001u;
-}
-inline void RpcFailure::clear_has_error_id() {
-  _has_bits_[0] &= ~0x00000001u;
-}
-inline void RpcFailure::clear_error_id() {
-  error_id_ = GOOGLE_LONGLONG(0);
-  clear_has_error_id();
-}
-inline ::google::protobuf::int64 RpcFailure::error_id() const {
-  return error_id_;
-}
-inline void RpcFailure::set_error_id(::google::protobuf::int64 value) {
-  set_has_error_id();
-  error_id_ = value;
-}
-
-// optional int32 error_code = 2;
-inline bool RpcFailure::has_error_code() const {
-  return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void RpcFailure::set_has_error_code() {
-  _has_bits_[0] |= 0x00000002u;
-}
-inline void RpcFailure::clear_has_error_code() {
-  _has_bits_[0] &= ~0x00000002u;
-}
-inline void RpcFailure::clear_error_code() {
-  error_code_ = 0;
-  clear_has_error_code();
-}
-inline ::google::protobuf::int32 RpcFailure::error_code() const {
-  return error_code_;
-}
-inline void RpcFailure::set_error_code(::google::protobuf::int32 value) {
-  set_has_error_code();
-  error_code_ = value;
-}
-
-// optional string short_error = 3;
-inline bool RpcFailure::has_short_error() const {
-  return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void RpcFailure::set_has_short_error() {
-  _has_bits_[0] |= 0x00000004u;
-}
-inline void RpcFailure::clear_has_short_error() {
-  _has_bits_[0] &= ~0x00000004u;
-}
-inline void RpcFailure::clear_short_error() {
-  if (short_error_ != &::google::protobuf::internal::kEmptyString) {
-    short_error_->clear();
-  }
-  clear_has_short_error();
-}
-inline const ::std::string& RpcFailure::short_error() const {
-  return *short_error_;
-}
-inline void RpcFailure::set_short_error(const ::std::string& value) {
-  set_has_short_error();
-  if (short_error_ == &::google::protobuf::internal::kEmptyString) {
-    short_error_ = new ::std::string;
-  }
-  short_error_->assign(value);
-}
-inline void RpcFailure::set_short_error(const char* value) {
-  set_has_short_error();
-  if (short_error_ == &::google::protobuf::internal::kEmptyString) {
-    short_error_ = new ::std::string;
-  }
-  short_error_->assign(value);
-}
-inline void RpcFailure::set_short_error(const char* value, size_t size) {
-  set_has_short_error();
-  if (short_error_ == &::google::protobuf::internal::kEmptyString) {
-    short_error_ = new ::std::string;
-  }
-  short_error_->assign(reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* RpcFailure::mutable_short_error() {
-  set_has_short_error();
-  if (short_error_ == &::google::protobuf::internal::kEmptyString) {
-    short_error_ = new ::std::string;
-  }
-  return short_error_;
-}
-inline ::std::string* RpcFailure::release_short_error() {
-  clear_has_short_error();
-  if (short_error_ == &::google::protobuf::internal::kEmptyString) {
-    return NULL;
-  } else {
-    ::std::string* temp = short_error_;
-    short_error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
-    return temp;
-  }
-}
-inline void RpcFailure::set_allocated_short_error(::std::string* short_error) {
-  if (short_error_ != &::google::protobuf::internal::kEmptyString) {
-    delete short_error_;
-  }
-  if (short_error) {
-    set_has_short_error();
-    short_error_ = short_error;
-  } else {
-    clear_has_short_error();
-    short_error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
-  }
-}
-
-// optional string long_error = 4;
-inline bool RpcFailure::has_long_error() const {
-  return (_has_bits_[0] & 0x00000008u) != 0;
-}
-inline void RpcFailure::set_has_long_error() {
-  _has_bits_[0] |= 0x00000008u;
-}
-inline void RpcFailure::clear_has_long_error() {
-  _has_bits_[0] &= ~0x00000008u;
-}
-inline void RpcFailure::clear_long_error() {
-  if (long_error_ != &::google::protobuf::internal::kEmptyString) {
-    long_error_->clear();
-  }
-  clear_has_long_error();
-}
-inline const ::std::string& RpcFailure::long_error() const {
-  return *long_error_;
-}
-inline void RpcFailure::set_long_error(const ::std::string& value) {
-  set_has_long_error();
-  if (long_error_ == &::google::protobuf::internal::kEmptyString) {
-    long_error_ = new ::std::string;
-  }
-  long_error_->assign(value);
-}
-inline void RpcFailure::set_long_error(const char* value) {
-  set_has_long_error();
-  if (long_error_ == &::google::protobuf::internal::kEmptyString) {
-    long_error_ = new ::std::string;
-  }
-  long_error_->assign(value);
-}
-inline void RpcFailure::set_long_error(const char* value, size_t size) {
-  set_has_long_error();
-  if (long_error_ == &::google::protobuf::internal::kEmptyString) {
-    long_error_ = new ::std::string;
-  }
-  long_error_->assign(reinterpret_cast<const char*>(value), size);
-}
-inline ::std::string* RpcFailure::mutable_long_error() {
-  set_has_long_error();
-  if (long_error_ == &::google::protobuf::internal::kEmptyString) {
-    long_error_ = new ::std::string;
-  }
-  return long_error_;
-}
-inline ::std::string* RpcFailure::release_long_error() {
-  clear_has_long_error();
-  if (long_error_ == &::google::protobuf::internal::kEmptyString) {
-    return NULL;
-  } else {
-    ::std::string* temp = long_error_;
-    long_error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
-    return temp;
-  }
-}
-inline void RpcFailure::set_allocated_long_error(::std::string* long_error) {
-  if (long_error_ != &::google::protobuf::internal::kEmptyString) {
-    delete long_error_;
-  }
-  if (long_error) {
-    set_has_long_error();
-    long_error_ = long_error;
-  } else {
-    clear_has_long_error();
-    long_error_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
-  }
-}
-
 
 // @@protoc_insertion_point(namespace_scope)
 


[16/16] incubator-drill git commit: DRILL-1661: Fix for setValueLengthSafe method in variable length vectors that was causing a failure in the parquet reader.

Posted by jn...@apache.org.
DRILL-1661: Fix for setValueLengthSafe method in variable length vectors that was causing a failure in the parquet reader.


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

Branch: refs/heads/master
Commit: a8fd9758b1f77632a038e43c5ac2cc00e1fa459b
Parents: f7570d9
Author: Jason Altekruse <al...@gmail.com>
Authored: Mon Nov 3 18:14:09 2014 -0800
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 11:36:08 2014 -0800

----------------------------------------------------------------------
 .../src/main/codegen/templates/VariableLengthVectors.java       | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/a8fd9758/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 e1a754e..5338a71 100644
--- a/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/VariableLengthVectors.java
@@ -451,6 +451,11 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
     }
 
     public boolean setValueLengthSafe(int index, int length) {
+      int offset = offsetVector.getAccessor().get(index);
+      if(data.capacity() < offset + length ) {
+        decrementAllocationMonitor();
+        return false;
+      }
       return offsetVector.getMutator().setSafe(index + 1, offsetVector.getAccessor().get(index) + length);
     }
 


[02/16] incubator-drill git commit: DRILL-1566: C++ Client does not handle incoming record batches with zero records

Posted by jn...@apache.org.
DRILL-1566: C++ Client does not handle incoming record batches with zero records


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

Branch: refs/heads/master
Commit: fdbd6a9fc8d846567a272025bd37002d43c7a3fa
Parents: 2e07c62
Author: Parth Chandra <pc...@maprtech.com>
Authored: Tue Oct 21 14:30:50 2014 -0700
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:55 2014 -0800

----------------------------------------------------------------------
 contrib/native/client/example/querySubmitter.cpp        |  2 +-
 contrib/native/client/src/clientlib/drillClientImpl.cpp | 12 +++++++++---
 contrib/native/client/src/clientlib/recordBatch.cpp     |  5 ++++-
 contrib/native/client/src/include/drill/recordBatch.hpp |  6 ++++--
 4 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/fdbd6a9f/contrib/native/client/example/querySubmitter.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/example/querySubmitter.cpp b/contrib/native/client/example/querySubmitter.cpp
index 040f9d7..7b98bc9 100644
--- a/contrib/native/client/example/querySubmitter.cpp
+++ b/contrib/native/client/example/querySubmitter.cpp
@@ -71,7 +71,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{
         assert(b==NULL);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/fdbd6a9f/contrib/native/client/src/clientlib/drillClientImpl.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp
index 2f27b48..cc70020 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -509,8 +509,10 @@ status_t DrillClientImpl::processQueryResult(AllocatedBufferPtr  allocatedBuffer
                     // Ignore these state messages since they means the query is not completed.
                     // I have not observed those messages in testing though.
                     break;
+                    
                 // m_pendingRequests should be decremented when the query is
-                // canncelled or completed
+                // canceled or completed
+                // in both cases, fall back to free mememory
                 case exec::shared::QueryResult_QueryState_CANCELED:
                     ret=handleTerminatedQryState(ret,
                             getMessage(ERR_QRY_CANCELED),
@@ -519,7 +521,6 @@ status_t DrillClientImpl::processQueryResult(AllocatedBufferPtr  allocatedBuffer
                     ret=handleTerminatedQryState(ret,
                             getMessage(ERR_QRY_COMPLETED),
                             pDrillClientQueryResult);
-                    // in both case, fall back to free mememory
                     delete allocatedBuffer;
                     delete qr;
                     break;
@@ -534,6 +535,8 @@ status_t DrillClientImpl::processQueryResult(AllocatedBufferPtr  allocatedBuffer
                     break;
             }
             return ret;
+        }else{
+            DRILL_LOG(LOG_WARNING) << "DrillClientImpl::processQueryResult: Query State was not set (assuming a query with no result set.\n";
         }
 
         //Validate the RPC message
@@ -562,7 +565,9 @@ status_t DrillClientImpl::processQueryResult(AllocatedBufferPtr  allocatedBuffer
             << pRecordBatch->isLastChunk()  << std::endl;
 
         ret=pDrillClientQueryResult->setupColumnDefs(qr);
-        if(ret==QRY_SUCCESS_WITH_INFO)pRecordBatch->schemaChanged(true);
+        if(ret==QRY_SUCCESS_WITH_INFO){
+            pRecordBatch->schemaChanged(true);
+        }
 
         pDrillClientQueryResult->m_bIsQueryPending=true;
         pDrillClientQueryResult->m_bIsLastChunk=qr->is_last_chunk();
@@ -781,6 +786,7 @@ void DrillClientImpl::broadcastError(DrillClientError* pErr){
     }
     return;
 }
+
 // The implementation is similar to handleQryError
 status_t DrillClientImpl::handleTerminatedQryState(
         status_t status,

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/fdbd6a9f/contrib/native/client/src/clientlib/recordBatch.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/recordBatch.cpp b/contrib/native/client/src/clientlib/recordBatch.cpp
index dfa12fd..2a679fa 100644
--- a/contrib/native/client/src/clientlib/recordBatch.cpp
+++ b/contrib/native/client/src/clientlib/recordBatch.cpp
@@ -346,7 +346,10 @@ ret_t RecordBatch::build(){
         size_t len=pFmd->getBufferLength();
         FieldBatch* pField = new FieldBatch(*pFmd, this->m_buffer, startOffset, len) ;
         startOffset+=len;
-        pField->load(); // set up the value vectors
+        // We may get an empty record batch. All the fields will be empty, except for metadata.
+        if(len>0){
+            pField->load(); // set up the value vectors
+        }
         this->m_fields.push_back(pField);
         this->m_fieldDefs->push_back(pFmd);
     }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/fdbd6a9f/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 de65202..28377cb 100644
--- a/contrib/native/client/src/include/drill/recordBatch.hpp
+++ b/contrib/native/client/src/include/drill/recordBatch.hpp
@@ -804,8 +804,10 @@ class FieldBatch{
     public:
         FieldBatch(const Drill::FieldMetadata& fmd, const ByteBuf_t data, size_t start, size_t length):
             m_fieldMetadata(fmd){
-                m_pValueVector=NULL;
-                m_pFieldData=new SlicedByteBuf(data, start, length);
+                m_pValueVector=NULL;m_pFieldData=NULL;
+                if(length>0){
+                    m_pFieldData=new SlicedByteBuf(data, start, length);
+                }
             }
 
         ~FieldBatch(){


[06/16] incubator-drill git commit: DRILL-1585: C++ Client - Update RPC version and protobuf definitions for RPC version 3

Posted by jn...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1d7f6211/contrib/native/client/src/protobuf/UserBitShared.pb.h
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/protobuf/UserBitShared.pb.h b/contrib/native/client/src/protobuf/UserBitShared.pb.h
index e7d40b1..cfe6938 100644
--- a/contrib/native/client/src/protobuf/UserBitShared.pb.h
+++ b/contrib/native/client/src/protobuf/UserBitShared.pb.h
@@ -41,6 +41,8 @@ void protobuf_ShutdownFile_UserBitShared_2eproto();
 class UserCredentials;
 class QueryId;
 class DrillPBError;
+class ExceptionWrapper;
+class StackTraceElementWrapper;
 class ParsingError;
 class RecordBatchDef;
 class NamePart;
@@ -192,11 +194,13 @@ enum CoreOperatorType {
   JSON_SUB_SCAN = 29,
   INFO_SCHEMA_SUB_SCAN = 30,
   COMPLEX_TO_JSON = 31,
-  PRODUCER_CONSUMER = 32
+  PRODUCER_CONSUMER = 32,
+  HBASE_SUB_SCAN = 33,
+  WINDOW = 34
 };
 bool CoreOperatorType_IsValid(int value);
 const CoreOperatorType CoreOperatorType_MIN = SINGLE_SENDER;
-const CoreOperatorType CoreOperatorType_MAX = PRODUCER_CONSUMER;
+const CoreOperatorType CoreOperatorType_MAX = WINDOW;
 const int CoreOperatorType_ARRAYSIZE = CoreOperatorType_MAX + 1;
 
 const ::google::protobuf::EnumDescriptor* CoreOperatorType_descriptor();
@@ -484,10 +488,19 @@ class DrillPBError : public ::google::protobuf::Message {
   inline ::std::string* release_message();
   inline void set_allocated_message(::std::string* message);
 
-  // repeated .exec.shared.ParsingError parsing_error = 5;
+  // optional .exec.shared.ExceptionWrapper exception = 5;
+  inline bool has_exception() const;
+  inline void clear_exception();
+  static const int kExceptionFieldNumber = 5;
+  inline const ::exec::shared::ExceptionWrapper& exception() const;
+  inline ::exec::shared::ExceptionWrapper* mutable_exception();
+  inline ::exec::shared::ExceptionWrapper* release_exception();
+  inline void set_allocated_exception(::exec::shared::ExceptionWrapper* exception);
+
+  // repeated .exec.shared.ParsingError parsing_error = 6;
   inline int parsing_error_size() const;
   inline void clear_parsing_error();
-  static const int kParsingErrorFieldNumber = 5;
+  static const int kParsingErrorFieldNumber = 6;
   inline const ::exec::shared::ParsingError& parsing_error(int index) const;
   inline ::exec::shared::ParsingError* mutable_parsing_error(int index);
   inline ::exec::shared::ParsingError* add_parsing_error();
@@ -506,17 +519,20 @@ class DrillPBError : public ::google::protobuf::Message {
   inline void clear_has_error_type();
   inline void set_has_message();
   inline void clear_has_message();
+  inline void set_has_exception();
+  inline void clear_has_exception();
 
   ::google::protobuf::UnknownFieldSet _unknown_fields_;
 
   ::std::string* error_id_;
   ::exec::DrillbitEndpoint* endpoint_;
   ::std::string* message_;
+  ::exec::shared::ExceptionWrapper* exception_;
   ::google::protobuf::RepeatedPtrField< ::exec::shared::ParsingError > parsing_error_;
   ::google::protobuf::int32 error_type_;
 
   mutable int _cached_size_;
-  ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
+  ::google::protobuf::uint32 _has_bits_[(6 + 31) / 32];
 
   friend void  protobuf_AddDesc_UserBitShared_2eproto();
   friend void protobuf_AssignDesc_UserBitShared_2eproto();
@@ -527,6 +543,270 @@ class DrillPBError : public ::google::protobuf::Message {
 };
 // -------------------------------------------------------------------
 
+class ExceptionWrapper : public ::google::protobuf::Message {
+ public:
+  ExceptionWrapper();
+  virtual ~ExceptionWrapper();
+
+  ExceptionWrapper(const ExceptionWrapper& from);
+
+  inline ExceptionWrapper& operator=(const ExceptionWrapper& from) {
+    CopyFrom(from);
+    return *this;
+  }
+
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const ExceptionWrapper& default_instance();
+
+  void Swap(ExceptionWrapper* other);
+
+  // implements Message ----------------------------------------------
+
+  ExceptionWrapper* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const ExceptionWrapper& from);
+  void MergeFrom(const ExceptionWrapper& from);
+  void Clear();
+  bool IsInitialized() const;
+
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // optional string exception_class = 1;
+  inline bool has_exception_class() const;
+  inline void clear_exception_class();
+  static const int kExceptionClassFieldNumber = 1;
+  inline const ::std::string& exception_class() const;
+  inline void set_exception_class(const ::std::string& value);
+  inline void set_exception_class(const char* value);
+  inline void set_exception_class(const char* value, size_t size);
+  inline ::std::string* mutable_exception_class();
+  inline ::std::string* release_exception_class();
+  inline void set_allocated_exception_class(::std::string* exception_class);
+
+  // optional string message = 2;
+  inline bool has_message() const;
+  inline void clear_message();
+  static const int kMessageFieldNumber = 2;
+  inline const ::std::string& message() const;
+  inline void set_message(const ::std::string& value);
+  inline void set_message(const char* value);
+  inline void set_message(const char* value, size_t size);
+  inline ::std::string* mutable_message();
+  inline ::std::string* release_message();
+  inline void set_allocated_message(::std::string* message);
+
+  // repeated .exec.shared.StackTraceElementWrapper stack_trace = 3;
+  inline int stack_trace_size() const;
+  inline void clear_stack_trace();
+  static const int kStackTraceFieldNumber = 3;
+  inline const ::exec::shared::StackTraceElementWrapper& stack_trace(int index) const;
+  inline ::exec::shared::StackTraceElementWrapper* mutable_stack_trace(int index);
+  inline ::exec::shared::StackTraceElementWrapper* add_stack_trace();
+  inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::StackTraceElementWrapper >&
+      stack_trace() const;
+  inline ::google::protobuf::RepeatedPtrField< ::exec::shared::StackTraceElementWrapper >*
+      mutable_stack_trace();
+
+  // optional .exec.shared.ExceptionWrapper cause = 4;
+  inline bool has_cause() const;
+  inline void clear_cause();
+  static const int kCauseFieldNumber = 4;
+  inline const ::exec::shared::ExceptionWrapper& cause() const;
+  inline ::exec::shared::ExceptionWrapper* mutable_cause();
+  inline ::exec::shared::ExceptionWrapper* release_cause();
+  inline void set_allocated_cause(::exec::shared::ExceptionWrapper* cause);
+
+  // @@protoc_insertion_point(class_scope:exec.shared.ExceptionWrapper)
+ private:
+  inline void set_has_exception_class();
+  inline void clear_has_exception_class();
+  inline void set_has_message();
+  inline void clear_has_message();
+  inline void set_has_cause();
+  inline void clear_has_cause();
+
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+
+  ::std::string* exception_class_;
+  ::std::string* message_;
+  ::google::protobuf::RepeatedPtrField< ::exec::shared::StackTraceElementWrapper > stack_trace_;
+  ::exec::shared::ExceptionWrapper* cause_;
+
+  mutable int _cached_size_;
+  ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+
+  friend void  protobuf_AddDesc_UserBitShared_2eproto();
+  friend void protobuf_AssignDesc_UserBitShared_2eproto();
+  friend void protobuf_ShutdownFile_UserBitShared_2eproto();
+
+  void InitAsDefaultInstance();
+  static ExceptionWrapper* default_instance_;
+};
+// -------------------------------------------------------------------
+
+class StackTraceElementWrapper : public ::google::protobuf::Message {
+ public:
+  StackTraceElementWrapper();
+  virtual ~StackTraceElementWrapper();
+
+  StackTraceElementWrapper(const StackTraceElementWrapper& from);
+
+  inline StackTraceElementWrapper& operator=(const StackTraceElementWrapper& from) {
+    CopyFrom(from);
+    return *this;
+  }
+
+  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+    return _unknown_fields_;
+  }
+
+  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+    return &_unknown_fields_;
+  }
+
+  static const ::google::protobuf::Descriptor* descriptor();
+  static const StackTraceElementWrapper& default_instance();
+
+  void Swap(StackTraceElementWrapper* other);
+
+  // implements Message ----------------------------------------------
+
+  StackTraceElementWrapper* New() const;
+  void CopyFrom(const ::google::protobuf::Message& from);
+  void MergeFrom(const ::google::protobuf::Message& from);
+  void CopyFrom(const StackTraceElementWrapper& from);
+  void MergeFrom(const StackTraceElementWrapper& from);
+  void Clear();
+  bool IsInitialized() const;
+
+  int ByteSize() const;
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input);
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const;
+  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+  int GetCachedSize() const { return _cached_size_; }
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const;
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // optional string class_name = 1;
+  inline bool has_class_name() const;
+  inline void clear_class_name();
+  static const int kClassNameFieldNumber = 1;
+  inline const ::std::string& class_name() const;
+  inline void set_class_name(const ::std::string& value);
+  inline void set_class_name(const char* value);
+  inline void set_class_name(const char* value, size_t size);
+  inline ::std::string* mutable_class_name();
+  inline ::std::string* release_class_name();
+  inline void set_allocated_class_name(::std::string* class_name);
+
+  // optional string file_name = 2;
+  inline bool has_file_name() const;
+  inline void clear_file_name();
+  static const int kFileNameFieldNumber = 2;
+  inline const ::std::string& file_name() const;
+  inline void set_file_name(const ::std::string& value);
+  inline void set_file_name(const char* value);
+  inline void set_file_name(const char* value, size_t size);
+  inline ::std::string* mutable_file_name();
+  inline ::std::string* release_file_name();
+  inline void set_allocated_file_name(::std::string* file_name);
+
+  // optional int32 line_number = 3;
+  inline bool has_line_number() const;
+  inline void clear_line_number();
+  static const int kLineNumberFieldNumber = 3;
+  inline ::google::protobuf::int32 line_number() const;
+  inline void set_line_number(::google::protobuf::int32 value);
+
+  // optional string method_name = 4;
+  inline bool has_method_name() const;
+  inline void clear_method_name();
+  static const int kMethodNameFieldNumber = 4;
+  inline const ::std::string& method_name() const;
+  inline void set_method_name(const ::std::string& value);
+  inline void set_method_name(const char* value);
+  inline void set_method_name(const char* value, size_t size);
+  inline ::std::string* mutable_method_name();
+  inline ::std::string* release_method_name();
+  inline void set_allocated_method_name(::std::string* method_name);
+
+  // optional bool is_native_method = 5;
+  inline bool has_is_native_method() const;
+  inline void clear_is_native_method();
+  static const int kIsNativeMethodFieldNumber = 5;
+  inline bool is_native_method() const;
+  inline void set_is_native_method(bool value);
+
+  // @@protoc_insertion_point(class_scope:exec.shared.StackTraceElementWrapper)
+ private:
+  inline void set_has_class_name();
+  inline void clear_has_class_name();
+  inline void set_has_file_name();
+  inline void clear_has_file_name();
+  inline void set_has_line_number();
+  inline void clear_has_line_number();
+  inline void set_has_method_name();
+  inline void clear_has_method_name();
+  inline void set_has_is_native_method();
+  inline void clear_has_is_native_method();
+
+  ::google::protobuf::UnknownFieldSet _unknown_fields_;
+
+  ::std::string* class_name_;
+  ::std::string* file_name_;
+  ::std::string* method_name_;
+  ::google::protobuf::int32 line_number_;
+  bool is_native_method_;
+
+  mutable int _cached_size_;
+  ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
+
+  friend void  protobuf_AddDesc_UserBitShared_2eproto();
+  friend void protobuf_AssignDesc_UserBitShared_2eproto();
+  friend void protobuf_ShutdownFile_UserBitShared_2eproto();
+
+  void InitAsDefaultInstance();
+  static StackTraceElementWrapper* default_instance_;
+};
+// -------------------------------------------------------------------
+
 class ParsingError : public ::google::protobuf::Message {
  public:
   ParsingError();
@@ -2490,7 +2770,45 @@ inline void DrillPBError::set_allocated_message(::std::string* message) {
   }
 }
 
-// repeated .exec.shared.ParsingError parsing_error = 5;
+// optional .exec.shared.ExceptionWrapper exception = 5;
+inline bool DrillPBError::has_exception() const {
+  return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void DrillPBError::set_has_exception() {
+  _has_bits_[0] |= 0x00000010u;
+}
+inline void DrillPBError::clear_has_exception() {
+  _has_bits_[0] &= ~0x00000010u;
+}
+inline void DrillPBError::clear_exception() {
+  if (exception_ != NULL) exception_->::exec::shared::ExceptionWrapper::Clear();
+  clear_has_exception();
+}
+inline const ::exec::shared::ExceptionWrapper& DrillPBError::exception() const {
+  return exception_ != NULL ? *exception_ : *default_instance_->exception_;
+}
+inline ::exec::shared::ExceptionWrapper* DrillPBError::mutable_exception() {
+  set_has_exception();
+  if (exception_ == NULL) exception_ = new ::exec::shared::ExceptionWrapper;
+  return exception_;
+}
+inline ::exec::shared::ExceptionWrapper* DrillPBError::release_exception() {
+  clear_has_exception();
+  ::exec::shared::ExceptionWrapper* temp = exception_;
+  exception_ = NULL;
+  return temp;
+}
+inline void DrillPBError::set_allocated_exception(::exec::shared::ExceptionWrapper* exception) {
+  delete exception_;
+  exception_ = exception;
+  if (exception) {
+    set_has_exception();
+  } else {
+    clear_has_exception();
+  }
+}
+
+// repeated .exec.shared.ParsingError parsing_error = 6;
 inline int DrillPBError::parsing_error_size() const {
   return parsing_error_.size();
 }
@@ -2517,6 +2835,471 @@ DrillPBError::mutable_parsing_error() {
 
 // -------------------------------------------------------------------
 
+// ExceptionWrapper
+
+// optional string exception_class = 1;
+inline bool ExceptionWrapper::has_exception_class() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void ExceptionWrapper::set_has_exception_class() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void ExceptionWrapper::clear_has_exception_class() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void ExceptionWrapper::clear_exception_class() {
+  if (exception_class_ != &::google::protobuf::internal::kEmptyString) {
+    exception_class_->clear();
+  }
+  clear_has_exception_class();
+}
+inline const ::std::string& ExceptionWrapper::exception_class() const {
+  return *exception_class_;
+}
+inline void ExceptionWrapper::set_exception_class(const ::std::string& value) {
+  set_has_exception_class();
+  if (exception_class_ == &::google::protobuf::internal::kEmptyString) {
+    exception_class_ = new ::std::string;
+  }
+  exception_class_->assign(value);
+}
+inline void ExceptionWrapper::set_exception_class(const char* value) {
+  set_has_exception_class();
+  if (exception_class_ == &::google::protobuf::internal::kEmptyString) {
+    exception_class_ = new ::std::string;
+  }
+  exception_class_->assign(value);
+}
+inline void ExceptionWrapper::set_exception_class(const char* value, size_t size) {
+  set_has_exception_class();
+  if (exception_class_ == &::google::protobuf::internal::kEmptyString) {
+    exception_class_ = new ::std::string;
+  }
+  exception_class_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* ExceptionWrapper::mutable_exception_class() {
+  set_has_exception_class();
+  if (exception_class_ == &::google::protobuf::internal::kEmptyString) {
+    exception_class_ = new ::std::string;
+  }
+  return exception_class_;
+}
+inline ::std::string* ExceptionWrapper::release_exception_class() {
+  clear_has_exception_class();
+  if (exception_class_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = exception_class_;
+    exception_class_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+    return temp;
+  }
+}
+inline void ExceptionWrapper::set_allocated_exception_class(::std::string* exception_class) {
+  if (exception_class_ != &::google::protobuf::internal::kEmptyString) {
+    delete exception_class_;
+  }
+  if (exception_class) {
+    set_has_exception_class();
+    exception_class_ = exception_class;
+  } else {
+    clear_has_exception_class();
+    exception_class_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// optional string message = 2;
+inline bool ExceptionWrapper::has_message() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void ExceptionWrapper::set_has_message() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void ExceptionWrapper::clear_has_message() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void ExceptionWrapper::clear_message() {
+  if (message_ != &::google::protobuf::internal::kEmptyString) {
+    message_->clear();
+  }
+  clear_has_message();
+}
+inline const ::std::string& ExceptionWrapper::message() const {
+  return *message_;
+}
+inline void ExceptionWrapper::set_message(const ::std::string& value) {
+  set_has_message();
+  if (message_ == &::google::protobuf::internal::kEmptyString) {
+    message_ = new ::std::string;
+  }
+  message_->assign(value);
+}
+inline void ExceptionWrapper::set_message(const char* value) {
+  set_has_message();
+  if (message_ == &::google::protobuf::internal::kEmptyString) {
+    message_ = new ::std::string;
+  }
+  message_->assign(value);
+}
+inline void ExceptionWrapper::set_message(const char* value, size_t size) {
+  set_has_message();
+  if (message_ == &::google::protobuf::internal::kEmptyString) {
+    message_ = new ::std::string;
+  }
+  message_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* ExceptionWrapper::mutable_message() {
+  set_has_message();
+  if (message_ == &::google::protobuf::internal::kEmptyString) {
+    message_ = new ::std::string;
+  }
+  return message_;
+}
+inline ::std::string* ExceptionWrapper::release_message() {
+  clear_has_message();
+  if (message_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = message_;
+    message_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+    return temp;
+  }
+}
+inline void ExceptionWrapper::set_allocated_message(::std::string* message) {
+  if (message_ != &::google::protobuf::internal::kEmptyString) {
+    delete message_;
+  }
+  if (message) {
+    set_has_message();
+    message_ = message;
+  } else {
+    clear_has_message();
+    message_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// repeated .exec.shared.StackTraceElementWrapper stack_trace = 3;
+inline int ExceptionWrapper::stack_trace_size() const {
+  return stack_trace_.size();
+}
+inline void ExceptionWrapper::clear_stack_trace() {
+  stack_trace_.Clear();
+}
+inline const ::exec::shared::StackTraceElementWrapper& ExceptionWrapper::stack_trace(int index) const {
+  return stack_trace_.Get(index);
+}
+inline ::exec::shared::StackTraceElementWrapper* ExceptionWrapper::mutable_stack_trace(int index) {
+  return stack_trace_.Mutable(index);
+}
+inline ::exec::shared::StackTraceElementWrapper* ExceptionWrapper::add_stack_trace() {
+  return stack_trace_.Add();
+}
+inline const ::google::protobuf::RepeatedPtrField< ::exec::shared::StackTraceElementWrapper >&
+ExceptionWrapper::stack_trace() const {
+  return stack_trace_;
+}
+inline ::google::protobuf::RepeatedPtrField< ::exec::shared::StackTraceElementWrapper >*
+ExceptionWrapper::mutable_stack_trace() {
+  return &stack_trace_;
+}
+
+// optional .exec.shared.ExceptionWrapper cause = 4;
+inline bool ExceptionWrapper::has_cause() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void ExceptionWrapper::set_has_cause() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void ExceptionWrapper::clear_has_cause() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void ExceptionWrapper::clear_cause() {
+  if (cause_ != NULL) cause_->::exec::shared::ExceptionWrapper::Clear();
+  clear_has_cause();
+}
+inline const ::exec::shared::ExceptionWrapper& ExceptionWrapper::cause() const {
+  return cause_ != NULL ? *cause_ : *default_instance_->cause_;
+}
+inline ::exec::shared::ExceptionWrapper* ExceptionWrapper::mutable_cause() {
+  set_has_cause();
+  if (cause_ == NULL) cause_ = new ::exec::shared::ExceptionWrapper;
+  return cause_;
+}
+inline ::exec::shared::ExceptionWrapper* ExceptionWrapper::release_cause() {
+  clear_has_cause();
+  ::exec::shared::ExceptionWrapper* temp = cause_;
+  cause_ = NULL;
+  return temp;
+}
+inline void ExceptionWrapper::set_allocated_cause(::exec::shared::ExceptionWrapper* cause) {
+  delete cause_;
+  cause_ = cause;
+  if (cause) {
+    set_has_cause();
+  } else {
+    clear_has_cause();
+  }
+}
+
+// -------------------------------------------------------------------
+
+// StackTraceElementWrapper
+
+// optional string class_name = 1;
+inline bool StackTraceElementWrapper::has_class_name() const {
+  return (_has_bits_[0] & 0x00000001u) != 0;
+}
+inline void StackTraceElementWrapper::set_has_class_name() {
+  _has_bits_[0] |= 0x00000001u;
+}
+inline void StackTraceElementWrapper::clear_has_class_name() {
+  _has_bits_[0] &= ~0x00000001u;
+}
+inline void StackTraceElementWrapper::clear_class_name() {
+  if (class_name_ != &::google::protobuf::internal::kEmptyString) {
+    class_name_->clear();
+  }
+  clear_has_class_name();
+}
+inline const ::std::string& StackTraceElementWrapper::class_name() const {
+  return *class_name_;
+}
+inline void StackTraceElementWrapper::set_class_name(const ::std::string& value) {
+  set_has_class_name();
+  if (class_name_ == &::google::protobuf::internal::kEmptyString) {
+    class_name_ = new ::std::string;
+  }
+  class_name_->assign(value);
+}
+inline void StackTraceElementWrapper::set_class_name(const char* value) {
+  set_has_class_name();
+  if (class_name_ == &::google::protobuf::internal::kEmptyString) {
+    class_name_ = new ::std::string;
+  }
+  class_name_->assign(value);
+}
+inline void StackTraceElementWrapper::set_class_name(const char* value, size_t size) {
+  set_has_class_name();
+  if (class_name_ == &::google::protobuf::internal::kEmptyString) {
+    class_name_ = new ::std::string;
+  }
+  class_name_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* StackTraceElementWrapper::mutable_class_name() {
+  set_has_class_name();
+  if (class_name_ == &::google::protobuf::internal::kEmptyString) {
+    class_name_ = new ::std::string;
+  }
+  return class_name_;
+}
+inline ::std::string* StackTraceElementWrapper::release_class_name() {
+  clear_has_class_name();
+  if (class_name_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = class_name_;
+    class_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+    return temp;
+  }
+}
+inline void StackTraceElementWrapper::set_allocated_class_name(::std::string* class_name) {
+  if (class_name_ != &::google::protobuf::internal::kEmptyString) {
+    delete class_name_;
+  }
+  if (class_name) {
+    set_has_class_name();
+    class_name_ = class_name;
+  } else {
+    clear_has_class_name();
+    class_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// optional string file_name = 2;
+inline bool StackTraceElementWrapper::has_file_name() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void StackTraceElementWrapper::set_has_file_name() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void StackTraceElementWrapper::clear_has_file_name() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void StackTraceElementWrapper::clear_file_name() {
+  if (file_name_ != &::google::protobuf::internal::kEmptyString) {
+    file_name_->clear();
+  }
+  clear_has_file_name();
+}
+inline const ::std::string& StackTraceElementWrapper::file_name() const {
+  return *file_name_;
+}
+inline void StackTraceElementWrapper::set_file_name(const ::std::string& value) {
+  set_has_file_name();
+  if (file_name_ == &::google::protobuf::internal::kEmptyString) {
+    file_name_ = new ::std::string;
+  }
+  file_name_->assign(value);
+}
+inline void StackTraceElementWrapper::set_file_name(const char* value) {
+  set_has_file_name();
+  if (file_name_ == &::google::protobuf::internal::kEmptyString) {
+    file_name_ = new ::std::string;
+  }
+  file_name_->assign(value);
+}
+inline void StackTraceElementWrapper::set_file_name(const char* value, size_t size) {
+  set_has_file_name();
+  if (file_name_ == &::google::protobuf::internal::kEmptyString) {
+    file_name_ = new ::std::string;
+  }
+  file_name_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* StackTraceElementWrapper::mutable_file_name() {
+  set_has_file_name();
+  if (file_name_ == &::google::protobuf::internal::kEmptyString) {
+    file_name_ = new ::std::string;
+  }
+  return file_name_;
+}
+inline ::std::string* StackTraceElementWrapper::release_file_name() {
+  clear_has_file_name();
+  if (file_name_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = file_name_;
+    file_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+    return temp;
+  }
+}
+inline void StackTraceElementWrapper::set_allocated_file_name(::std::string* file_name) {
+  if (file_name_ != &::google::protobuf::internal::kEmptyString) {
+    delete file_name_;
+  }
+  if (file_name) {
+    set_has_file_name();
+    file_name_ = file_name;
+  } else {
+    clear_has_file_name();
+    file_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// optional int32 line_number = 3;
+inline bool StackTraceElementWrapper::has_line_number() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void StackTraceElementWrapper::set_has_line_number() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void StackTraceElementWrapper::clear_has_line_number() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline void StackTraceElementWrapper::clear_line_number() {
+  line_number_ = 0;
+  clear_has_line_number();
+}
+inline ::google::protobuf::int32 StackTraceElementWrapper::line_number() const {
+  return line_number_;
+}
+inline void StackTraceElementWrapper::set_line_number(::google::protobuf::int32 value) {
+  set_has_line_number();
+  line_number_ = value;
+}
+
+// optional string method_name = 4;
+inline bool StackTraceElementWrapper::has_method_name() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void StackTraceElementWrapper::set_has_method_name() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void StackTraceElementWrapper::clear_has_method_name() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void StackTraceElementWrapper::clear_method_name() {
+  if (method_name_ != &::google::protobuf::internal::kEmptyString) {
+    method_name_->clear();
+  }
+  clear_has_method_name();
+}
+inline const ::std::string& StackTraceElementWrapper::method_name() const {
+  return *method_name_;
+}
+inline void StackTraceElementWrapper::set_method_name(const ::std::string& value) {
+  set_has_method_name();
+  if (method_name_ == &::google::protobuf::internal::kEmptyString) {
+    method_name_ = new ::std::string;
+  }
+  method_name_->assign(value);
+}
+inline void StackTraceElementWrapper::set_method_name(const char* value) {
+  set_has_method_name();
+  if (method_name_ == &::google::protobuf::internal::kEmptyString) {
+    method_name_ = new ::std::string;
+  }
+  method_name_->assign(value);
+}
+inline void StackTraceElementWrapper::set_method_name(const char* value, size_t size) {
+  set_has_method_name();
+  if (method_name_ == &::google::protobuf::internal::kEmptyString) {
+    method_name_ = new ::std::string;
+  }
+  method_name_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* StackTraceElementWrapper::mutable_method_name() {
+  set_has_method_name();
+  if (method_name_ == &::google::protobuf::internal::kEmptyString) {
+    method_name_ = new ::std::string;
+  }
+  return method_name_;
+}
+inline ::std::string* StackTraceElementWrapper::release_method_name() {
+  clear_has_method_name();
+  if (method_name_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = method_name_;
+    method_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+    return temp;
+  }
+}
+inline void StackTraceElementWrapper::set_allocated_method_name(::std::string* method_name) {
+  if (method_name_ != &::google::protobuf::internal::kEmptyString) {
+    delete method_name_;
+  }
+  if (method_name) {
+    set_has_method_name();
+    method_name_ = method_name;
+  } else {
+    clear_has_method_name();
+    method_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// optional bool is_native_method = 5;
+inline bool StackTraceElementWrapper::has_is_native_method() const {
+  return (_has_bits_[0] & 0x00000010u) != 0;
+}
+inline void StackTraceElementWrapper::set_has_is_native_method() {
+  _has_bits_[0] |= 0x00000010u;
+}
+inline void StackTraceElementWrapper::clear_has_is_native_method() {
+  _has_bits_[0] &= ~0x00000010u;
+}
+inline void StackTraceElementWrapper::clear_is_native_method() {
+  is_native_method_ = false;
+  clear_has_is_native_method();
+}
+inline bool StackTraceElementWrapper::is_native_method() const {
+  return is_native_method_;
+}
+inline void StackTraceElementWrapper::set_is_native_method(bool value) {
+  set_has_is_native_method();
+  is_native_method_ = value;
+}
+
+// -------------------------------------------------------------------
+
 // ParsingError
 
 // optional int32 start_column = 2;


[13/16] incubator-drill git commit: - Update Parquet writer to always make binary copy of data for statistics holding purposes. (Fixes JVM crash in certain cases.) - Update WriterRecordBatch to stop doing premature cleanup. In the case that a downstrea

Posted by jn...@apache.org.
- Update Parquet writer to always make binary copy of data for statistics holding purposes.  (Fixes JVM crash in certain cases.)
- Update WriterRecordBatch to stop doing premature cleanup.  In the case that a downstream operator is still holding memory allocated in the writer record batch, it was possible that the operator would try to close the allocator before that memory had been released.


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

Branch: refs/heads/master
Commit: 06f0e178e7738dc7ecd81faad8d1f73003c84fb8
Parents: 66d5be4
Author: Jacques Nadeau <ja...@apache.org>
Authored: Wed Nov 5 18:59:40 2014 -0800
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:57 2014 -0800

----------------------------------------------------------------------
 exec/java-exec/pom.xml                          |  2 +-
 .../exec/physical/impl/WriterRecordBatch.java   | 82 ++++++++++----------
 2 files changed, 42 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/06f0e178/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index 55721d1..0dea38a 100644
--- a/exec/java-exec/pom.xml
+++ b/exec/java-exec/pom.xml
@@ -125,7 +125,7 @@
     <dependency>
       <groupId>com.twitter</groupId>
       <artifactId>parquet-column</artifactId>
-      <version>1.5.1-drill-r4</version>
+      <version>1.5.1-drill-r5</version>
       <exclusions>
         <exclusion>
           <groupId>org.apache.hadoop</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/06f0e178/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java
index acbb815..07302d1 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java
@@ -88,7 +88,7 @@ public class WriterRecordBatch extends AbstractRecordBatch<Writer> {
   @Override
   public IterOutcome innerNext() {
     if(processed) {
-      cleanup();
+//      cleanup();
       // if the upstream record batch is already processed and next() is called by
       // downstream then return NONE to indicate completion
       return IterOutcome.NONE;
@@ -96,48 +96,52 @@ public class WriterRecordBatch extends AbstractRecordBatch<Writer> {
 
     // process the complete upstream in one next() call
     IterOutcome upstream;
-    do {
-      upstream = next(incoming);
-
-      switch(upstream) {
-        case NOT_YET:
-        case NONE:
-        case STOP:
-          if (upstream == IterOutcome.STOP) {
-            return upstream;
-          }
-          break;
-
-        case OK_NEW_SCHEMA:
-          try{
-            setupNewSchema();
-          } catch(Exception ex) {
-            kill(false);
-            logger.error("Failure during query", ex);
-            context.fail(ex);
+    try{
+      do {
+        upstream = next(incoming);
+
+        switch(upstream) {
+          case STOP:
             return IterOutcome.STOP;
-          }
-          // fall through.
-        case OK:
-          try {
+
+          case NOT_YET:
+          case NONE:
+            break;
+
+          case OK_NEW_SCHEMA:
+            setupNewSchema();
+            // fall through.
+          case OK:
             counter += eventBasedRecordWriter.write(incoming.getRecordCount());
             logger.debug("Total records written so far: {}", counter);
-          } catch(IOException ex) {
-            throw new RuntimeException(ex);
-          }
 
-          for(VectorWrapper v : incoming) {
-            v.getValueVector().clear();
-          }
-          break;
+            for(VectorWrapper<?> v : incoming) {
+              v.getValueVector().clear();
+            }
+            break;
+
+          default:
+            throw new UnsupportedOperationException();
+        }
+      } while(upstream != IterOutcome.NONE);
+    }catch(Exception ex){
+      kill(false);
+      logger.error("Failure during query", ex);
+      context.fail(ex);
+      return IterOutcome.STOP;
+    }
 
-        default:
-          throw new UnsupportedOperationException();
-      }
-    } while(upstream != IterOutcome.NONE);
+    addOutputContainerData();
+    processed = true;
 
+    return IterOutcome.OK_NEW_SCHEMA;
+  }
 
-    VarCharVector fragmentIdVector = (VarCharVector) container.getValueAccessorById(VarCharVector.class, container.getValueVectorId(SchemaPath.getSimplePath("Fragment")).getFieldIds()).getValueVector();
+  private void addOutputContainerData(){
+    VarCharVector fragmentIdVector = (VarCharVector) container.getValueAccessorById( //
+        VarCharVector.class, //
+        container.getValueVectorId(SchemaPath.getSimplePath("Fragment")).getFieldIds() //
+        ).getValueVector();
     AllocationHelper.allocate(fragmentIdVector, 1, 50);
     BigIntVector summaryVector = (BigIntVector) container.getValueAccessorById(BigIntVector.class,
             container.getValueVectorId(SchemaPath.getSimplePath("Number of records written")).getFieldIds()).getValueVector();
@@ -148,9 +152,6 @@ public class WriterRecordBatch extends AbstractRecordBatch<Writer> {
     summaryVector.getMutator().setValueCount(1);
 
     container.setRecordCount(1);
-    processed = true;
-
-    return IterOutcome.OK_NEW_SCHEMA;
   }
 
   protected void setupNewSchema() throws Exception {
@@ -167,8 +168,6 @@ public class WriterRecordBatch extends AbstractRecordBatch<Writer> {
       container.addOrGet(fragmentIdField);
       container.addOrGet(summaryField);
       container.buildSchema(BatchSchema.SelectionVectorMode.NONE);
-    } catch(IOException ex) {
-      throw new RuntimeException("Failed to update schema in RecordWriter", ex);
     } finally{
       stats.stopSetup();
     }
@@ -186,6 +185,7 @@ public class WriterRecordBatch extends AbstractRecordBatch<Writer> {
         recordWriter.cleanup();
       }
     } catch(IOException ex) {
+      logger.error("Failure while closing record writer", ex);
       throw new RuntimeException("Failed to close RecordWriter", ex);
     }
   }


[09/16] incubator-drill git commit: DRILL-1578: Accountor message should be trace messages

Posted by jn...@apache.org.
DRILL-1578: Accountor message should be trace messages


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

Branch: refs/heads/master
Commit: 30c40eac72d53b4c75631a313376a31a1b68efbb
Parents: 1d7f621
Author: Parth Chandra <pc...@maprtech.com>
Authored: Thu Nov 6 14:47:26 2014 -0800
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:56 2014 -0800

----------------------------------------------------------------------
 .../org/apache/drill/exec/memory/Accountor.java | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/30c40eac/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java
index 0874585..0a8c405 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java
@@ -133,7 +133,7 @@ public class Accountor {
   }
 
   public boolean reserve(long size) {
-    logger.debug("Fragment:"+fragmentStr+" Reserved "+size+" bytes. Total Allocated: "+getAllocation());
+    logger.trace("Fragment:"+fragmentStr+" Reserved "+size+" bytes. Total Allocated: "+getAllocation());
     return remainder.get(size, this.applyFragmentLimit);
   }
 
@@ -188,7 +188,7 @@ public class Accountor {
     if (parent != null){
       parent.addFragmentContext(c);
     }else {
-      if(logger.isDebugEnabled()) {
+      if(logger.isTraceEnabled()) {
         FragmentHandle hndle;
         String fragStr;
         if(c!=null) {
@@ -205,7 +205,7 @@ public class Accountor {
           sb.append("\n");
         }
 
-        logger.debug("Fragment " + fragStr + " added to root accountor.\n"+sb.toString());
+        logger.trace("Fragment " + fragStr + " added to root accountor.\n"+sb.toString());
       }
       synchronized(this) {
         fragmentContexts.add(c);
@@ -230,7 +230,7 @@ public class Accountor {
           fragStr = "[Null Context]";
         }
         fragStr += " (Object Id: " + System.identityHashCode(c) + ")";
-        logger.debug("Fragment " + fragStr + " removed from root accountor");
+        logger.trace("Fragment " + fragStr + " removed from root accountor");
       }
       synchronized(this) {
         fragmentContexts.remove(c);
@@ -261,8 +261,8 @@ public class Accountor {
             allocatedMemory += fragment.getAllocator().getAllocatedMemory();
           }
         }
-        if(logger.isDebugEnabled()) {
-          logger.info("Resetting Fragment Memory Limit: total Available memory== "+total
+        if(logger.isTraceEnabled()) {
+          logger.trace("Resetting Fragment Memory Limit: total Available memory== "+total
             +" Total Allocated Memory :"+allocatedMemory
             +" Number of fragments: "+nFragments
             + " fragmentMemOvercommitFactor: "+fragmentMemOvercommitFactor
@@ -275,14 +275,14 @@ public class Accountor {
             fragment.setFragmentLimit((long) (rem * fragmentMemOvercommitFactor));
           }
         }
-        if(logger.isDebugEnabled() && false){
+        if(logger.isTraceEnabled() && false){
           StringBuffer sb= new StringBuffer();
           sb.append("[root](0:0)");
           sb.append("Allocated memory: ");
           sb.append(this.getAllocation());
           sb.append(" Fragment Limit: ");
           sb.append(this.getFragmentLimit());
-          logger.debug(sb.toString());
+          logger.trace(sb.toString());
           for(FragmentContext fragment: fragmentContexts){
             sb= new StringBuffer();
             if (handle != null) {
@@ -300,9 +300,9 @@ public class Accountor {
             sb.append(fragment.getAllocator().getAllocatedMemory());
             sb.append(" Fragment Limit: ");
             sb.append(fragment.getAllocator().getFragmentLimit());
-            logger.debug(sb.toString());
+            logger.trace(sb.toString());
           }
-          logger.debug("Resetting Complete");
+          logger.trace("Resetting Complete");
         }
       }
     }
@@ -374,7 +374,7 @@ public class Accountor {
     if (parent != null && parent.parent==null) { // This is a fragment level accountor
       this.fragmentLimit=getAllocation()+add;
       this.remainder.setLimit(this.fragmentLimit);
-      logger.debug("Fragment "+fragmentStr+" memory limit set to "+this.fragmentLimit);
+      logger.trace("Fragment "+fragmentStr+" memory limit set to "+this.fragmentLimit);
     }
   }
 


[07/16] incubator-drill git commit: DRILL-1585: C++ Client - Update RPC version and protobuf definitions for RPC version 3

Posted by jn...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1d7f6211/contrib/native/client/src/protobuf/UserBitShared.pb.cc
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/protobuf/UserBitShared.pb.cc b/contrib/native/client/src/protobuf/UserBitShared.pb.cc
index 0e7649f..17b3463 100644
--- a/contrib/native/client/src/protobuf/UserBitShared.pb.cc
+++ b/contrib/native/client/src/protobuf/UserBitShared.pb.cc
@@ -30,6 +30,12 @@ const ::google::protobuf::internal::GeneratedMessageReflection*
 const ::google::protobuf::Descriptor* DrillPBError_descriptor_ = NULL;
 const ::google::protobuf::internal::GeneratedMessageReflection*
   DrillPBError_reflection_ = NULL;
+const ::google::protobuf::Descriptor* ExceptionWrapper_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  ExceptionWrapper_reflection_ = NULL;
+const ::google::protobuf::Descriptor* StackTraceElementWrapper_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+  StackTraceElementWrapper_reflection_ = NULL;
 const ::google::protobuf::Descriptor* ParsingError_descriptor_ = NULL;
 const ::google::protobuf::internal::GeneratedMessageReflection*
   ParsingError_reflection_ = NULL;
@@ -114,11 +120,12 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(QueryId));
   DrillPBError_descriptor_ = file->message_type(2);
-  static const int DrillPBError_offsets_[5] = {
+  static const int DrillPBError_offsets_[6] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrillPBError, error_id_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrillPBError, endpoint_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrillPBError, error_type_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrillPBError, message_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrillPBError, exception_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DrillPBError, parsing_error_),
   };
   DrillPBError_reflection_ =
@@ -132,7 +139,44 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(DrillPBError));
-  ParsingError_descriptor_ = file->message_type(3);
+  ExceptionWrapper_descriptor_ = file->message_type(3);
+  static const int ExceptionWrapper_offsets_[4] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExceptionWrapper, exception_class_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExceptionWrapper, message_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExceptionWrapper, stack_trace_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExceptionWrapper, cause_),
+  };
+  ExceptionWrapper_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      ExceptionWrapper_descriptor_,
+      ExceptionWrapper::default_instance_,
+      ExceptionWrapper_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExceptionWrapper, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExceptionWrapper, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(ExceptionWrapper));
+  StackTraceElementWrapper_descriptor_ = file->message_type(4);
+  static const int StackTraceElementWrapper_offsets_[5] = {
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StackTraceElementWrapper, class_name_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StackTraceElementWrapper, file_name_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StackTraceElementWrapper, line_number_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StackTraceElementWrapper, method_name_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StackTraceElementWrapper, is_native_method_),
+  };
+  StackTraceElementWrapper_reflection_ =
+    new ::google::protobuf::internal::GeneratedMessageReflection(
+      StackTraceElementWrapper_descriptor_,
+      StackTraceElementWrapper::default_instance_,
+      StackTraceElementWrapper_offsets_,
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StackTraceElementWrapper, _has_bits_[0]),
+      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StackTraceElementWrapper, _unknown_fields_),
+      -1,
+      ::google::protobuf::DescriptorPool::generated_pool(),
+      ::google::protobuf::MessageFactory::generated_factory(),
+      sizeof(StackTraceElementWrapper));
+  ParsingError_descriptor_ = file->message_type(5);
   static const int ParsingError_offsets_[4] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParsingError, start_column_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParsingError, start_row_),
@@ -150,7 +194,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(ParsingError));
-  RecordBatchDef_descriptor_ = file->message_type(4);
+  RecordBatchDef_descriptor_ = file->message_type(6);
   static const int RecordBatchDef_offsets_[3] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RecordBatchDef, record_count_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RecordBatchDef, field_),
@@ -167,7 +211,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(RecordBatchDef));
-  NamePart_descriptor_ = file->message_type(5);
+  NamePart_descriptor_ = file->message_type(7);
   static const int NamePart_offsets_[3] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(NamePart, type_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(NamePart, name_),
@@ -185,7 +229,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(NamePart));
   NamePart_Type_descriptor_ = NamePart_descriptor_->enum_type(0);
-  SerializedField_descriptor_ = file->message_type(6);
+  SerializedField_descriptor_ = file->message_type(8);
   static const int SerializedField_offsets_[7] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SerializedField, major_type_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SerializedField, name_part_),
@@ -206,7 +250,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(SerializedField));
-  NodeStatus_descriptor_ = file->message_type(7);
+  NodeStatus_descriptor_ = file->message_type(9);
   static const int NodeStatus_offsets_[2] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(NodeStatus, node_id_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(NodeStatus, memory_footprint_),
@@ -222,7 +266,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(NodeStatus));
-  QueryResult_descriptor_ = file->message_type(8);
+  QueryResult_descriptor_ = file->message_type(10);
   static const int QueryResult_offsets_[11] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryResult, query_state_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryResult, query_id_),
@@ -248,7 +292,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(QueryResult));
   QueryResult_QueryState_descriptor_ = QueryResult_descriptor_->enum_type(0);
-  QueryProfile_descriptor_ = file->message_type(9);
+  QueryProfile_descriptor_ = file->message_type(11);
   static const int QueryProfile_offsets_[11] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, id_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(QueryProfile, type_),
@@ -273,7 +317,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(QueryProfile));
-  MajorFragmentProfile_descriptor_ = file->message_type(10);
+  MajorFragmentProfile_descriptor_ = file->message_type(12);
   static const int MajorFragmentProfile_offsets_[2] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MajorFragmentProfile, major_fragment_id_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MajorFragmentProfile, minor_fragment_profile_),
@@ -289,7 +333,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(MajorFragmentProfile));
-  MinorFragmentProfile_descriptor_ = file->message_type(11);
+  MinorFragmentProfile_descriptor_ = file->message_type(13);
   static const int MinorFragmentProfile_offsets_[9] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, state_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MinorFragmentProfile, error_),
@@ -312,7 +356,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(MinorFragmentProfile));
-  OperatorProfile_descriptor_ = file->message_type(12);
+  OperatorProfile_descriptor_ = file->message_type(14);
   static const int OperatorProfile_offsets_[8] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, input_profile_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OperatorProfile, operator_id_),
@@ -334,7 +378,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(OperatorProfile));
-  StreamProfile_descriptor_ = file->message_type(13);
+  StreamProfile_descriptor_ = file->message_type(15);
   static const int StreamProfile_offsets_[3] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StreamProfile, records_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StreamProfile, batches_),
@@ -351,7 +395,7 @@ void protobuf_AssignDesc_UserBitShared_2eproto() {
       ::google::protobuf::DescriptorPool::generated_pool(),
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(StreamProfile));
-  MetricValue_descriptor_ = file->message_type(14);
+  MetricValue_descriptor_ = file->message_type(16);
   static const int MetricValue_offsets_[3] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricValue, metric_id_),
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetricValue, long_value_),
@@ -391,6 +435,10 @@ void protobuf_RegisterTypes(const ::std::string&) {
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
     DrillPBError_descriptor_, &DrillPBError::default_instance());
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    ExceptionWrapper_descriptor_, &ExceptionWrapper::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+    StackTraceElementWrapper_descriptor_, &StackTraceElementWrapper::default_instance());
+  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
     ParsingError_descriptor_, &ParsingError::default_instance());
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
     RecordBatchDef_descriptor_, &RecordBatchDef::default_instance());
@@ -425,6 +473,10 @@ void protobuf_ShutdownFile_UserBitShared_2eproto() {
   delete QueryId_reflection_;
   delete DrillPBError::default_instance_;
   delete DrillPBError_reflection_;
+  delete ExceptionWrapper::default_instance_;
+  delete ExceptionWrapper_reflection_;
+  delete StackTraceElementWrapper::default_instance_;
+  delete StackTraceElementWrapper_reflection_;
   delete ParsingError::default_instance_;
   delete ParsingError_reflection_;
   delete RecordBatchDef::default_instance_;
@@ -465,97 +517,108 @@ void protobuf_AddDesc_UserBitShared_2eproto() {
     "s.proto\032\022Coordination.proto\032\017SchemaDef.p"
     "roto\"$\n\017UserCredentials\022\021\n\tuser_name\030\001 \001"
     "(\t\"\'\n\007QueryId\022\r\n\005part1\030\001 \001(\020\022\r\n\005part2\030\002 "
-    "\001(\020\"\241\001\n\014DrillPBError\022\020\n\010error_id\030\001 \001(\t\022("
+    "\001(\020\"\323\001\n\014DrillPBError\022\020\n\010error_id\030\001 \001(\t\022("
     "\n\010endpoint\030\002 \001(\0132\026.exec.DrillbitEndpoint"
     "\022\022\n\nerror_type\030\003 \001(\005\022\017\n\007message\030\004 \001(\t\0220\n"
-    "\rparsing_error\030\005 \003(\0132\031.exec.shared.Parsi"
-    "ngError\"\\\n\014ParsingError\022\024\n\014start_column\030"
-    "\002 \001(\005\022\021\n\tstart_row\030\003 \001(\005\022\022\n\nend_column\030\004"
-    " \001(\005\022\017\n\007end_row\030\005 \001(\005\"~\n\016RecordBatchDef\022"
-    "\024\n\014record_count\030\001 \001(\005\022+\n\005field\030\002 \003(\0132\034.e"
-    "xec.shared.SerializedField\022)\n!carries_tw"
-    "o_byte_selection_vector\030\003 \001(\010\"\205\001\n\010NamePa"
-    "rt\022(\n\004type\030\001 \001(\0162\032.exec.shared.NamePart."
-    "Type\022\014\n\004name\030\002 \001(\t\022$\n\005child\030\003 \001(\0132\025.exec"
-    ".shared.NamePart\"\033\n\004Type\022\010\n\004NAME\020\000\022\t\n\005AR"
-    "RAY\020\001\"\351\001\n\017SerializedField\022%\n\nmajor_type\030"
-    "\001 \001(\0132\021.common.MajorType\022(\n\tname_part\030\002 "
-    "\001(\0132\025.exec.shared.NamePart\022+\n\005child\030\003 \003("
-    "\0132\034.exec.shared.SerializedField\022\023\n\013value"
-    "_count\030\004 \001(\005\022\027\n\017var_byte_length\030\005 \001(\005\022\023\n"
-    "\013group_count\030\006 \001(\005\022\025\n\rbuffer_length\030\007 \001("
-    "\005\"7\n\nNodeStatus\022\017\n\007node_id\030\001 \001(\005\022\030\n\020memo"
-    "ry_footprint\030\002 \001(\003\"\335\003\n\013QueryResult\0228\n\013qu"
-    "ery_state\030\001 \001(\0162#.exec.shared.QueryResul"
-    "t.QueryState\022&\n\010query_id\030\002 \001(\0132\024.exec.sh"
-    "ared.QueryId\022\025\n\ris_last_chunk\030\003 \001(\010\022\021\n\tr"
-    "ow_count\030\004 \001(\005\022\024\n\014records_scan\030\005 \001(\003\022\025\n\r"
-    "records_error\030\006 \001(\003\022\027\n\017submission_time\030\007"
-    " \001(\003\022,\n\013node_status\030\010 \003(\0132\027.exec.shared."
-    "NodeStatus\022(\n\005error\030\t \003(\0132\031.exec.shared."
-    "DrillPBError\022(\n\003def\030\n \001(\0132\033.exec.shared."
-    "RecordBatchDef\022\026\n\016schema_changed\030\013 \001(\010\"b"
-    "\n\nQueryState\022\013\n\007PENDING\020\000\022\013\n\007RUNNING\020\001\022\r"
-    "\n\tCOMPLETED\020\002\022\014\n\010CANCELED\020\003\022\n\n\006FAILED\020\004\022"
-    "\021\n\rUNKNOWN_QUERY\020\005\"\336\002\n\014QueryProfile\022 \n\002i"
-    "d\030\001 \001(\0132\024.exec.shared.QueryId\022$\n\004type\030\002 "
-    "\001(\0162\026.exec.shared.QueryType\022\r\n\005start\030\003 \001"
-    "(\003\022\013\n\003end\030\004 \001(\003\022\r\n\005query\030\005 \001(\t\022\014\n\004plan\030\006"
-    " \001(\t\022\'\n\007foreman\030\007 \001(\0132\026.exec.DrillbitEnd"
-    "point\0222\n\005state\030\010 \001(\0162#.exec.shared.Query"
-    "Result.QueryState\022\027\n\017total_fragments\030\t \001"
-    "(\005\022\032\n\022finished_fragments\030\n \001(\005\022;\n\020fragme"
-    "nt_profile\030\013 \003(\0132!.exec.shared.MajorFrag"
-    "mentProfile\"t\n\024MajorFragmentProfile\022\031\n\021m"
-    "ajor_fragment_id\030\001 \001(\005\022A\n\026minor_fragment"
-    "_profile\030\002 \003(\0132!.exec.shared.MinorFragme"
-    "ntProfile\"\274\002\n\024MinorFragmentProfile\022)\n\005st"
-    "ate\030\001 \001(\0162\032.exec.shared.FragmentState\022(\n"
-    "\005error\030\002 \001(\0132\031.exec.shared.DrillPBError\022"
-    "\031\n\021minor_fragment_id\030\003 \001(\005\0226\n\020operator_p"
-    "rofile\030\004 \003(\0132\034.exec.shared.OperatorProfi"
-    "le\022\022\n\nstart_time\030\005 \001(\003\022\020\n\010end_time\030\006 \001(\003"
-    "\022\023\n\013memory_used\030\007 \001(\003\022\027\n\017max_memory_used"
-    "\030\010 \001(\003\022(\n\010endpoint\030\t \001(\0132\026.exec.Drillbit"
-    "Endpoint\"\372\001\n\017OperatorProfile\0221\n\rinput_pr"
-    "ofile\030\001 \003(\0132\032.exec.shared.StreamProfile\022"
-    "\023\n\013operator_id\030\003 \001(\005\022\025\n\roperator_type\030\004 "
-    "\001(\005\022\023\n\013setup_nanos\030\005 \001(\003\022\025\n\rprocess_nano"
-    "s\030\006 \001(\003\022\036\n\026local_memory_allocated\030\007 \001(\003\022"
-    "(\n\006metric\030\010 \003(\0132\030.exec.shared.MetricValu"
-    "e\022\022\n\nwait_nanos\030\t \001(\003\"B\n\rStreamProfile\022\017"
-    "\n\007records\030\001 \001(\003\022\017\n\007batches\030\002 \001(\003\022\017\n\007sche"
-    "mas\030\003 \001(\003\"J\n\013MetricValue\022\021\n\tmetric_id\030\001 "
-    "\001(\005\022\022\n\nlong_value\030\002 \001(\003\022\024\n\014double_value\030"
-    "\003 \001(\001*5\n\nRpcChannel\022\017\n\013BIT_CONTROL\020\000\022\014\n\010"
-    "BIT_DATA\020\001\022\010\n\004USER\020\002*/\n\tQueryType\022\007\n\003SQL"
-    "\020\001\022\013\n\007LOGICAL\020\002\022\014\n\010PHYSICAL\020\003*k\n\rFragmen"
-    "tState\022\013\n\007SENDING\020\000\022\027\n\023AWAITING_ALLOCATI"
-    "ON\020\001\022\013\n\007RUNNING\020\002\022\014\n\010FINISHED\020\003\022\r\n\tCANCE"
-    "LLED\020\004\022\n\n\006FAILED\020\005*\224\005\n\020CoreOperatorType\022"
-    "\021\n\rSINGLE_SENDER\020\000\022\024\n\020BROADCAST_SENDER\020\001"
-    "\022\n\n\006FILTER\020\002\022\022\n\016HASH_AGGREGATE\020\003\022\r\n\tHASH"
-    "_JOIN\020\004\022\016\n\nMERGE_JOIN\020\005\022\031\n\025HASH_PARTITIO"
-    "N_SENDER\020\006\022\t\n\005LIMIT\020\007\022\024\n\020MERGING_RECEIVE"
-    "R\020\010\022\034\n\030ORDERED_PARTITION_SENDER\020\t\022\013\n\007PRO"
-    "JECT\020\n\022\026\n\022UNORDERED_RECEIVER\020\013\022\020\n\014RANGE_"
-    "SENDER\020\014\022\n\n\006SCREEN\020\r\022\034\n\030SELECTION_VECTOR"
-    "_REMOVER\020\016\022\027\n\023STREAMING_AGGREGATE\020\017\022\016\n\nT"
-    "OP_N_SORT\020\020\022\021\n\rEXTERNAL_SORT\020\021\022\t\n\005TRACE\020"
-    "\022\022\t\n\005UNION\020\023\022\014\n\010OLD_SORT\020\024\022\032\n\026PARQUET_RO"
-    "W_GROUP_SCAN\020\025\022\021\n\rHIVE_SUB_SCAN\020\026\022\025\n\021SYS"
-    "TEM_TABLE_SCAN\020\027\022\021\n\rMOCK_SUB_SCAN\020\030\022\022\n\016P"
-    "ARQUET_WRITER\020\031\022\023\n\017DIRECT_SUB_SCAN\020\032\022\017\n\013"
-    "TEXT_WRITER\020\033\022\021\n\rTEXT_SUB_SCAN\020\034\022\021\n\rJSON"
-    "_SUB_SCAN\020\035\022\030\n\024INFO_SCHEMA_SUB_SCAN\020\036\022\023\n"
-    "\017COMPLEX_TO_JSON\020\037\022\025\n\021PRODUCER_CONSUMER\020"
-    " B.\n\033org.apache.drill.exec.protoB\rUserBi"
-    "tSharedH\001", 3569);
+    "\texception\030\005 \001(\0132\035.exec.shared.Exception"
+    "Wrapper\0220\n\rparsing_error\030\006 \003(\0132\031.exec.sh"
+    "ared.ParsingError\"\246\001\n\020ExceptionWrapper\022\027"
+    "\n\017exception_class\030\001 \001(\t\022\017\n\007message\030\002 \001(\t"
+    "\022:\n\013stack_trace\030\003 \003(\0132%.exec.shared.Stac"
+    "kTraceElementWrapper\022,\n\005cause\030\004 \001(\0132\035.ex"
+    "ec.shared.ExceptionWrapper\"\205\001\n\030StackTrac"
+    "eElementWrapper\022\022\n\nclass_name\030\001 \001(\t\022\021\n\tf"
+    "ile_name\030\002 \001(\t\022\023\n\013line_number\030\003 \001(\005\022\023\n\013m"
+    "ethod_name\030\004 \001(\t\022\030\n\020is_native_method\030\005 \001"
+    "(\010\"\\\n\014ParsingError\022\024\n\014start_column\030\002 \001(\005"
+    "\022\021\n\tstart_row\030\003 \001(\005\022\022\n\nend_column\030\004 \001(\005\022"
+    "\017\n\007end_row\030\005 \001(\005\"~\n\016RecordBatchDef\022\024\n\014re"
+    "cord_count\030\001 \001(\005\022+\n\005field\030\002 \003(\0132\034.exec.s"
+    "hared.SerializedField\022)\n!carries_two_byt"
+    "e_selection_vector\030\003 \001(\010\"\205\001\n\010NamePart\022(\n"
+    "\004type\030\001 \001(\0162\032.exec.shared.NamePart.Type\022"
+    "\014\n\004name\030\002 \001(\t\022$\n\005child\030\003 \001(\0132\025.exec.shar"
+    "ed.NamePart\"\033\n\004Type\022\010\n\004NAME\020\000\022\t\n\005ARRAY\020\001"
+    "\"\351\001\n\017SerializedField\022%\n\nmajor_type\030\001 \001(\013"
+    "2\021.common.MajorType\022(\n\tname_part\030\002 \001(\0132\025"
+    ".exec.shared.NamePart\022+\n\005child\030\003 \003(\0132\034.e"
+    "xec.shared.SerializedField\022\023\n\013value_coun"
+    "t\030\004 \001(\005\022\027\n\017var_byte_length\030\005 \001(\005\022\023\n\013grou"
+    "p_count\030\006 \001(\005\022\025\n\rbuffer_length\030\007 \001(\005\"7\n\n"
+    "NodeStatus\022\017\n\007node_id\030\001 \001(\005\022\030\n\020memory_fo"
+    "otprint\030\002 \001(\003\"\335\003\n\013QueryResult\0228\n\013query_s"
+    "tate\030\001 \001(\0162#.exec.shared.QueryResult.Que"
+    "ryState\022&\n\010query_id\030\002 \001(\0132\024.exec.shared."
+    "QueryId\022\025\n\ris_last_chunk\030\003 \001(\010\022\021\n\trow_co"
+    "unt\030\004 \001(\005\022\024\n\014records_scan\030\005 \001(\003\022\025\n\rrecor"
+    "ds_error\030\006 \001(\003\022\027\n\017submission_time\030\007 \001(\003\022"
+    ",\n\013node_status\030\010 \003(\0132\027.exec.shared.NodeS"
+    "tatus\022(\n\005error\030\t \003(\0132\031.exec.shared.Drill"
+    "PBError\022(\n\003def\030\n \001(\0132\033.exec.shared.Recor"
+    "dBatchDef\022\026\n\016schema_changed\030\013 \001(\010\"b\n\nQue"
+    "ryState\022\013\n\007PENDING\020\000\022\013\n\007RUNNING\020\001\022\r\n\tCOM"
+    "PLETED\020\002\022\014\n\010CANCELED\020\003\022\n\n\006FAILED\020\004\022\021\n\rUN"
+    "KNOWN_QUERY\020\005\"\336\002\n\014QueryProfile\022 \n\002id\030\001 \001"
+    "(\0132\024.exec.shared.QueryId\022$\n\004type\030\002 \001(\0162\026"
+    ".exec.shared.QueryType\022\r\n\005start\030\003 \001(\003\022\013\n"
+    "\003end\030\004 \001(\003\022\r\n\005query\030\005 \001(\t\022\014\n\004plan\030\006 \001(\t\022"
+    "\'\n\007foreman\030\007 \001(\0132\026.exec.DrillbitEndpoint"
+    "\0222\n\005state\030\010 \001(\0162#.exec.shared.QueryResul"
+    "t.QueryState\022\027\n\017total_fragments\030\t \001(\005\022\032\n"
+    "\022finished_fragments\030\n \001(\005\022;\n\020fragment_pr"
+    "ofile\030\013 \003(\0132!.exec.shared.MajorFragmentP"
+    "rofile\"t\n\024MajorFragmentProfile\022\031\n\021major_"
+    "fragment_id\030\001 \001(\005\022A\n\026minor_fragment_prof"
+    "ile\030\002 \003(\0132!.exec.shared.MinorFragmentPro"
+    "file\"\274\002\n\024MinorFragmentProfile\022)\n\005state\030\001"
+    " \001(\0162\032.exec.shared.FragmentState\022(\n\005erro"
+    "r\030\002 \001(\0132\031.exec.shared.DrillPBError\022\031\n\021mi"
+    "nor_fragment_id\030\003 \001(\005\0226\n\020operator_profil"
+    "e\030\004 \003(\0132\034.exec.shared.OperatorProfile\022\022\n"
+    "\nstart_time\030\005 \001(\003\022\020\n\010end_time\030\006 \001(\003\022\023\n\013m"
+    "emory_used\030\007 \001(\003\022\027\n\017max_memory_used\030\010 \001("
+    "\003\022(\n\010endpoint\030\t \001(\0132\026.exec.DrillbitEndpo"
+    "int\"\372\001\n\017OperatorProfile\0221\n\rinput_profile"
+    "\030\001 \003(\0132\032.exec.shared.StreamProfile\022\023\n\013op"
+    "erator_id\030\003 \001(\005\022\025\n\roperator_type\030\004 \001(\005\022\023"
+    "\n\013setup_nanos\030\005 \001(\003\022\025\n\rprocess_nanos\030\006 \001"
+    "(\003\022\036\n\026local_memory_allocated\030\007 \001(\003\022(\n\006me"
+    "tric\030\010 \003(\0132\030.exec.shared.MetricValue\022\022\n\n"
+    "wait_nanos\030\t \001(\003\"B\n\rStreamProfile\022\017\n\007rec"
+    "ords\030\001 \001(\003\022\017\n\007batches\030\002 \001(\003\022\017\n\007schemas\030\003"
+    " \001(\003\"J\n\013MetricValue\022\021\n\tmetric_id\030\001 \001(\005\022\022"
+    "\n\nlong_value\030\002 \001(\003\022\024\n\014double_value\030\003 \001(\001"
+    "*5\n\nRpcChannel\022\017\n\013BIT_CONTROL\020\000\022\014\n\010BIT_D"
+    "ATA\020\001\022\010\n\004USER\020\002*/\n\tQueryType\022\007\n\003SQL\020\001\022\013\n"
+    "\007LOGICAL\020\002\022\014\n\010PHYSICAL\020\003*k\n\rFragmentStat"
+    "e\022\013\n\007SENDING\020\000\022\027\n\023AWAITING_ALLOCATION\020\001\022"
+    "\013\n\007RUNNING\020\002\022\014\n\010FINISHED\020\003\022\r\n\tCANCELLED\020"
+    "\004\022\n\n\006FAILED\020\005*\264\005\n\020CoreOperatorType\022\021\n\rSI"
+    "NGLE_SENDER\020\000\022\024\n\020BROADCAST_SENDER\020\001\022\n\n\006F"
+    "ILTER\020\002\022\022\n\016HASH_AGGREGATE\020\003\022\r\n\tHASH_JOIN"
+    "\020\004\022\016\n\nMERGE_JOIN\020\005\022\031\n\025HASH_PARTITION_SEN"
+    "DER\020\006\022\t\n\005LIMIT\020\007\022\024\n\020MERGING_RECEIVER\020\010\022\034"
+    "\n\030ORDERED_PARTITION_SENDER\020\t\022\013\n\007PROJECT\020"
+    "\n\022\026\n\022UNORDERED_RECEIVER\020\013\022\020\n\014RANGE_SENDE"
+    "R\020\014\022\n\n\006SCREEN\020\r\022\034\n\030SELECTION_VECTOR_REMO"
+    "VER\020\016\022\027\n\023STREAMING_AGGREGATE\020\017\022\016\n\nTOP_N_"
+    "SORT\020\020\022\021\n\rEXTERNAL_SORT\020\021\022\t\n\005TRACE\020\022\022\t\n\005"
+    "UNION\020\023\022\014\n\010OLD_SORT\020\024\022\032\n\026PARQUET_ROW_GRO"
+    "UP_SCAN\020\025\022\021\n\rHIVE_SUB_SCAN\020\026\022\025\n\021SYSTEM_T"
+    "ABLE_SCAN\020\027\022\021\n\rMOCK_SUB_SCAN\020\030\022\022\n\016PARQUE"
+    "T_WRITER\020\031\022\023\n\017DIRECT_SUB_SCAN\020\032\022\017\n\013TEXT_"
+    "WRITER\020\033\022\021\n\rTEXT_SUB_SCAN\020\034\022\021\n\rJSON_SUB_"
+    "SCAN\020\035\022\030\n\024INFO_SCHEMA_SUB_SCAN\020\036\022\023\n\017COMP"
+    "LEX_TO_JSON\020\037\022\025\n\021PRODUCER_CONSUMER\020 \022\022\n\016"
+    "HBASE_SUB_SCAN\020!\022\n\n\006WINDOW\020\"B.\n\033org.apac"
+    "he.drill.exec.protoB\rUserBitSharedH\001", 3956);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "UserBitShared.proto", &protobuf_RegisterTypes);
   UserCredentials::default_instance_ = new UserCredentials();
   QueryId::default_instance_ = new QueryId();
   DrillPBError::default_instance_ = new DrillPBError();
+  ExceptionWrapper::default_instance_ = new ExceptionWrapper();
+  StackTraceElementWrapper::default_instance_ = new StackTraceElementWrapper();
   ParsingError::default_instance_ = new ParsingError();
   RecordBatchDef::default_instance_ = new RecordBatchDef();
   NamePart::default_instance_ = new NamePart();
@@ -571,6 +634,8 @@ void protobuf_AddDesc_UserBitShared_2eproto() {
   UserCredentials::default_instance_->InitAsDefaultInstance();
   QueryId::default_instance_->InitAsDefaultInstance();
   DrillPBError::default_instance_->InitAsDefaultInstance();
+  ExceptionWrapper::default_instance_->InitAsDefaultInstance();
+  StackTraceElementWrapper::default_instance_->InitAsDefaultInstance();
   ParsingError::default_instance_->InitAsDefaultInstance();
   RecordBatchDef::default_instance_->InitAsDefaultInstance();
   NamePart::default_instance_->InitAsDefaultInstance();
@@ -679,6 +744,8 @@ bool CoreOperatorType_IsValid(int value) {
     case 30:
     case 31:
     case 32:
+    case 33:
+    case 34:
       return true;
     default:
       return false;
@@ -1162,6 +1229,7 @@ const int DrillPBError::kErrorIdFieldNumber;
 const int DrillPBError::kEndpointFieldNumber;
 const int DrillPBError::kErrorTypeFieldNumber;
 const int DrillPBError::kMessageFieldNumber;
+const int DrillPBError::kExceptionFieldNumber;
 const int DrillPBError::kParsingErrorFieldNumber;
 #endif  // !_MSC_VER
 
@@ -1172,6 +1240,7 @@ DrillPBError::DrillPBError()
 
 void DrillPBError::InitAsDefaultInstance() {
   endpoint_ = const_cast< ::exec::DrillbitEndpoint*>(&::exec::DrillbitEndpoint::default_instance());
+  exception_ = const_cast< ::exec::shared::ExceptionWrapper*>(&::exec::shared::ExceptionWrapper::default_instance());
 }
 
 DrillPBError::DrillPBError(const DrillPBError& from)
@@ -1186,6 +1255,7 @@ void DrillPBError::SharedCtor() {
   endpoint_ = NULL;
   error_type_ = 0;
   message_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  exception_ = NULL;
   ::memset(_has_bits_, 0, sizeof(_has_bits_));
 }
 
@@ -1202,6 +1272,7 @@ void DrillPBError::SharedDtor() {
   }
   if (this != default_instance_) {
     delete endpoint_;
+    delete exception_;
   }
 }
 
@@ -1242,6 +1313,9 @@ void DrillPBError::Clear() {
         message_->clear();
       }
     }
+    if (has_exception()) {
+      if (exception_ != NULL) exception_->::exec::shared::ExceptionWrapper::Clear();
+    }
   }
   parsing_error_.Clear();
   ::memset(_has_bits_, 0, sizeof(_has_bits_));
@@ -1313,21 +1387,35 @@ bool DrillPBError::MergePartialFromCodedStream(
         } else {
           goto handle_uninterpreted;
         }
-        if (input->ExpectTag(42)) goto parse_parsing_error;
+        if (input->ExpectTag(42)) goto parse_exception;
         break;
       }
 
-      // repeated .exec.shared.ParsingError parsing_error = 5;
+      // optional .exec.shared.ExceptionWrapper exception = 5;
       case 5: {
         if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
             ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_exception:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+               input, mutable_exception()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(50)) goto parse_parsing_error;
+        break;
+      }
+
+      // repeated .exec.shared.ParsingError parsing_error = 6;
+      case 6: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
          parse_parsing_error:
           DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
                 input, add_parsing_error()));
         } else {
           goto handle_uninterpreted;
         }
-        if (input->ExpectTag(42)) goto parse_parsing_error;
+        if (input->ExpectTag(50)) goto parse_parsing_error;
         if (input->ExpectAtEnd()) return true;
         break;
       }
@@ -1379,10 +1467,16 @@ void DrillPBError::SerializeWithCachedSizes(
       4, this->message(), output);
   }
 
-  // repeated .exec.shared.ParsingError parsing_error = 5;
+  // optional .exec.shared.ExceptionWrapper exception = 5;
+  if (has_exception()) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      5, this->exception(), output);
+  }
+
+  // repeated .exec.shared.ParsingError parsing_error = 6;
   for (int i = 0; i < this->parsing_error_size(); i++) {
     ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
-      5, this->parsing_error(i), output);
+      6, this->parsing_error(i), output);
   }
 
   if (!unknown_fields().empty()) {
@@ -1425,11 +1519,18 @@ void DrillPBError::SerializeWithCachedSizes(
         4, this->message(), target);
   }
 
-  // repeated .exec.shared.ParsingError parsing_error = 5;
+  // optional .exec.shared.ExceptionWrapper exception = 5;
+  if (has_exception()) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        5, this->exception(), target);
+  }
+
+  // repeated .exec.shared.ParsingError parsing_error = 6;
   for (int i = 0; i < this->parsing_error_size(); i++) {
     target = ::google::protobuf::internal::WireFormatLite::
       WriteMessageNoVirtualToArray(
-        5, this->parsing_error(i), target);
+        6, this->parsing_error(i), target);
   }
 
   if (!unknown_fields().empty()) {
@@ -1471,8 +1572,15 @@ int DrillPBError::ByteSize() const {
           this->message());
     }
 
+    // optional .exec.shared.ExceptionWrapper exception = 5;
+    if (has_exception()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+          this->exception());
+    }
+
   }
-  // repeated .exec.shared.ParsingError parsing_error = 5;
+  // repeated .exec.shared.ParsingError parsing_error = 6;
   total_size += 1 * this->parsing_error_size();
   for (int i = 0; i < this->parsing_error_size(); i++) {
     total_size +=
@@ -1519,6 +1627,9 @@ void DrillPBError::MergeFrom(const DrillPBError& from) {
     if (from.has_message()) {
       set_message(from.message());
     }
+    if (from.has_exception()) {
+      mutable_exception()->::exec::shared::ExceptionWrapper::MergeFrom(from.exception());
+    }
   }
   mutable_unknown_fields()->MergeFrom(from.unknown_fields());
 }
@@ -1546,6 +1657,7 @@ void DrillPBError::Swap(DrillPBError* other) {
     std::swap(endpoint_, other->endpoint_);
     std::swap(error_type_, other->error_type_);
     std::swap(message_, other->message_);
+    std::swap(exception_, other->exception_);
     parsing_error_.Swap(&other->parsing_error_);
     std::swap(_has_bits_[0], other->_has_bits_[0]);
     _unknown_fields_.Swap(&other->_unknown_fields_);
@@ -1565,6 +1677,790 @@ void DrillPBError::Swap(DrillPBError* other) {
 // ===================================================================
 
 #ifndef _MSC_VER
+const int ExceptionWrapper::kExceptionClassFieldNumber;
+const int ExceptionWrapper::kMessageFieldNumber;
+const int ExceptionWrapper::kStackTraceFieldNumber;
+const int ExceptionWrapper::kCauseFieldNumber;
+#endif  // !_MSC_VER
+
+ExceptionWrapper::ExceptionWrapper()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void ExceptionWrapper::InitAsDefaultInstance() {
+  cause_ = const_cast< ::exec::shared::ExceptionWrapper*>(&::exec::shared::ExceptionWrapper::default_instance());
+}
+
+ExceptionWrapper::ExceptionWrapper(const ExceptionWrapper& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void ExceptionWrapper::SharedCtor() {
+  _cached_size_ = 0;
+  exception_class_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  message_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  cause_ = NULL;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+ExceptionWrapper::~ExceptionWrapper() {
+  SharedDtor();
+}
+
+void ExceptionWrapper::SharedDtor() {
+  if (exception_class_ != &::google::protobuf::internal::kEmptyString) {
+    delete exception_class_;
+  }
+  if (message_ != &::google::protobuf::internal::kEmptyString) {
+    delete message_;
+  }
+  if (this != default_instance_) {
+    delete cause_;
+  }
+}
+
+void ExceptionWrapper::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* ExceptionWrapper::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return ExceptionWrapper_descriptor_;
+}
+
+const ExceptionWrapper& ExceptionWrapper::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_UserBitShared_2eproto();
+  return *default_instance_;
+}
+
+ExceptionWrapper* ExceptionWrapper::default_instance_ = NULL;
+
+ExceptionWrapper* ExceptionWrapper::New() const {
+  return new ExceptionWrapper;
+}
+
+void ExceptionWrapper::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (has_exception_class()) {
+      if (exception_class_ != &::google::protobuf::internal::kEmptyString) {
+        exception_class_->clear();
+      }
+    }
+    if (has_message()) {
+      if (message_ != &::google::protobuf::internal::kEmptyString) {
+        message_->clear();
+      }
+    }
+    if (has_cause()) {
+      if (cause_ != NULL) cause_->::exec::shared::ExceptionWrapper::Clear();
+    }
+  }
+  stack_trace_.Clear();
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool ExceptionWrapper::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional string exception_class = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_exception_class()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->exception_class().data(), this->exception_class().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(18)) goto parse_message;
+        break;
+      }
+
+      // optional string message = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_message:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_message()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->message().data(), this->message().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(26)) goto parse_stack_trace;
+        break;
+      }
+
+      // repeated .exec.shared.StackTraceElementWrapper stack_trace = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_stack_trace:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+                input, add_stack_trace()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(26)) goto parse_stack_trace;
+        if (input->ExpectTag(34)) goto parse_cause;
+        break;
+      }
+
+      // optional .exec.shared.ExceptionWrapper cause = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_cause:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+               input, mutable_cause()));
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void ExceptionWrapper::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional string exception_class = 1;
+  if (has_exception_class()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->exception_class().data(), this->exception_class().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      1, this->exception_class(), output);
+  }
+
+  // optional string message = 2;
+  if (has_message()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->message().data(), this->message().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      2, this->message(), output);
+  }
+
+  // repeated .exec.shared.StackTraceElementWrapper stack_trace = 3;
+  for (int i = 0; i < this->stack_trace_size(); i++) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      3, this->stack_trace(i), output);
+  }
+
+  // optional .exec.shared.ExceptionWrapper cause = 4;
+  if (has_cause()) {
+    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+      4, this->cause(), output);
+  }
+
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* ExceptionWrapper::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional string exception_class = 1;
+  if (has_exception_class()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->exception_class().data(), this->exception_class().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        1, this->exception_class(), target);
+  }
+
+  // optional string message = 2;
+  if (has_message()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->message().data(), this->message().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        2, this->message(), target);
+  }
+
+  // repeated .exec.shared.StackTraceElementWrapper stack_trace = 3;
+  for (int i = 0; i < this->stack_trace_size(); i++) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        3, this->stack_trace(i), target);
+  }
+
+  // optional .exec.shared.ExceptionWrapper cause = 4;
+  if (has_cause()) {
+    target = ::google::protobuf::internal::WireFormatLite::
+      WriteMessageNoVirtualToArray(
+        4, this->cause(), target);
+  }
+
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int ExceptionWrapper::ByteSize() const {
+  int total_size = 0;
+
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional string exception_class = 1;
+    if (has_exception_class()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->exception_class());
+    }
+
+    // optional string message = 2;
+    if (has_message()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->message());
+    }
+
+    // optional .exec.shared.ExceptionWrapper cause = 4;
+    if (has_cause()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+          this->cause());
+    }
+
+  }
+  // repeated .exec.shared.StackTraceElementWrapper stack_trace = 3;
+  total_size += 1 * this->stack_trace_size();
+  for (int i = 0; i < this->stack_trace_size(); i++) {
+    total_size +=
+      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+        this->stack_trace(i));
+  }
+
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void ExceptionWrapper::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const ExceptionWrapper* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const ExceptionWrapper*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void ExceptionWrapper::MergeFrom(const ExceptionWrapper& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  stack_trace_.MergeFrom(from.stack_trace_);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from.has_exception_class()) {
+      set_exception_class(from.exception_class());
+    }
+    if (from.has_message()) {
+      set_message(from.message());
+    }
+    if (from.has_cause()) {
+      mutable_cause()->::exec::shared::ExceptionWrapper::MergeFrom(from.cause());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void ExceptionWrapper::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void ExceptionWrapper::CopyFrom(const ExceptionWrapper& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool ExceptionWrapper::IsInitialized() const {
+
+  return true;
+}
+
+void ExceptionWrapper::Swap(ExceptionWrapper* other) {
+  if (other != this) {
+    std::swap(exception_class_, other->exception_class_);
+    std::swap(message_, other->message_);
+    stack_trace_.Swap(&other->stack_trace_);
+    std::swap(cause_, other->cause_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata ExceptionWrapper::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = ExceptionWrapper_descriptor_;
+  metadata.reflection = ExceptionWrapper_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int StackTraceElementWrapper::kClassNameFieldNumber;
+const int StackTraceElementWrapper::kFileNameFieldNumber;
+const int StackTraceElementWrapper::kLineNumberFieldNumber;
+const int StackTraceElementWrapper::kMethodNameFieldNumber;
+const int StackTraceElementWrapper::kIsNativeMethodFieldNumber;
+#endif  // !_MSC_VER
+
+StackTraceElementWrapper::StackTraceElementWrapper()
+  : ::google::protobuf::Message() {
+  SharedCtor();
+}
+
+void StackTraceElementWrapper::InitAsDefaultInstance() {
+}
+
+StackTraceElementWrapper::StackTraceElementWrapper(const StackTraceElementWrapper& from)
+  : ::google::protobuf::Message() {
+  SharedCtor();
+  MergeFrom(from);
+}
+
+void StackTraceElementWrapper::SharedCtor() {
+  _cached_size_ = 0;
+  class_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  file_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  line_number_ = 0;
+  method_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  is_native_method_ = false;
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+StackTraceElementWrapper::~StackTraceElementWrapper() {
+  SharedDtor();
+}
+
+void StackTraceElementWrapper::SharedDtor() {
+  if (class_name_ != &::google::protobuf::internal::kEmptyString) {
+    delete class_name_;
+  }
+  if (file_name_ != &::google::protobuf::internal::kEmptyString) {
+    delete file_name_;
+  }
+  if (method_name_ != &::google::protobuf::internal::kEmptyString) {
+    delete method_name_;
+  }
+  if (this != default_instance_) {
+  }
+}
+
+void StackTraceElementWrapper::SetCachedSize(int size) const {
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* StackTraceElementWrapper::descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return StackTraceElementWrapper_descriptor_;
+}
+
+const StackTraceElementWrapper& StackTraceElementWrapper::default_instance() {
+  if (default_instance_ == NULL) protobuf_AddDesc_UserBitShared_2eproto();
+  return *default_instance_;
+}
+
+StackTraceElementWrapper* StackTraceElementWrapper::default_instance_ = NULL;
+
+StackTraceElementWrapper* StackTraceElementWrapper::New() const {
+  return new StackTraceElementWrapper;
+}
+
+void StackTraceElementWrapper::Clear() {
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (has_class_name()) {
+      if (class_name_ != &::google::protobuf::internal::kEmptyString) {
+        class_name_->clear();
+      }
+    }
+    if (has_file_name()) {
+      if (file_name_ != &::google::protobuf::internal::kEmptyString) {
+        file_name_->clear();
+      }
+    }
+    line_number_ = 0;
+    if (has_method_name()) {
+      if (method_name_ != &::google::protobuf::internal::kEmptyString) {
+        method_name_->clear();
+      }
+    }
+    is_native_method_ = false;
+  }
+  ::memset(_has_bits_, 0, sizeof(_has_bits_));
+  mutable_unknown_fields()->Clear();
+}
+
+bool StackTraceElementWrapper::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+  ::google::protobuf::uint32 tag;
+  while ((tag = input->ReadTag()) != 0) {
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // optional string class_name = 1;
+      case 1: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_class_name()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->class_name().data(), this->class_name().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(18)) goto parse_file_name;
+        break;
+      }
+
+      // optional string file_name = 2;
+      case 2: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_file_name:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_file_name()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->file_name().data(), this->file_name().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(24)) goto parse_line_number;
+        break;
+      }
+
+      // optional int32 line_number = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_line_number:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+                 input, &line_number_)));
+          set_has_line_number();
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(34)) goto parse_method_name;
+        break;
+      }
+
+      // optional string method_name = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_method_name:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_method_name()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->method_name().data(), this->method_name().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(40)) goto parse_is_native_method;
+        break;
+      }
+
+      // optional bool is_native_method = 5;
+      case 5: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_is_native_method:
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
+                 input, &is_native_method_)));
+          set_has_is_native_method();
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectAtEnd()) return true;
+        break;
+      }
+
+      default: {
+      handle_uninterpreted:
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+          return true;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+  return true;
+#undef DO_
+}
+
+void StackTraceElementWrapper::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // optional string class_name = 1;
+  if (has_class_name()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->class_name().data(), this->class_name().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      1, this->class_name(), output);
+  }
+
+  // optional string file_name = 2;
+  if (has_file_name()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->file_name().data(), this->file_name().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      2, this->file_name(), output);
+  }
+
+  // optional int32 line_number = 3;
+  if (has_line_number()) {
+    ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->line_number(), output);
+  }
+
+  // optional string method_name = 4;
+  if (has_method_name()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->method_name().data(), this->method_name().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      4, this->method_name(), output);
+  }
+
+  // optional bool is_native_method = 5;
+  if (has_is_native_method()) {
+    ::google::protobuf::internal::WireFormatLite::WriteBool(5, this->is_native_method(), output);
+  }
+
+  if (!unknown_fields().empty()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        unknown_fields(), output);
+  }
+}
+
+::google::protobuf::uint8* StackTraceElementWrapper::SerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // optional string class_name = 1;
+  if (has_class_name()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->class_name().data(), this->class_name().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        1, this->class_name(), target);
+  }
+
+  // optional string file_name = 2;
+  if (has_file_name()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->file_name().data(), this->file_name().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        2, this->file_name(), target);
+  }
+
+  // optional int32 line_number = 3;
+  if (has_line_number()) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->line_number(), target);
+  }
+
+  // optional string method_name = 4;
+  if (has_method_name()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->method_name().data(), this->method_name().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        4, this->method_name(), target);
+  }
+
+  // optional bool is_native_method = 5;
+  if (has_is_native_method()) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->is_native_method(), target);
+  }
+
+  if (!unknown_fields().empty()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        unknown_fields(), target);
+  }
+  return target;
+}
+
+int StackTraceElementWrapper::ByteSize() const {
+  int total_size = 0;
+
+  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    // optional string class_name = 1;
+    if (has_class_name()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->class_name());
+    }
+
+    // optional string file_name = 2;
+    if (has_file_name()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->file_name());
+    }
+
+    // optional int32 line_number = 3;
+    if (has_line_number()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::Int32Size(
+          this->line_number());
+    }
+
+    // optional string method_name = 4;
+    if (has_method_name()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->method_name());
+    }
+
+    // optional bool is_native_method = 5;
+    if (has_is_native_method()) {
+      total_size += 1 + 1;
+    }
+
+  }
+  if (!unknown_fields().empty()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        unknown_fields());
+  }
+  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+  _cached_size_ = total_size;
+  GOOGLE_SAFE_CONCURRENT_WRITES_END();
+  return total_size;
+}
+
+void StackTraceElementWrapper::MergeFrom(const ::google::protobuf::Message& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  const StackTraceElementWrapper* source =
+    ::google::protobuf::internal::dynamic_cast_if_available<const StackTraceElementWrapper*>(
+      &from);
+  if (source == NULL) {
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+    MergeFrom(*source);
+  }
+}
+
+void StackTraceElementWrapper::MergeFrom(const StackTraceElementWrapper& from) {
+  GOOGLE_CHECK_NE(&from, this);
+  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+    if (from.has_class_name()) {
+      set_class_name(from.class_name());
+    }
+    if (from.has_file_name()) {
+      set_file_name(from.file_name());
+    }
+    if (from.has_line_number()) {
+      set_line_number(from.line_number());
+    }
+    if (from.has_method_name()) {
+      set_method_name(from.method_name());
+    }
+    if (from.has_is_native_method()) {
+      set_is_native_method(from.is_native_method());
+    }
+  }
+  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void StackTraceElementWrapper::CopyFrom(const ::google::protobuf::Message& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void StackTraceElementWrapper::CopyFrom(const StackTraceElementWrapper& from) {
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool StackTraceElementWrapper::IsInitialized() const {
+
+  return true;
+}
+
+void StackTraceElementWrapper::Swap(StackTraceElementWrapper* other) {
+  if (other != this) {
+    std::swap(class_name_, other->class_name_);
+    std::swap(file_name_, other->file_name_);
+    std::swap(line_number_, other->line_number_);
+    std::swap(method_name_, other->method_name_);
+    std::swap(is_native_method_, other->is_native_method_);
+    std::swap(_has_bits_[0], other->_has_bits_[0]);
+    _unknown_fields_.Swap(&other->_unknown_fields_);
+    std::swap(_cached_size_, other->_cached_size_);
+  }
+}
+
+::google::protobuf::Metadata StackTraceElementWrapper::GetMetadata() const {
+  protobuf_AssignDescriptorsOnce();
+  ::google::protobuf::Metadata metadata;
+  metadata.descriptor = StackTraceElementWrapper_descriptor_;
+  metadata.reflection = StackTraceElementWrapper_reflection_;
+  return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
 const int ParsingError::kStartColumnFieldNumber;
 const int ParsingError::kStartRowFieldNumber;
 const int ParsingError::kEndColumnFieldNumber;


[12/16] incubator-drill git commit: DRILL-1417: ensure star column is passed to scan in case non-partition columns are empty

Posted by jn...@apache.org.
DRILL-1417: ensure star column is passed to scan in case non-partition columns are empty


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

Branch: refs/heads/master
Commit: 70993d2d44a02c8edc48a7dc2ea0b79bded82d28
Parents: fdbd6a9
Author: Hanifi Gunes <hg...@maprtech.com>
Authored: Wed Oct 22 17:35:35 2014 -0700
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:56 2014 -0800

----------------------------------------------------------------------
 .../apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/70993d2d/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
index 0c13990..9cc1808 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
@@ -123,7 +123,7 @@ public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements
     List<Integer> selectedPartitionColumns = Lists.newArrayList();
     boolean selectAllColumns = false;
 
-    if (AbstractRecordReader.isStarQuery(columns) || columns == null || columns.size() == 0) {
+    if (columns == null || columns.size() == 0 || AbstractRecordReader.isStarQuery(columns)) {
       selectAllColumns = true;
     } else {
       List<SchemaPath> newColumns = Lists.newArrayList();
@@ -136,6 +136,12 @@ public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements
           newColumns.add(column);
         }
       }
+
+      // We must make sure to pass a table column(not to be confused with partition column) to the underlying record
+      // reader.
+      if (newColumns.size()==0) {
+        newColumns.add(AbstractRecordReader.STAR_COLUMN);
+      }
       // Create a new sub scan object with the new set of columns;
       scan = new EasySubScan(scan.getWorkUnits(), scan.getFormatPlugin(), newColumns, scan.getSelectionRoot());
     }


[11/16] incubator-drill git commit: DRILL-1539: fix an issue regarding populateEmpties in RepeatedMapVector

Posted by jn...@apache.org.
DRILL-1539: fix an issue regarding populateEmpties in RepeatedMapVector


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

Branch: refs/heads/master
Commit: 76df2ffe6a7ad999557fdf5f1bdf3d76288e65a3
Parents: 70993d2
Author: Hanifi Gunes <hg...@maprtech.com>
Authored: Tue Oct 21 23:16:47 2014 -0700
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:56 2014 -0800

----------------------------------------------------------------------
 .../org/apache/drill/exec/vector/complex/RepeatedMapVector.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/76df2ffe/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
index d73aa7f..99b9453 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
@@ -360,6 +360,7 @@ public class RepeatedMapVector extends AbstractContainerVector implements Repeat
     public boolean copyValueSafe(int srcIndex, int destIndex) {
       RepeatedMapHolder holder = new RepeatedMapHolder();
       accessor.get(srcIndex, holder);
+      to.populateEmpties(destIndex+1);
       int newIndex = to.offsets.getAccessor().get(destIndex);
       //todo: make these bulk copies
       for (int i = holder.start; i < holder.end; i++, newIndex++) {
@@ -372,7 +373,6 @@ public class RepeatedMapVector extends AbstractContainerVector implements Repeat
       if (!to.offsets.getMutator().setSafe(destIndex+1, newIndex)) {
         return false;
       }
-      to.lastPopulatedValueIndex = destIndex;
       return true;
     }
 
@@ -609,6 +609,7 @@ public class RepeatedMapVector extends AbstractContainerVector implements Repeat
   @Override
   public void clear() {
     getMutator().reset();
+
     offsets.clear();
     for(ValueVector v : vectors.values()) {
       v.clear();;


[15/16] incubator-drill git commit: DRILL-1544 : Support escape character in "like" or "similar to" SQL operator.

Posted by jn...@apache.org.
DRILL-1544 : Support escape character in "like" or "similar to" SQL operator.

Conflicts:
	exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java


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

Branch: refs/heads/master
Commit: f7570d9a30cefbec9b8ef42db9f395ad6527bd00
Parents: 797b1bc
Author: Jinfeng Ni <jn...@maprtech.com>
Authored: Thu Oct 16 13:58:51 2014 -0700
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:52:57 2014 -0800

----------------------------------------------------------------------
 .../exec/expr/fn/impl/StringFunctions.java      | 44 ++++++++++++++++++++
 .../org/apache/drill/TestExampleQueries.java    | 18 ++++++++
 .../test/resources/jsoninput/specialchar.json   |  3 ++
 3 files changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/f7570d9a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
index 9883f25..d6afa6a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
@@ -69,6 +69,28 @@ public class StringFunctions{
     }
   }
 
+  @FunctionTemplate(name = "like", scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
+  public static class LikeWithEscape implements DrillSimpleFunc{
+
+    @Param VarCharHolder input;
+    @Param(constant=true) VarCharHolder pattern;
+    @Param(constant=true) VarCharHolder escape;
+    @Output BitHolder out;
+    @Workspace java.util.regex.Matcher matcher;
+
+    public void setup(RecordBatch incoming) {
+      matcher = java.util.regex.Pattern.compile(org.apache.drill.exec.expr.fn.impl.RegexpUtil.sqlToRegexLike( //
+          org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(pattern.start,  pattern.end,  pattern.buffer),
+          org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(escape.start,  escape.end,  escape.buffer))).matcher("");
+    }
+
+    public void eval() {
+      String i = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start, input.end, input.buffer);
+      matcher.reset(i);
+      out.value = matcher.matches()? 1:0;
+    }
+  }
+
   @FunctionTemplate(names = {"similar", "similar to"}, scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
   public static class Similar implements DrillSimpleFunc{
     @Param VarCharHolder input;
@@ -88,6 +110,28 @@ public class StringFunctions{
     }
   }
 
+  @FunctionTemplate(names = {"similar", "similar to"}, scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
+  public static class SimilarWithEscape implements DrillSimpleFunc{
+    @Param VarCharHolder input;
+    @Param(constant=true) VarCharHolder pattern;
+    @Param(constant=true) VarCharHolder escape;
+    @Output BitHolder out;
+    @Workspace java.util.regex.Matcher matcher;
+
+    public void setup(RecordBatch incoming) {
+
+      matcher = java.util.regex.Pattern.compile(org.apache.drill.exec.expr.fn.impl.RegexpUtil.sqlToRegexSimilar(
+          org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(pattern.start,  pattern.end,  pattern.buffer),
+          org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(escape.start,  escape.end,  escape.buffer))).matcher("");
+    }
+
+    public void eval() {
+      String i = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start, input.end, input.buffer);
+      matcher.reset(i);
+      out.value = matcher.matches()? 1:0;
+    }
+  }
+
   /*
    * Replace all substring that match the regular expression with replacement.
    */

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/f7570d9a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
index 5a4cdd0..9eaa20e 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
@@ -512,4 +512,22 @@ public class TestExampleQueries extends BaseTestQuery{
   public void testTextQueries() throws Exception {
     test("select cast('285572516' as int) from cp.`tpch/nation.parquet` limit 1");
   }
+
+  @Test // DRILL-1544
+  public void testLikeEscape() throws Exception {
+    int actualRecordCount = testSql("select id, name from cp.`jsoninput/specialchar.json` where name like '%#_%' ESCAPE '#'");
+    int expectedRecordCount = 1;
+    assertEquals(String.format("Received unexepcted number of rows in output: expected=%d, received=%s",
+        expectedRecordCount, actualRecordCount), expectedRecordCount, actualRecordCount);
+
+  }
+
+  @Test
+  public void testSimilarEscape() throws Exception {
+    int actualRecordCount = testSql("select id, name from cp.`jsoninput/specialchar.json` where name similar to '(N|S)%#_%' ESCAPE '#'");
+    int expectedRecordCount = 1;
+    assertEquals(String.format("Received unexepcted number of rows in output: expected=%d, received=%s",
+        expectedRecordCount, actualRecordCount), expectedRecordCount, actualRecordCount);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/f7570d9a/exec/java-exec/src/test/resources/jsoninput/specialchar.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/jsoninput/specialchar.json b/exec/java-exec/src/test/resources/jsoninput/specialchar.json
new file mode 100644
index 0000000..0e32237
--- /dev/null
+++ b/exec/java-exec/src/test/resources/jsoninput/specialchar.json
@@ -0,0 +1,3 @@
+{"id": 0,"name": "AFRICA"}
+{"id": 1, "name": "AMERICA"}
+{"id": 5, "name": "NORTH_SOUTH_AMERICA"}


[05/16] incubator-drill git commit: DRILL-1525: Modify hash functions to use XXHash algorithm

Posted by jn...@apache.org.
DRILL-1525: Modify hash functions to use XXHash algorithm


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

Branch: refs/heads/master
Commit: 2e07c62f6bd9db240f745b18716b17fecd88d6ef
Parents: 3b8dd3b
Author: Mehant <me...@gmail.com>
Authored: Thu Aug 28 12:31:32 2014 -0700
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:55 2014 -0800

----------------------------------------------------------------------
 .../drill/exec/expr/fn/impl/HashFunctions.java  |  69 ++++----
 .../apache/drill/exec/expr/fn/impl/XXHash.java  | 173 +++++++++++++++++++
 2 files changed, 207 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2e07c62f/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java
index 7f6d8a5..dd8ac88 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java
@@ -69,7 +69,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(Float.floatToIntBits(in.value)).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -84,7 +84,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(Float.floatToIntBits(in.value)).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
 
@@ -101,7 +101,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(Double.doubleToLongBits(in.value)).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -116,7 +116,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(Double.doubleToLongBits(in.value)).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
 
@@ -133,7 +133,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash(in.buffer.nioBuffer(in.start, in.end - in.start), 0);
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer);
       }
     }
   }
@@ -151,7 +151,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash(in.buffer.nioBuffer(in.start, in.end - in.start), 0);
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer);
       }
     }
   }
@@ -169,7 +169,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash(in.buffer.nioBuffer(in.start, in.end - in.start), 0);
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer);
       }
     }
   }
@@ -184,11 +184,11 @@ public class HashFunctions {
     }
 
     public void eval() {
-      // TODO: implement hash function for other types
       if (in.isSet == 0) {
         out.value = 0;
-      } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value).asInt();
+      }
+      else {
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -202,11 +202,11 @@ public class HashFunctions {
     }
 
     public void eval() {
-      // TODO: implement hash function for other types
       if (in.isSet == 0) {
         out.value = 0;
-      } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(in.value).asInt();
+      }
+      else {
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -221,7 +221,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash(in.buffer.nioBuffer(in.start, in.end - in.start), 0);
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer);
     }
   }
 
@@ -235,7 +235,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash(in.buffer.nioBuffer(in.start, in.end - in.start), 0);
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer);
     }
   }
 
@@ -249,7 +249,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = org.apache.drill.exec.expr.fn.impl.HashHelper.hash(in.buffer.nioBuffer(in.start, in.end - in.start), 0);
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.start, in.end, in.buffer);
     }
   }
 
@@ -263,8 +263,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      // TODO: implement hash function for other types
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
 
@@ -278,7 +277,7 @@ public class HashFunctions {
 
     public void eval() {
       // TODO: implement hash function for other types
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(in.value).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
   @FunctionTemplate(name = "hash", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL)
@@ -290,7 +289,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
 
@@ -306,7 +305,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -320,7 +319,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
 
@@ -336,7 +335,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -350,7 +349,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(in.value).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
 
@@ -366,7 +365,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(in.value).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -380,7 +379,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value ^ in.index).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value ^ in.index, 0);
     }
   }
 
@@ -396,7 +395,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value ^ in.index).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value ^ in.index, 0);
       }
     }
   }
@@ -410,7 +409,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(in.value).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
 
@@ -426,7 +425,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(in.value).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -440,7 +439,7 @@ public class HashFunctions {
     }
 
     public void eval() {
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
     }
   }
 
@@ -456,7 +455,7 @@ public class HashFunctions {
       if (in.isSet == 0) {
         out.value = 0;
       } else {
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashLong(in.value).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value, 0);
       }
     }
   }
@@ -475,7 +474,7 @@ public class HashFunctions {
       for (int i = 0; i < in.nDecimalDigits; i++) {
         xor = xor ^ Decimal28SparseHolder.getInteger(i, in.start, in.buffer);
       }
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(xor).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(xor, 0);
     }
   }
 
@@ -495,7 +494,7 @@ public class HashFunctions {
         for (int i = 0; i < in.nDecimalDigits; i++) {
           xor = xor ^ NullableDecimal28SparseHolder.getInteger(i, in.start, in.buffer);
         }
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(xor).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(xor, 0);
       }
     }
   }
@@ -514,7 +513,7 @@ public class HashFunctions {
       for (int i = 0; i < in.nDecimalDigits; i++) {
         xor = xor ^ Decimal38SparseHolder.getInteger(i, in.start, in.buffer);
       }
-      out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(xor).asInt();
+      out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(xor, 0);
     }
   }
 
@@ -534,7 +533,7 @@ public class HashFunctions {
         for (int i = 0; i < in.nDecimalDigits; i++) {
           xor = xor ^ NullableDecimal38SparseHolder.getInteger(i, in.start, in.buffer);
         }
-        out.value = com.google.common.hash.Hashing.murmur3_128().hashInt(xor).asInt();
+        out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(xor, 0);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2e07c62f/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java
new file mode 100644
index 0000000..a8a6484
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java
@@ -0,0 +1,173 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.expr.fn.impl;
+
+import io.netty.buffer.DrillBuf;
+import io.netty.util.internal.PlatformDependent;
+
+import com.google.common.primitives.UnsignedLongs;
+
+public final class XXHash {
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(XXHash.class);
+
+  static final long PRIME64_1 = UnsignedLongs.decode("11400714785074694791");
+  static final long PRIME64_2 = UnsignedLongs.decode("14029467366897019727");
+  static final long PRIME64_3 = UnsignedLongs.decode("1609587929392839161");
+  static final long PRIME64_4 = UnsignedLongs.decode("9650029242287828579");
+  static final long PRIME64_5 = UnsignedLongs.decode("2870177450012600261");
+
+  public static long hash64(long start, long bEnd, long seed) {
+    long len = bEnd - start;
+    long h64;
+    long p = start;
+
+    // for long strings (greater than 32 bytes)
+    if (len >= 32) {
+      final long limit = bEnd - 32;
+      long v1 = seed + PRIME64_1 + PRIME64_2;
+      long v2 = seed + PRIME64_2;
+      long v3 = seed + 0;
+      long v4 = seed - PRIME64_1;
+
+      do {
+        v1 += PlatformDependent.getLong(p) * PRIME64_2;
+        p = p + 8;
+        v1 = Long.rotateLeft(v1, 31);
+        v1 *= PRIME64_1;
+
+        v2 += PlatformDependent.getLong(p) * PRIME64_2;
+        p = p + 8;
+        v2 = Long.rotateLeft(v2, 31);
+        v2 *= PRIME64_1;
+
+        v3 += PlatformDependent.getLong(p) * PRIME64_2;
+        p = p + 8;
+        v3 = Long.rotateLeft(v3, 31);
+        v3 *= PRIME64_1;
+
+        v4 += PlatformDependent.getLong(p) * PRIME64_2;
+        p = p + 8;
+        v4 = Long.rotateLeft(v4, 31);
+        v4 *= PRIME64_1;
+      } while (p <= limit);
+
+      h64 = Long.rotateLeft(v1, 1) + Long.rotateLeft(v2, 7) + Long.rotateLeft(v3, 12) + Long.rotateLeft(v4, 18);
+
+      v1 *= PRIME64_2;
+      v1 = Long.rotateLeft(v1, 31);
+      v1 *= PRIME64_1;
+      h64 ^= v1;
+
+      h64 = h64 * PRIME64_1 + PRIME64_4;
+
+      v2 *= PRIME64_2;
+      v2 = Long.rotateLeft(v2, 31);
+      v2 *= PRIME64_1;
+      h64 ^= v2;
+
+      h64 = h64 * PRIME64_1 + PRIME64_4;
+
+      v3 *= PRIME64_2;
+      v3 = Long.rotateLeft(v3, 31);
+      v3 *= PRIME64_1;
+      h64 ^= v3;
+
+      h64 = h64 * PRIME64_1 + PRIME64_4;
+
+      v4 *= PRIME64_2;
+      v4 = Long.rotateLeft(v4, 31);
+      v4 *= PRIME64_1;
+      h64 ^= v4;
+
+      h64 = h64 * PRIME64_1 + PRIME64_4;
+    } else {
+      h64 = seed + PRIME64_5;
+    }
+
+    h64 += len;
+
+    while (p + 8 <= bEnd) {
+      long k1 = PlatformDependent.getLong(p);
+      k1 *= PRIME64_2;
+      k1 = Long.rotateLeft(k1, 31);
+      k1 *= PRIME64_1;
+      h64 ^= k1;
+      h64 = Long.rotateLeft(h64, 27) * PRIME64_1 + PRIME64_4;
+      p += 8;
+    }
+
+    if (p + 4 <= bEnd) {
+      h64 ^= PlatformDependent.getInt(p) * PRIME64_1;
+      h64 = Long.rotateLeft(h64, 23) * PRIME64_2 + PRIME64_3;
+      p += 4;
+    }
+    while (p < bEnd) {
+      h64 ^= PlatformDependent.getByte(p) * PRIME64_5;
+      h64 = Long.rotateLeft(h64, 11) * PRIME64_1;
+      p++;
+    }
+
+    return applyFinalHashComputation(h64);
+  }
+
+  public static int hash32(int start, int end, DrillBuf buffer){
+    long s = buffer.memoryAddress() + start;
+    long e = buffer.memoryAddress() + end;
+    return hash32(s, e, 0);
+  }
+
+  public static int hash32(int val, int seed){
+    long h64 = seed + PRIME64_5;
+    h64 += 4; // add length (4 bytes) to hash value
+    h64 ^= val * PRIME64_1;
+    h64 = Long.rotateLeft(h64, 23) * PRIME64_2 + PRIME64_3;
+    return (int) applyFinalHashComputation(h64);
+  }
+
+  public static int hash32(float val, int seed){
+    return hash32(Float.floatToIntBits(val), seed);
+  }
+
+  public static int hash32(double val, int seed){
+    return hash32(Double.doubleToLongBits(val), seed);
+  }
+
+  public static int hash32(long val, int seed){
+    long h64 = seed + PRIME64_5;
+    h64 += 8; // add length (8 bytes) to hash value
+    long k1 = val* PRIME64_2;
+    k1 = Long.rotateLeft(k1, 31);
+    k1 *= PRIME64_1;
+    h64 ^= k1;
+    h64 = Long.rotateLeft(h64, 27) * PRIME64_1 + PRIME64_4;
+    return (int) applyFinalHashComputation(h64);
+  }
+
+  public static int hash32(long start, long bEnd, long seed){
+    return (int) hash64(start, bEnd, seed);
+  }
+
+  private static long applyFinalHashComputation(long h64) {
+    h64 ^= h64 >> 33;
+    h64 *= PRIME64_2;
+    h64 ^= h64 >> 29;
+    h64 *= PRIME64_3;
+    h64 ^= h64 >> 32;
+    return h64;
+  }
+}


[10/16] incubator-drill git commit: DRILL-1480: Update Netty to 4.0.24.Final

Posted by jn...@apache.org.
DRILL-1480: Update Netty to 4.0.24.Final


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

Branch: refs/heads/master
Commit: 66d5be482b9cf43b490b229ce73f72a9590df3d1
Parents: 30c40ea
Author: Parth Chandra <pc...@maprtech.com>
Authored: Fri Oct 31 16:14:49 2014 -0700
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:56 2014 -0800

----------------------------------------------------------------------
 exec/java-exec/pom.xml | 2 +-
 pom.xml                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/66d5be48/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index 223a782..55721d1 100644
--- a/exec/java-exec/pom.xml
+++ b/exec/java-exec/pom.xml
@@ -100,7 +100,7 @@
       <groupId>io.netty</groupId>
       <artifactId>netty-transport-native-epoll</artifactId>
       <classifier>linux-x86_64</classifier>
-      <version>4.0.20.Final</version>
+      <version>4.0.24.Final</version>
     </dependency>
     <dependency>
       <groupId>org.glassfish.jersey.ext</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/66d5be48/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 17b4490..25ca6a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -482,7 +482,7 @@
     <dependency>
       <groupId>io.netty</groupId>
       <artifactId>netty-handler</artifactId>
-      <version>4.0.20.Final</version>
+      <version>4.0.24.Final</version>
     </dependency>
 
     <dependency>


[14/16] incubator-drill git commit: Update WorkEventBus to immediately fail if Fragment is unavailable. No need to wait now that we propogate intermediate fragments before leaf fragments.

Posted by jn...@apache.org.
Update WorkEventBus to immediately fail if Fragment is unavailable.  No need to wait now that we propogate intermediate fragments before leaf fragments.


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

Branch: refs/heads/master
Commit: 797b1bcffbcda4dd5e7c3be1bb3ba1e9593cff16
Parents: 06f0e17
Author: Jacques Nadeau <ja...@apache.org>
Authored: Thu Nov 6 20:43:32 2014 -0800
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:57 2014 -0800

----------------------------------------------------------------------
 .../drill/exec/rpc/control/WorkEventBus.java    | 49 +++-----------------
 1 file changed, 7 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/797b1bcf/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java
index 23380ff..eae7b5e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java
@@ -17,25 +17,19 @@
  */
 package org.apache.drill.exec.rpc.control;
 
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.drill.exec.cache.DistributedMap;
 import org.apache.drill.exec.exception.FragmentSetupException;
 import org.apache.drill.exec.proto.BitControl.FragmentStatus;
-import org.apache.drill.exec.proto.BitControl.PlanFragment;
 import org.apache.drill.exec.proto.ExecProtos.FragmentHandle;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
 import org.apache.drill.exec.proto.helper.QueryIdHelper;
 import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.work.WorkManager.WorkerBee;
-import org.apache.drill.exec.work.foreman.Foreman;
 import org.apache.drill.exec.work.foreman.FragmentStatusListener;
 import org.apache.drill.exec.work.fragment.FragmentManager;
-import org.apache.drill.exec.work.fragment.NonRootFragmentManager;
-import org.apache.drill.exec.work.fragment.RootFragmentManager;
 
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
@@ -48,8 +42,9 @@ public class WorkEventBus {
   private final ConcurrentMap<QueryId, FragmentStatusListener> listeners = new ConcurrentHashMap<QueryId, FragmentStatusListener>(
       16, 0.75f, 16);
   private final WorkerBee bee;
-  private final Cache<FragmentHandle,Void> cancelledFragments = CacheBuilder.newBuilder()
+  private final Cache<FragmentHandle,Integer> recentlyFinishedFragments = CacheBuilder.newBuilder()
           .maximumSize(10000)
+
           .expireAfterWrite(10, TimeUnit.MINUTES)
           .build();
 
@@ -85,14 +80,10 @@ public class WorkEventBus {
 
   public void setFragmentManager(FragmentManager fragmentManager) {
     logger.debug("Manager created: {}", QueryIdHelper.getQueryIdentifier(fragmentManager.getHandle()));
-
-    synchronized (managers) {
-      FragmentManager old = managers.putIfAbsent(fragmentManager.getHandle(), fragmentManager);
-      managers.notifyAll();
+    FragmentManager old = managers.putIfAbsent(fragmentManager.getHandle(), fragmentManager);
       if (old != null) {
         throw new IllegalStateException(
             "Tried to set fragment manager when has already been set for the provided fragment handle.");
-      }
     }
   }
 
@@ -102,54 +93,28 @@ public class WorkEventBus {
   }
 
   public FragmentManager getFragmentManager(FragmentHandle handle) throws FragmentSetupException {
-
     // check if this was a recently canceled fragment.  If so, throw away message.
-    if (cancelledFragments.asMap().containsKey(handle)) {
+    if (recentlyFinishedFragments.asMap().containsKey(handle)) {
       logger.debug("Fragment: {} was cancelled. Ignoring fragment handle", handle);
       return null;
     }
 
-    // chm manages concurrency better then everyone fighting for the same lock so we'll do a double check.
+    // since non-leaf fragments are sent first, it is an error condition if the manager is unavailable.
     FragmentManager m = managers.get(handle);
     if(m != null){
       return m;
     }
-
-    logger.debug("Fragment was requested but no manager exists.  Waiting for manager for fragment: {}", QueryIdHelper.getQueryIdentifier(handle));
-    try{
-    // We need to handle the race condition between the fragments being sent to leaf nodes and intermediate nodes.  It is possible that a leaf node would send a data batch to a intermediate node before the intermediate node received the associated plan.  As such, we will wait here for a bit to see if the appropriate fragment shows up.
-    long expire = System.currentTimeMillis() + 30*1000;
-    synchronized(managers){
-
-      // we loop because we may be woken up by some other, unrelated manager insertion.
-      while(true){
-        m = managers.get(handle);
-        if(m != null) {
-          return m;
-        }
-        long timeToWait = expire - System.currentTimeMillis();
-        if(timeToWait <= 0){
-          break;
-        }
-
-        managers.wait(timeToWait);
-      }
-
-      throw new FragmentSetupException("Failed to receive plan fragment that was required for id: " + QueryIdHelper.getQueryIdentifier(handle));
-    }
-    }catch(InterruptedException e){
-      throw new FragmentSetupException("Interrupted while waiting to receive plan fragment..");
-    }
+    throw new FragmentSetupException("Failed to receive plan fragment that was required for id: " + QueryIdHelper.getQueryIdentifier(handle));
   }
 
   public void cancelFragment(FragmentHandle handle) {
     logger.debug("Fragment canceled: {}", QueryIdHelper.getQueryIdentifier(handle));
-    cancelledFragments.put(handle, null);
     removeFragmentManager(handle);
   }
 
   public void removeFragmentManager(FragmentHandle handle) {
     logger.debug("Removing fragment manager: {}", QueryIdHelper.getQueryIdentifier(handle));
+    recentlyFinishedFragments.put(handle,  1);
     managers.remove(handle);
   }
 


[04/16] incubator-drill git commit: DRILL-1619: Fix running and output type for count aggregate function Raise an exception while performing aggregate functions on boolean data type

Posted by jn...@apache.org.
DRILL-1619: Fix running and output type for count aggregate function Raise an exception while performing aggregate functions on boolean data type


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

Branch: refs/heads/master
Commit: 0f069bad0bbbc1f4f83d9e6a7194654fc5803ff2
Parents: 61053a8
Author: Mehant Baid <me...@gmail.com>
Authored: Thu Oct 30 23:02:41 2014 -0700
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Fri Nov 7 10:50:55 2014 -0800

----------------------------------------------------------------------
 .../src/main/codegen/data/AggrTypes1.tdd        |  8 +-
 .../expr/fn/impl/AggregateErrorFunctions.java   | 84 ++++++++++++++++++++
 2 files changed, 86 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0f069bad/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd b/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd
index 5b4041c..45d30a2 100644
--- a/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd
+++ b/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd
@@ -48,10 +48,8 @@
      ]
    },
    {className: "Max", funcName: "max", types: [
-      {inputType: "Bit", outputType: "Bit", runningType: "Bit", major: "Numeric"},
       {inputType: "Int", outputType: "Int", runningType: "Int", major: "Numeric"},
       {inputType: "BigInt", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
-      {inputType: "NullableBit", outputType: "NullableBit", runningType: "Bit", major: "Numeric"},
       {inputType: "NullableInt", outputType: "NullableInt", runningType: "Int", major: "Numeric"},
       {inputType: "NullableBigInt", outputType: "NullableBigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "Float4", outputType: "Float4", runningType: "Float4", major: "Numeric"},
@@ -79,10 +77,8 @@
      ]
    },
    {className: "Sum", funcName: "sum", types: [
-      {inputType: "Bit", outputType: "Bit", runningType: "Bit", major: "Numeric"},
       {inputType: "Int", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "BigInt", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
-      {inputType: "NullableBit", outputType: "NullableBit", runningType: "Bit", major: "Numeric"},
       {inputType: "NullableInt", outputType: "NullableBigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "NullableBigInt", outputType: "NullableBigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "Float4", outputType: "Float8", runningType: "Float8", major: "Numeric"},
@@ -98,10 +94,10 @@
      ]
    },
    {className: "Count", funcName: "count", types: [
-      {inputType: "Bit", outputType: "Bit", runningType: "Bit", major: "Numeric"},
+      {inputType: "Bit", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "Int", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "BigInt", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
-      {inputType: "NullableBit", outputType: "Bit", runningType: "Bit", major: "Numeric"},
+      {inputType: "NullableBit", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "NullableInt", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "NullableBigInt", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},
       {inputType: "Float4", outputType: "BigInt", runningType: "BigInt", major: "Numeric"},

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0f069bad/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java
new file mode 100644
index 0000000..48a6625
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/AggregateErrorFunctions.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.expr.fn.impl;
+
+import org.apache.drill.exec.expr.DrillAggFunc;
+import org.apache.drill.exec.expr.annotations.FunctionTemplate;
+import org.apache.drill.exec.expr.annotations.Output;
+import org.apache.drill.exec.expr.annotations.Param;
+import org.apache.drill.exec.expr.annotations.Workspace;
+import org.apache.drill.exec.expr.holders.BigIntHolder;
+import org.apache.drill.exec.expr.holders.BitHolder;
+import org.apache.drill.exec.expr.holders.NullableBitHolder;
+import org.apache.drill.exec.record.RecordBatch;
+
+public class AggregateErrorFunctions {
+
+  @FunctionTemplate(names = {"sum", "max", "avg", "stddev_pop", "stddev_samp", "stddev", "var_pop", "var_samp", "variance"}, scope = FunctionTemplate.FunctionScope.POINT_AGGREGATE)
+  public static class BitAggregateErrorFunctions implements DrillAggFunc {
+
+    @Param BitHolder in;
+    @Workspace BigIntHolder value;
+    @Output BigIntHolder out;
+
+    public void setup(RecordBatch b) {
+      if (true) {
+        throw new RuntimeException("Only COUNT aggregate function supported for Boolean type");
+      }
+    }
+
+    @Override
+    public void add() {
+    }
+
+    @Override
+    public void output() {
+    }
+
+    @Override
+    public void reset() {
+    }
+
+  }
+
+  @FunctionTemplate(names = {"sum", "max", "avg", "stddev_pop", "stddev_samp", "stddev", "var_pop", "var_samp", "variance"}, scope = FunctionTemplate.FunctionScope.POINT_AGGREGATE)
+  public static class NullableBitAggregateErrorFunctions implements DrillAggFunc{
+
+    @Param NullableBitHolder in;
+    @Workspace BigIntHolder value;
+    @Output BigIntHolder out;
+
+    public void setup(RecordBatch b) {
+      if (true) {
+        throw new RuntimeException("Only COUNT aggregate function supported for Boolean type");
+      }
+    }
+
+    @Override
+    public void add() {
+    }
+
+    @Override
+    public void output() {
+    }
+
+    @Override
+    public void reset() {
+    }
+  }
+}