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

    https://github.com/apache/drill/pull/749#discussion_r102830312
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLenBinaryReader.java
 ---
    @@ -33,35 +33,52 @@
       ParquetRecordReader parentReader;
       final List<VarLengthColumn<? extends ValueVector>> columns;
       final boolean useAsyncTasks;
    +  private final long targetRecordCount;
     
       public VarLenBinaryReader(ParquetRecordReader parentReader, 
List<VarLengthColumn<? extends ValueVector>> columns) {
         this.parentReader = parentReader;
         this.columns = columns;
         useAsyncTasks = parentReader.useAsyncColReader;
    +
    +    // Can't read any more records than fixed width fields will fit.
    +    // Note: this calculation is very likely wrong; it is a simplified
    +    // version of earlier code, but probably needs even more attention.
    +
    +    int totalFixedFieldWidth = parentReader.getBitWidthAllFixedFields() / 
8;
    +    if (totalFixedFieldWidth == 0) {
    +      targetRecordCount = 0;
    +    } else {
    +      targetRecordCount = parentReader.getBatchSize() / 
totalFixedFieldWidth;
    +    }
       }
     
       /**
        * Reads as many variable length values as possible.
        *
        * @param recordsToReadInThisPass - the number of records recommended 
for reading form the reader
    -   * @param firstColumnStatus - a reference to the first column status in 
the parquet file to grab metatdata from
    +   * @param firstColumnStatus - a reference to the first column status in 
the Parquet file to grab metatdata from
        * @return - the number of fixed length fields that will fit in the batch
        * @throws IOException
        */
       public long readFields(long recordsToReadInThisPass, ColumnReader<?> 
firstColumnStatus) throws IOException {
     
    -    long recordsReadInCurrentPass = 0;
    -
         // write the first 0 offset
         for (VarLengthColumn<?> columnReader : columns) {
           columnReader.reset();
         }
         Stopwatch timer = Stopwatch.createStarted();
     
    -    recordsReadInCurrentPass = 
determineSizesSerial(recordsToReadInThisPass);
    -    if(useAsyncTasks){
    +    long recordsReadInCurrentPass = 
determineSizesSerial(recordsToReadInThisPass);
    +
    +    // Can't read any more records than fixed width fields will fit.
    +
    +    if (targetRecordCount > 0) {
    +      recordsToReadInThisPass = Math.min(recordsToReadInThisPass, 
targetRecordCount);
    --- End diff --
    
    I think you mean to update recordsReadInCurrentPass. 
recordsToReadInThisPass is not being used after this. So, what is the point in 
updating ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to