This is an automated email from the ASF dual-hosted git repository. parthc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/drill.git
commit 208733b52ec40fd49e6bd424782f7c71aabef7e3 Author: Sorabh Hamirwasia <shamirwa...@maprtech.com> AuthorDate: Tue Jun 26 10:53:53 2018 -0700 DRILL-6530: JVM crash with a query involving multiple json files with one file having a schema change of one column from string to list This closes #1343 --- .../vector/src/main/codegen/templates/ListWriters.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/exec/vector/src/main/codegen/templates/ListWriters.java b/exec/vector/src/main/codegen/templates/ListWriters.java index cab8772..4300857 100644 --- a/exec/vector/src/main/codegen/templates/ListWriters.java +++ b/exec/vector/src/main/codegen/templates/ListWriters.java @@ -107,11 +107,13 @@ public class ${mode}ListWriter extends AbstractFieldWriter { public MapWriter map() { switch (mode) { case INIT: - int vectorCount = container.size(); + final ValueVector oldVector = container.getChild(name); final RepeatedMapVector vector = container.addOrGet(name, RepeatedMapVector.TYPE, RepeatedMapVector.class); innerVector = vector; writer = new RepeatedMapWriter(vector, this); - if(vectorCount != container.size()) { + // oldVector will be null if it's first batch being created and it might not be same as newly added vector + // if new batch has schema change + if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(${index}); @@ -131,11 +133,13 @@ public class ${mode}ListWriter extends AbstractFieldWriter { public ListWriter list() { switch (mode) { case INIT: - final int vectorCount = container.size(); + final ValueVector oldVector = container.getChild(name); final RepeatedListVector vector = container.addOrGet(name, RepeatedListVector.TYPE, RepeatedListVector.class); innerVector = vector; writer = new RepeatedListWriter(null, vector, this); - if (vectorCount != container.size()) { + // oldVector will be null if it's first batch being created and it might not be same as newly added vector + // if new batch has schema change + if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(${index}); @@ -176,11 +180,13 @@ public class ${mode}ListWriter extends AbstractFieldWriter { </#if> switch (mode) { case INIT: - final int vectorCount = container.size(); + final ValueVector oldVector = container.getChild(name); final Repeated${capName}Vector vector = container.addOrGet(name, ${upperName}_TYPE, Repeated${capName}Vector.class); innerVector = vector; writer = new Repeated${capName}WriterImpl(vector, this); - if(vectorCount != container.size()) { + // oldVector will be null if it's first batch being created and it might not be same as newly added vector + // if new batch has schema change + if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(${index});