Re: Better way to do UDF's for Hive

2015-10-01 Thread Edward Capriolo
[mailto:dan...@bankfacil.com.br] > *Sent:* Thursday, October 01, 2015 7:12 AM > *To:* user@hive.apache.org > *Subject:* Better way to do UDF's for Hive > > > > Hi, > > > > I'd like to know the good way to do a a UDF for a single field, like > >

RE: Better way to do UDF's for Hive

2015-10-01 Thread Ryan Harris
tate) FROM my_db.my_table ; From: Daniel Lopes [mailto:dan...@bankfacil.com.br] Sent: Thursday, October 01, 2015 7:12 AM To: user@hive.apache.org Subject: Better way to do UDF's for Hive Hi, I'd like to know the good way to do a a UDF for a single field, like SELECT tbl.id<http://tbl.id&

Re: Better way to do UDF's for Hive

2015-10-01 Thread Dmitry Tolpeko
In case of single string input Java UDF can be easier to write: accept string parameter, lookup hash map and return. In case of Python you have to use TRANSFORM clause and handle all columns, so it will be hard to reuse your Python script as the code may depend on the column position. One other po

Re: Better way to do UDF's for Hive

2015-10-01 Thread Elliot West
Perhaps a macro? CREATE TEMPORARY MACRO state_from_city (city string) " + /* HQL column logic */ ...; On 1 October 2015 at 14:11, Daniel Lopes wrote: > Hi, > > I'd like to know the good way to do a a UDF for a single field, like > > SELECT > tbl.id AS id, > tbl.name AS name, > tbl.city A

Better way to do UDF's for Hive

2015-10-01 Thread Daniel Lopes
Hi, I'd like to know the good way to do a a UDF for a single field, like SELECT tbl.id AS id, tbl.name AS name, tbl.city AS city, state_from_city(tbl.city) AS state FROM my_db.my_table tbl; *Native Java*? *Python *over *Hadoop* *Streaming*? I prefer Python, but I don't know how to do