Github user sv71294 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2412#discussion_r199068020
  
    --- Diff: 
integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataPageSource.java
 ---
    @@ -166,61 +146,32 @@ 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);
    +        PrestoVectorBlockBuilder blockBuilder =
    +            (PrestoVectorBlockBuilder) 
vectorReader.getColumnarBatch().column(columnIndex);
    +        blockBuilder.setBatchSize(lazyBlock.getPositionCount());
    +        Block block = blockBuilder.buildBlock();
             sizeOfData += block.getSizeInBytes();
             lazyBlock.setBlock(block);
    -      }
    -      catch (IOException e) {
    +      } catch (Exception e) {
             throw new CarbonDataLoadingException("Error in Reading Data from 
Carbondata ", e);
           }
           loaded = true;
         }
    -
       }
     
    -
    -  /**
    -   * Create the Stream Reader for every column based on their type
    -   * This method will be initialized only once based on the types.
    -   *
    -   * @return
    -   */
    -  private StreamReader[] createStreamReaders( ) {
    --- End diff --
    
    removed from this class moved to CarbonVectorBatch


---

Reply via email to