Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> hadoop.io.DoubleWritable v/s hive.serde2.io.DoubleWritable


Copy link to this message
-
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