private boolean ensureBatch ( ) throws IOException { if ( nextRow >= rowsInBatch ) { // No more rows available in the Rows array. nextRow = 0 ; // Try to read the next batch if rows from the ORC file. boolean moreRows = orcRowsReader . nextBatch ( rowBatch ) ; if ( moreRows ) { // Load the data into the Rows array. rowsInBatch = fillRows ( rows , schema , rowBatch , selectedFields ) ; } return moreRows ; } // there is at least one Row left in the Rows array. return true ; }
Checks if there is at least one row left in the batch to return . If no more row are available it reads another batch of rows .