You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Buntu Dev <bu...@gmail.com> on 2015/03/03 23:43:46 UTC

Create custom UDF

I couldn't find any official documentation on how to create a UDF and mvn
dependencies for building the project except for this page:

 https://cwiki.apache.org/confluence/display/Hive/HivePlugins

Can anyone help me with whats needed to construct the pom?


Thanks!

Re: Create custom UDF

Posted by Buntu Dev <bu...@gmail.com>.
Is there a pivot/transform function available? I need to pivot the rows to
columns without the knowledge of the values.

~~~~~~~~~~~~
Source table:

date | page | count
20150301 | p1 | 10
20150301 | p2 | 20
...


Result table that I would like without the knowledge of the distinct values
for 'page' column:

date | p1_count | p2_count | ....so on
20150301 | 10 | 20 | ...

~~~~~~~~~~~~~

Thanks!





On Thu, Mar 5, 2015 at 12:17 PM, Alexander Pivovarov <ap...@gmail.com>
wrote:

> Several useful common udf methods we added to GenericUDF recently
> https://issues.apache.org/jira/browse/HIVE-9744
>
>
> you can look at the following UDFs as an example:
>
> https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLevenshtein.java
>
>
> https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFAddMonths.java
>
>
> https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFInitCap.java
>
>
> On Tue, Mar 3, 2015 at 2:43 PM, Buntu Dev <bu...@gmail.com> wrote:
>
>> I couldn't find any official documentation on how to create a UDF and mvn
>> dependencies for building the project except for this page:
>>
>>  https://cwiki.apache.org/confluence/display/Hive/HivePlugins
>>
>> Can anyone help me with whats needed to construct the pom?
>>
>>
>> Thanks!
>>
>
>

Re: Create custom UDF

Posted by Buntu Dev <bu...@gmail.com>.
Thanks for the info!

On Thu, Mar 5, 2015 at 12:17 PM, Alexander Pivovarov <ap...@gmail.com>
wrote:

> Several useful common udf methods we added to GenericUDF recently
> https://issues.apache.org/jira/browse/HIVE-9744
>
>
> you can look at the following UDFs as an example:
>
> https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLevenshtein.java
>
>
> https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFAddMonths.java
>
>
> https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFInitCap.java
>
>
> On Tue, Mar 3, 2015 at 2:43 PM, Buntu Dev <bu...@gmail.com> wrote:
>
>> I couldn't find any official documentation on how to create a UDF and mvn
>> dependencies for building the project except for this page:
>>
>>  https://cwiki.apache.org/confluence/display/Hive/HivePlugins
>>
>> Can anyone help me with whats needed to construct the pom?
>>
>>
>> Thanks!
>>
>
>

Re: Create custom UDF

Posted by Alexander Pivovarov <ap...@gmail.com>.
Several useful common udf methods we added to GenericUDF recently
https://issues.apache.org/jira/browse/HIVE-9744


you can look at the following UDFs as an example:
https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLevenshtein.java

https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFAddMonths.java

https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFInitCap.java


On Tue, Mar 3, 2015 at 2:43 PM, Buntu Dev <bu...@gmail.com> wrote:

> I couldn't find any official documentation on how to create a UDF and mvn
> dependencies for building the project except for this page:
>
>  https://cwiki.apache.org/confluence/display/Hive/HivePlugins
>
> Can anyone help me with whats needed to construct the pom?
>
>
> Thanks!
>

Re: Create custom UDF

Posted by Buntu Dev <bu...@gmail.com>.
Thanks Pradeep.

On Tue, Mar 3, 2015 at 2:53 PM, Pradeep Gollakota <pr...@gmail.com>
wrote:

> This is what I use:
>
> <dependency>
>     <groupId>org.apache.hive</groupId>
>     <artifactId>hive-exec</artifactId>
>     <version>0.12.0</version>
>     <scope>provided</scope>
> </dependency>
>
> I don't believe anything else is needed.
>
> On Tue, Mar 3, 2015 at 2:43 PM, Buntu Dev <bu...@gmail.com> wrote:
>
>> I couldn't find any official documentation on how to create a UDF and mvn
>> dependencies for building the project except for this page:
>>
>>  https://cwiki.apache.org/confluence/display/Hive/HivePlugins
>>
>> Can anyone help me with whats needed to construct the pom?
>>
>>
>> Thanks!
>>
>
>

Re: Create custom UDF

Posted by Pradeep Gollakota <pr...@gmail.com>.
This is what I use:

<dependency>
    <groupId>org.apache.hive</groupId>
    <artifactId>hive-exec</artifactId>
    <version>0.12.0</version>
    <scope>provided</scope>
</dependency>

I don't believe anything else is needed.

On Tue, Mar 3, 2015 at 2:43 PM, Buntu Dev <bu...@gmail.com> wrote:

> I couldn't find any official documentation on how to create a UDF and mvn
> dependencies for building the project except for this page:
>
>  https://cwiki.apache.org/confluence/display/Hive/HivePlugins
>
> Can anyone help me with whats needed to construct the pom?
>
>
> Thanks!
>