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 @@ -19,7 +19,7 @@
import com.google.inject.Inject;
import io.trino.spi.Page;
import io.trino.spi.TrinoException;
import io.trino.spi.block.BlockBuilder;
import io.trino.spi.block.RunLengthEncodedBlock;
import io.trino.spi.type.Type;

import java.util.ArrayList;
Expand All @@ -32,7 +32,6 @@
import java.util.OptionalLong;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.IntStream;

import static com.google.common.base.Preconditions.checkArgument;
import static io.trino.plugin.memory.MemoryErrorCode.MEMORY_LIMIT_EXCEEDED;
Expand Down Expand Up @@ -118,10 +117,7 @@ public synchronized List<Page> getPages(
}
// Append missing columns with null values. This situation happens when a new column is added without additional insert.
for (int j = page.getChannelCount(); j < columnIndexes.length; j++) {
Type type = columnTypes.get(j);
BlockBuilder builder = type.createBlockBuilder(null, page.getPositionCount());
IntStream.range(0, page.getPositionCount()).forEach(_ -> builder.appendNull());
page = page.appendColumn(builder.build());
page = page.appendColumn(RunLengthEncodedBlock.create(columnTypes.get(i), null, page.getPositionCount()));
Copy link

Choose a reason for hiding this comment

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

Wanting to confirm is this the correct variable? Seems like j is iterating over column indexes while i is iterating over pages.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch, fixed this in #26167

}
partitionedPages.add(page.getColumns(columnIndexes));
}
Expand Down