private boolean readNextRecord ( ) throws IOException { boolean recordFound = false ; while ( ! recordFound ) { // no more records left if ( numReadRecords >= numTotalRecords ) { return false ; } try { if ( numReadRecords == numRecordsUpToCurrentBlock ) { // advance to next block PageReadStore pages = reader . readNextRowGroup ( ) ; recordReader = createRecordReader ( pages ) ; numRecordsUpToPreviousBlock = numRecordsUpToCurrentBlock ; numRecordsUpToCurrentBlock += pages . getRowCount ( ) ; currentBlock ++ ; } numReadRecords ++ ; try { readRecord = recordReader . read ( ) ; readRecordReturned = false ; } catch ( RecordMaterializationException e ) { String errorMessage = String . format ( "skipping a corrupt record in block number [%d] record number [%s] of file %s" , currentBlock , numReadRecords - numRecordsUpToPreviousBlock , reader . getFile ( ) ) ; if ( ! skipCorruptedRecord ) { LOG . error ( errorMessage ) ; throw e ; } else { LOG . warn ( errorMessage ) ; } continue ; } if ( readRecord == null ) { readRecordReturned = true ; numReadRecords = numRecordsUpToCurrentBlock ; LOG . debug ( "filtered record reader reached end of block" ) ; continue ; } recordFound = true ; LOG . debug ( "read value: {}" , readRecord ) ; } catch ( RecordMaterializationException e ) { LOG . error ( String . format ( "Can not read value at %d in block %d in file %s" , numReadRecords - numRecordsUpToPreviousBlock , currentBlock , reader . getFile ( ) ) , e ) ; if ( ! skipCorruptedRecord ) { throw e ; } return false ; } } return true ; }
Reads the next record .