sohami commented on a change in pull request #1374: DRILL-6542 : 
IndexOutOfBoundsException for multilevel lateral queries…
URL: https://github.com/apache/drill/pull/1374#discussion_r202218606
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unnest/UnnestImpl.java
 ##########
 @@ -97,8 +99,16 @@ public final int unnestRecords(final int recordCount) {
 
     logger.debug("Unnest: currentRecord: {}, innerValueCount: {}, record 
count: {}, output limit: {}", innerValueCount,
         recordCount, outputLimit);
+    final SchemaChangeCallBack callBack = new SchemaChangeCallBack();
     for (TransferPair t : transfers) {
       t.splitAndTransfer(innerValueIndex, count);
+
+      // Get the corresponding ValueVector in output container and transfer 
the data
+      final ValueVector vectorWithData = t.getTo();
+      final ValueVector outputVector = 
outgoing.getContainer().addOrGet(vectorWithData.getField(), callBack);
+      Preconditions.checkState(!callBack.getSchemaChangedAndReset(), "Outgoing 
container doesn't have " +
+        "expected ValueVector of type %s, present in TransferPair of unnest 
field", vectorWithData.getClass());
+      vectorWithData.makeTransferPair(outputVector).transfer();
 
 Review comment:
   Yes we have to do 2 transfers since there is no api for 
getTransferPairToSingleMap to take target vector. For New Schema there are 2 
cases, in one we have to preserve the output container vector (when schema 
change is for non-unnest column) but reset transfers whereas in other case we 
have to create a new vector in the container (when schema change is on unnest 
column). That's the reason it is done this way.

----------------------------------------------------------------
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

Reply via email to