Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

HPL-SQL : Function creation issues in Hive 2.0

Solved Go to solution

Re: HPL-SQL : Function creation issues in Hive 2.0

New Contributor

Thank you Chuck.It worked for me.Would also share a sample function which joins two tables and returns a value ?

[We are able to return a value when using single table in the function .When doing a join between two tables and returning a value it is failing like the above syntax]

Re: HPL-SQL : Function creation issues in Hive 2.0

New Contributor

Hi @bpreachuk /All , We were able to find the issue.Changing the return type to record will work.Special thanks to Chuk.

CREATE FUNCTION my_functionn() RETURNS RECORD 
BEGIN 
DROP TABLE default.dg_join3 ;
CREATE TABLE default.dg_join3(name string, phone string) ;
INSERT INTO TABLE default.dg_join3 SELECT a.name, b.phone from default.dg_1 a,default.dg_2 b
where a.id = b.id ;SELECT * FROM default.dg_join3 ;
END;
PRINT my_functionn();
Highlighted

Re: HPL-SQL : Function creation issues in Hive 2.0

Contributor

I am facing some issues in HPLSQL.I am using Hive 1.2 version Can you please help me out.

1. TRIM in plsql supports trimming of a pattern from a string.. but TRIM in hplsql removes only spaces but doesnt support removing a pattern.

2. UDFs created on hive on cannot be used in a hplsql script as its antl4 parser doesnt have it in its lexicon

Don't have an account?
Coming from Hortonworks? Activate your account here