|
|
-
hadoop.io.DoubleWritable v/s hive.serde2.io.DoubleWritable
richin.jain@... 2012-06-12, 20:56
Hi Guys,
I am writing a UDF in hive to convert a double value to string, so the evaluate method of my UDF class looks like
import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.io.Text; //import org.apache.hadoop.io.DoubleWritable; - does not work import org.apache.hadoop.hive.serde2.io.DoubleWritable;
public Text evaluate(DoubleWritable d){
}
When I looked at different UDF examples the Hadoop Writables seem to work fine in case of Text and IntWritable but for DoubleWritable I was getting an error. I figured out looking at couple of examples online that I should use the DoubleWritable from hive.serde2 package instead of hadoop.io package.
Can someone please explain why this special case for DoubleWritable?
Thanks, Richin
-
Re: hadoop.io.DoubleWritable v/s hive.serde2.io.DoubleWritable
Edward Capriolo 2012-06-12, 21:11
If you use Double or double hive will automatically convert. I would always recommend the hive.serde types.
Edward
On Tue, Jun 12, 2012 at 4:56 PM, <[EMAIL PROTECTED]> wrote: > Hi Guys, > > > > I am writing a UDF in hive to convert a double value to string, so the > evaluate method of my UDF class looks like > > > > import org.apache.hadoop.hive.ql.exec.UDF; > > import org.apache.hadoop.io.Text; > > //import org.apache.hadoop.io.DoubleWritable; - does not work > > import org.apache.hadoop.hive.serde2.io.DoubleWritable; > > > > public Text evaluate(DoubleWritable d){ > > > > } > > > > When I looked at different UDF examples the Hadoop Writables seem to work > fine in case of Text and IntWritable but for DoubleWritable I was getting an > error. I figured out looking at couple of examples online that I should use > the DoubleWritable from hive.serde2 package instead of hadoop.io package. > > > > Can someone please explain why this special case for DoubleWritable? > > > > Thanks, > > Richin
-
RE: hadoop.io.DoubleWritable v/s hive.serde2.io.DoubleWritable
richin.jain@... 2012-06-12, 21:20
Hi Edward,
Sorry, If I was not clear. My question is around difference between DoubleWritable in hadoop and hive, other writables from hadoop works fine in hive. Hive.serde types are limited to Double, Byte, Short and Timestamp.
I am using hive 0.8
Richin
-----Original Message----- From: ext Edward Capriolo [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 12, 2012 5:12 PM To: [EMAIL PROTECTED] Subject: Re: hadoop.io.DoubleWritable v/s hive.serde2.io.DoubleWritable
If you use Double or double hive will automatically convert. I would always recommend the hive.serde types.
Edward
On Tue, Jun 12, 2012 at 4:56 PM, <[EMAIL PROTECTED]> wrote: > Hi Guys, > > > > I am writing a UDF in hive to convert a double value to string, so the > evaluate method of my UDF class looks like > > > > import org.apache.hadoop.hive.ql.exec.UDF; > > import org.apache.hadoop.io.Text; > > //import org.apache.hadoop.io.DoubleWritable; - does not work > > import org.apache.hadoop.hive.serde2.io.DoubleWritable; > > > > public Text evaluate(DoubleWritable d){ > > > > } > > > > When I looked at different UDF examples the Hadoop Writables seem to > work fine in case of Text and IntWritable but for DoubleWritable I was > getting an error. I figured out looking at couple of examples online > that I should use the DoubleWritable from hive.serde2 package instead of hadoop.io package. > > > > Can someone please explain why this special case for DoubleWritable? > > > > Thanks, > > Richin
-
Re: hadoop.io.DoubleWritable v/s hive.serde2.io.DoubleWritable
Edward Capriolo 2012-06-12, 21:26
Hive likely wishes to format the data differently then Hadoop does. Hive re-uses what it can. I would diff the two .java files and find out for yourself :) On Tue, Jun 12, 2012 at 5:20 PM, <[EMAIL PROTECTED]> wrote: > Hi Edward, > > Sorry, If I was not clear. My question is around difference between DoubleWritable in hadoop and hive, other writables from hadoop works fine in hive. > Hive.serde types are limited to Double, Byte, Short and Timestamp. > > I am using hive 0.8 > > Richin > > -----Original Message----- > From: ext Edward Capriolo [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 12, 2012 5:12 PM > To: [EMAIL PROTECTED] > Subject: Re: hadoop.io.DoubleWritable v/s hive.serde2.io.DoubleWritable > > If you use Double or double hive will automatically convert. I would always recommend the hive.serde types. > > Edward > > On Tue, Jun 12, 2012 at 4:56 PM, <[EMAIL PROTECTED]> wrote: >> Hi Guys, >> >> >> >> I am writing a UDF in hive to convert a double value to string, so the >> evaluate method of my UDF class looks like >> >> >> >> import org.apache.hadoop.hive.ql.exec.UDF; >> >> import org.apache.hadoop.io.Text; >> >> //import org.apache.hadoop.io.DoubleWritable; - does not work >> >> import org.apache.hadoop.hive.serde2.io.DoubleWritable; >> >> >> >> public Text evaluate(DoubleWritable d){ >> >> >> >> } >> >> >> >> When I looked at different UDF examples the Hadoop Writables seem to >> work fine in case of Text and IntWritable but for DoubleWritable I was >> getting an error. I figured out looking at couple of examples online >> that I should use the DoubleWritable from hive.serde2 package instead of hadoop.io package. >> >> >> >> Can someone please explain why this special case for DoubleWritable? >> >> >> >> Thanks, >> >> Richin
|
|