in src/main/java/org/apache/paimon/trino/TrinoMergePageSourceWrapper.java [63:85]
public Page getNextPage() {
Page nextPage = pageSource.getNextPage();
if (nextPage == null) {
return null;
}
int rowCount = nextPage.getPositionCount();
Block[] newBlocks = new Block[nextPage.getChannelCount() + 1];
Block[] rowIdBlocks = new Block[fieldToIndex.size()];
for (int i = 0, idx = 0; i < nextPage.getChannelCount(); i++) {
Block block = nextPage.getBlock(i);
newBlocks[i] = block;
if (fieldToIndex.containsValue(i)) {
rowIdBlocks[idx] = block;
idx++;
}
}
newBlocks[nextPage.getChannelCount()] =
RowBlock.fromNotNullSuppressedFieldBlocks(
rowCount, Optional.of(new boolean[fieldToIndex.size()]), rowIdBlocks);
return new Page(rowCount, newBlocks);
}