Repository: incubator-drill Updated Branches: refs/heads/master 687b9b0b6 -> 654c879f7
DRILL-1039: Preserve schema even when no rows are copied in RemovingRecordBatch Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/bb212634 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/bb212634 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/bb212634 Branch: refs/heads/master Commit: bb212634aa358a60c4d9f271cb13746130a6b0fa Parents: 687b9b0 Author: Mehant Baid <meha...@gmail.com> Authored: Fri Aug 15 17:04:41 2014 -0700 Committer: Aditya Kishore <adi...@maprtech.com> Committed: Mon Aug 18 13:08:06 2014 +0530 ---------------------------------------------------------------------- .../impl/svremover/RemovingRecordBatch.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/bb212634/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java index 42f2128..4ca2cdf 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java @@ -30,6 +30,7 @@ import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.SelectionVectorRemover; import org.apache.drill.exec.record.AbstractSingleRecordBatch; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; +import org.apache.drill.exec.record.HyperVectorWrapper; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.TransferPair; import org.apache.drill.exec.record.VectorContainer; @@ -228,10 +229,12 @@ public class RemovingRecordBatch extends AbstractSingleRecordBatch<SelectionVect private Copier getGenerated2Copier() throws SchemaChangeException{ Preconditions.checkArgument(incoming.getSchema().getSelectionVectorMode() == SelectionVectorMode.TWO_BYTE); - for(VectorWrapper<?> i : incoming){ - ValueVector v = TypeHelper.getNewVector(i.getField(), oContext.getAllocator()); - container.add(v); + List<ValueVector> out = Lists.newArrayList(); + for(VectorWrapper<?> vv : incoming){ + TransferPair tp = vv.getValueVector().getTransferPair(); + out.add(tp.getTo()); } + container.addCollection(out); try { final CodeGenerator<Copier> cg = CodeGenerator.get(Copier.TEMPLATE_DEFINITION2, context.getFunctionRegistry()); @@ -252,11 +255,14 @@ public class RemovingRecordBatch extends AbstractSingleRecordBatch<SelectionVect public static Copier getGenerated4Copier(RecordBatch batch, FragmentContext context, BufferAllocator allocator, VectorContainer container, RecordBatch outgoing) throws SchemaChangeException{ - for(VectorWrapper<?> i : batch){ + List<ValueVector> out = Lists.newArrayList(); - ValueVector v = TypeHelper.getNewVector(i.getField(), allocator); - container.add(v); + for(VectorWrapper<?> vv : batch){ + ValueVector v = vv.getValueVectors()[0]; + TransferPair tp = v.getTransferPair(); + out.add(tp.getTo()); } + container.addCollection(out); try { final CodeGenerator<Copier> cg = CodeGenerator.get(Copier.TEMPLATE_DEFINITION4, context.getFunctionRegistry());