@Override
    public boolean next(LongWritable k, MapWritable v) throws IOException {
        boolean ret = iter.hasNext();
        if (ret) {
            current = iter.next();
            k.set(cnt);
            v.clear(); 
            List<String> majorKeysList = current.getKey().getMajorPath();
            List<String> minorKeysList = current.getKey().getMinorPath();
            for (int i=0; i<majorKeyLabelsArray.length; i++) {
                try {
                    String key = majorKeyLabelsArray[i];
                    String value = majorKeysList.get(i);
                    if (!value.equals(SERIALIZED_NULL)) {
                        v.put(new Text(key), new Text(value));
                    }
                } catch (ArrayIndexOutOfBoundsException e) {
                }
            }
            byte[] value = current.getValue().getValue();
            if (!value.toString().equals(SERIALIZED_NULL)) {
                if (minorKeysList.isEmpty()) {
                    v.put(new Text("value"), new Text(value));
                } else {
                    for (int j=0; j<minorKeysList.size(); j++) {
                        String key = minorKeysList.get(j);
                        v.put(new Text(key), new Text(value));
                    }
                }
            }
            cnt++;
            return ret;
        } else {
            return false;
        }  
    }