@Override
        public boolean hasNext() {
            if (numRecords == 0) {
                if (reader != null) {
                    // remove the spill file from disk
                    try {
                        spillWriters.removeFirst().removeFile();
                    } catch (IOException e) {
                        logger.error("", e);
                    }
                }
            }
            return numRecords > 0;
        }
Returns the number of keys defined in the map.
indexr-query-opt/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java