mercredi 4 mars 2015

How to access data from a HashMap that is a Text type?



I've encountered a minor issue:


I have A Method that add values to HashMap as follow:



Map<Text,Text> kv =new HashMap<Text,Text>();
kv.put(new Text(0),new Text(0));
kv.put(new Text(1),new Text(1));


PS: Text is a type from MapReduce framework.


When I try to access the data as follow from MapReduce job:



for (java.util.Map.Entry<Text, Text> entry : result.entrySet()) {
System.out.println( entry.getKey() + ","+ entry.getValue());
}


I was getting results as follow:



1,1
1,1


But When I tried the same thing in standard Java, I was getting the result as expected:



0,0
1,1


Is there any explanation to this?




Aucun commentaire:

Enregistrer un commentaire