Github user bhavya411 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2412#discussion_r198136493 --- Diff: integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataPageSource.java --- @@ -166,61 +146,31 @@ protected void closeWithSuppression(Throwable throwable) /** * Lazy Block Implementation for the Carbondata */ - private final class CarbondataBlockLoader - implements LazyBlockLoader<LazyBlock> - { + private final class CarbondataBlockLoader implements LazyBlockLoader<LazyBlock> { private final int expectedBatchId = batchId; private final int columnIndex; - private final Type type; private boolean loaded; - public CarbondataBlockLoader(int columnIndex, Type type) - { + CarbondataBlockLoader(int columnIndex) { this.columnIndex = columnIndex; - this.type = requireNonNull(type, "type is null"); } - @Override - public final void load(LazyBlock lazyBlock) - { + @Override public final void load(LazyBlock lazyBlock) { if (loaded) { return; } checkState(batchId == expectedBatchId); try { - Block block = readers[columnIndex].readBlock(type); + Block block = + ((PrestoVectorBlockBuilder) vectorReader.getColumnarBatch().column(columnIndex)) + .buildBlock(lazyBlock.getPositionCount()); --- End diff -- You should be setting the batch size only, no need for two fields
---