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

 ##########
 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:
   So we do two transfers? Cheaper to transfer directly to output vector.  We 
can create a new transfer pair with the source vector in the transfer pair we 
set up.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to