parthchandra closed pull request #1343: DRILL-6530: JVM crash with a query involving multiple json files with… URL: https://github.com/apache/drill/pull/1343
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/exec/vector/src/main/codegen/templates/ListWriters.java b/exec/vector/src/main/codegen/templates/ListWriters.java index cab8772a741..4300857b9eb 100644 --- a/exec/vector/src/main/codegen/templates/ListWriters.java +++ b/exec/vector/src/main/codegen/templates/ListWriters.java @@ -107,11 +107,13 @@ public void setValueCount(int count){ 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 MapWriter map() { 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 ListWriter list() { </#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}); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services