udf

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

udf [2015/09/23 20:27]
127.0.0.1 external edit
udf [2016/04/20 07:54] (current)
dmtolpeko
Line 1: Line 1:
-====== Hive UDF to Run PL/HQL Scripts from Hive CLI ======+====== Hive UDF to Run HPL/SQL Scripts from Hive CLI ======
  
-PL/HQL includes a Hive UDF function that allows you to execute ​PL/HQL scripts (user-defined functions written in PL/HQL language) in Hive queries.+HPL/SQL includes a Hive UDF function that allows you to execute ​HPL/SQL scripts (user-defined functions written in HPL/SQL language) in Hive queries.
  
 For example, let's call the following function from a Hive query: For example, let's call the following function from a Hive query:
Line 13: Line 13:
 </​code>​ </​code>​
  
-===== Running ​PL/HQL from Hive CLI =====+===== Running ​HPL/SQL from Hive CLI =====
  
-Put this script to //plhqlrc// file, then register ​PL/HQL UDF in Hive as follows (set your path for jars and configuration files):+Put this script to //hplsqlrc// file, then register ​HPL/SQL UDF in Hive as follows (set your path for jars and configuration files):
  
 <code language=sql>​ <code language=sql>​
-ADD JAR /home/pl/plhql.jar; +ADD JAR /home/pl/hplsql.jar; 
-ADD JAR /​home/​pl/​antlr-runtime-4.4.jar;+ADD JAR /​home/​pl/​antlr-runtime-4.5.jar;
  
-ADD FILE /home/pl/plhql-site.xml;​ +ADD FILE /home/pl/hplsql-site.xml;​ 
-ADD FILE /home/pl/plhqlrc;+ADD FILE /home/pl/hplsqlrc;
  
-CREATE TEMPORARY FUNCTION ​plhql AS 'org.plhql.Udf';+CREATE TEMPORARY FUNCTION ​hplsql ​AS 'org.apache.hive.hplsql.Udf';
 </​code>​ </​code>​
  
-Now let's use //hello// function written in PL/HQL language in Hive:+Now let's use //hello// function written in HPL/SQL language in Hive:
  
 <code language=sql>​ <code language=sql>​
-SELECT ​plhql('​hello(:​1)',​ name) FROM users;+SELECT ​hplsql('​hello(:​1)',​ name) FROM users;
 </​code>​ </​code>​
  
-===== Running ​PL/HQL from PL/HQL CLI =====+===== Running ​HPL/SQL from HPL/SQL CLI =====
  
-When you run PL/HQL scripts using PL/HQL CLI tool you can just use user-defined functions the same way as you use built-in functions:+When you run HPL/SQL scripts using HPL/SQL CLI tool you can just use user-defined functions the same way as you use built-in functions:
  
 <code language=sql>​ <code language=sql>​
Line 41: Line 41:
 </​code>​ </​code>​
  
-PL/HQL CLI tool automatically puts referenced ​PL/HQL user-defined functions and stored procedures to Distributed Cache, registers the Hive UDF and modifies the function call in the SQL statements. ​+HPL/SQL CLI tool automatically puts referenced ​HPL/SQL user-defined functions and stored procedures to Distributed Cache, registers the Hive UDF and modifies the function call in the SQL statements. ​
  
 For more information,​ see [[udf-sproc|User-Defined Functions and Stored Procedures]]. For more information,​ see [[udf-sproc|User-Defined Functions and Stored Procedures]].
  
-**Version**: ​PL/HQL 0.3.1+**Version**: ​HPL/SQL 0.3.1
  
 ~~NOTOC~~ ~~NOTOC~~