You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by jamal sasha <ja...@gmail.com> on 2013/07/30 04:26:45 UTC
objects as key/values
Ok.
A very basic (stupid) question.
I am trying to compute mean using hadoop.
So my implementation is like this:
public class Mean
public static class Pair{
//simple class to create object
}
public class MeanMapper<LongWritable, Text,Text, Pair>
emit(text,pair) //where pair is (local sum, count)
public class MeanReducer<Text, Pair, Text DoubleWritable>
emit (text, mean)
Unfortunately such approach of creating custom class types are not working
since in job I have to set the output type for mapper/reducer...
How are custom key values pair implemented in hadoop?
RE: objects as key/values
Posted by Devaraj k <de...@huawei.com>.
You can write custom key/value classes by implementing org.apache.hadoop.io.Writable interface for your Job.
http://hadoop.apache.org/docs/current/api/org/apache/hadoop/io/Writable.html
Thanks
Devaraj k
From: jamal sasha [mailto:jamalshasha@gmail.com]
Sent: 30 July 2013 10:27
To: user@hadoop.apache.org
Subject: objects as key/values
Ok.
A very basic (stupid) question.
I am trying to compute mean using hadoop.
So my implementation is like this:
public class Mean
public static class Pair{
//simple class to create object
}
public class MeanMapper<LongWritable, Text,Text, Pair>
emit(text,pair) //where pair is (local sum, count)
public class MeanReducer<Text, Pair, Text DoubleWritable>
emit (text, mean)
Unfortunately such approach of creating custom class types are not working
since in job I have to set the output type for mapper/reducer...
How are custom key values pair implemented in hadoop?
RE: objects as key/values
Posted by Devaraj k <de...@huawei.com>.
You can write custom key/value classes by implementing org.apache.hadoop.io.Writable interface for your Job.
http://hadoop.apache.org/docs/current/api/org/apache/hadoop/io/Writable.html
Thanks
Devaraj k
From: jamal sasha [mailto:jamalshasha@gmail.com]
Sent: 30 July 2013 10:27
To: user@hadoop.apache.org
Subject: objects as key/values
Ok.
A very basic (stupid) question.
I am trying to compute mean using hadoop.
So my implementation is like this:
public class Mean
public static class Pair{
//simple class to create object
}
public class MeanMapper<LongWritable, Text,Text, Pair>
emit(text,pair) //where pair is (local sum, count)
public class MeanReducer<Text, Pair, Text DoubleWritable>
emit (text, mean)
Unfortunately such approach of creating custom class types are not working
since in job I have to set the output type for mapper/reducer...
How are custom key values pair implemented in hadoop?
RE: objects as key/values
Posted by Devaraj k <de...@huawei.com>.
You can write custom key/value classes by implementing org.apache.hadoop.io.Writable interface for your Job.
http://hadoop.apache.org/docs/current/api/org/apache/hadoop/io/Writable.html
Thanks
Devaraj k
From: jamal sasha [mailto:jamalshasha@gmail.com]
Sent: 30 July 2013 10:27
To: user@hadoop.apache.org
Subject: objects as key/values
Ok.
A very basic (stupid) question.
I am trying to compute mean using hadoop.
So my implementation is like this:
public class Mean
public static class Pair{
//simple class to create object
}
public class MeanMapper<LongWritable, Text,Text, Pair>
emit(text,pair) //where pair is (local sum, count)
public class MeanReducer<Text, Pair, Text DoubleWritable>
emit (text, mean)
Unfortunately such approach of creating custom class types are not working
since in job I have to set the output type for mapper/reducer...
How are custom key values pair implemented in hadoop?
RE: objects as key/values
Posted by Devaraj k <de...@huawei.com>.
You can write custom key/value classes by implementing org.apache.hadoop.io.Writable interface for your Job.
http://hadoop.apache.org/docs/current/api/org/apache/hadoop/io/Writable.html
Thanks
Devaraj k
From: jamal sasha [mailto:jamalshasha@gmail.com]
Sent: 30 July 2013 10:27
To: user@hadoop.apache.org
Subject: objects as key/values
Ok.
A very basic (stupid) question.
I am trying to compute mean using hadoop.
So my implementation is like this:
public class Mean
public static class Pair{
//simple class to create object
}
public class MeanMapper<LongWritable, Text,Text, Pair>
emit(text,pair) //where pair is (local sum, count)
public class MeanReducer<Text, Pair, Text DoubleWritable>
emit (text, mean)
Unfortunately such approach of creating custom class types are not working
since in job I have to set the output type for mapper/reducer...
How are custom key values pair implemented in hadoop?