public Tuple2 < Long , Long > getCurrentReadPosition ( ) { // compute number of returned records long numRecordsReturned = numReadRecords ; if ( ! readRecordReturned && numReadRecords > 0 ) { numRecordsReturned -= 1 ; } if ( numRecordsReturned == numTotalRecords ) { // all records of split returned. return Tuple2 . of ( - 1L , - 1L ) ; } if ( numRecordsReturned == numRecordsUpToCurrentBlock ) { // all records of block returned. Next record is in next block return Tuple2 . of ( currentBlock + 1L , 0L ) ; } // compute number of returned records of this block long numRecordsOfBlockReturned = numRecordsReturned - numRecordsUpToPreviousBlock ; return Tuple2 . of ( ( long ) currentBlock , numRecordsOfBlockReturned ) ; }
Returns the current read position in the split i . e . the current block and the number of records that were returned from that block .