Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.google.common.util.concurrent.ListenableFuture;
import io.trino.memory.context.LocalMemoryContext;
import io.trino.spi.Page;
import io.trino.spi.block.Block;
import io.trino.spi.connector.SortOrder;
import io.trino.spi.type.Type;
import io.trino.spiller.Spiller;
Expand Down Expand Up @@ -286,11 +285,7 @@ public Page getOutput()
return null;
}
Page nextPage = next.get();
Block[] blocks = new Block[outputChannels.length];
for (int i = 0; i < outputChannels.length; i++) {
blocks[i] = nextPage.getBlock(outputChannels[i]);
}
return new Page(nextPage.getPositionCount(), blocks);
return nextPage.getColumns(outputChannels);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getColumns() calls wrapBlocksWithoutCopy(positionCount, blocks), while new Page(count, blocks) uses blocksCopyRequired = true. Have you analyzed the impact of that change in semantics?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's the intention behind this change. The Block[] array in the previous implementation was created locally (not shared anywhere else) but was created once and then immediately cloned by the page constructor unnecessarily. Now we only create a single copy of the blocks array inside of Page#getColumns which requires no additional copy (and makes the code a little cleaner).

}

@Override
Expand Down