You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2009/09/02 22:42:54 UTC

svn commit: r810696 - in /hadoop/hive/trunk: CHANGES.txt contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/GenericUDFDBOutput.java contrib/src/test/queries/clientpositive/dboutput.q contrib/src/test/results/clientpositive/dboutput.q.out

Author: namit
Date: Wed Sep  2 20:42:54 2009
New Revision: 810696

URL: http://svn.apache.org/viewvc?rev=810696&view=rev
Log:
HIVE-810. add test and annotation for jdbc udf (Edward Capriolo via namit)


Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/GenericUDFDBOutput.java
    hadoop/hive/trunk/contrib/src/test/queries/clientpositive/dboutput.q
    hadoop/hive/trunk/contrib/src/test/results/clientpositive/dboutput.q.out

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=810696&r1=810695&r2=810696&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Wed Sep  2 20:42:54 2009
@@ -84,6 +84,8 @@
 
     HIVE-752. Bug in shimLoader for HWI server (Edward Capriolo via namit)
 
+    HIVE-810. add test and annotation for jdbc udf (Edward Capriolo via namit)
+
 Release 0.4.0 -  Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/GenericUDFDBOutput.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/GenericUDFDBOutput.java?rev=810696&r1=810695&r2=810696&view=diff
==============================================================================
--- hadoop/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/GenericUDFDBOutput.java (original)
+++ hadoop/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/GenericUDFDBOutput.java Wed Sep  2 20:42:54 2009
@@ -21,6 +21,9 @@
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import org.apache.hadoop.hive.ql.udf.UDFType;
+import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 
 import org.apache.hadoop.hive.ql.udf.generic.*;
 import org.apache.commons.logging.Log;
@@ -48,6 +51,17 @@
 * Use hive's ADD JAR feature to add your JDBC Driver to the distributed cache,
 * otherwise GenericUDFDBoutput will fail.
 */
+@description(
+    name = "dboutput",
+    value = "_FUNC_(jdbcstring,username,password,preparedstatement,[arguments]) - sends data to a jdbc driver",
+    extended = 
+    "argument 0 is the JDBC connection string\n"+
+    "argument 1 is the user name\n"+
+    "argument 2 is the password\n"+
+    "argument 3 is an SQL query to be used in the PreparedStatement\n"+
+    "argument (4-n) The remaining arguments must be primitive and are passed to the PreparedStatement object\n"
+)
+@UDFType(deterministic=false)
 public class GenericUDFDBOutput extends GenericUDF {
   private static Log LOG = LogFactory.getLog(GenericUDFDBOutput.class.getName());
 

Modified: hadoop/hive/trunk/contrib/src/test/queries/clientpositive/dboutput.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/contrib/src/test/queries/clientpositive/dboutput.q?rev=810696&r1=810695&r2=810696&view=diff
==============================================================================
--- hadoop/hive/trunk/contrib/src/test/queries/clientpositive/dboutput.q (original)
+++ hadoop/hive/trunk/contrib/src/test/queries/clientpositive/dboutput.q Wed Sep  2 20:42:54 2009
@@ -9,6 +9,10 @@
 
 ADD JAR ../lib/derby.jar ;
 
+DESCRIBE FUNCTION dboutput;
+
+DESCRIBE FUNCTION EXTENDED dboutput;
+
 EXPLAIN FROM src
 
 SELECT dboutput ( 'jdbc:derby:../build/test_dboutput_db\;create=true','','',

Modified: hadoop/hive/trunk/contrib/src/test/results/clientpositive/dboutput.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/contrib/src/test/results/clientpositive/dboutput.q.out?rev=810696&r1=810695&r2=810696&view=diff
==============================================================================
--- hadoop/hive/trunk/contrib/src/test/results/clientpositive/dboutput.q.out (original)
+++ hadoop/hive/trunk/contrib/src/test/results/clientpositive/dboutput.q.out Wed Sep  2 20:42:54 2009
@@ -1,4 +1,14 @@
 query: CREATE TEMPORARY FUNCTION dboutput AS 'org.apache.hadoop.hive.contrib.genericudf.example.GenericUDFDBOutput'
+query: DESCRIBE FUNCTION dboutput
+dboutput(jdbcstring,username,password,preparedstatement,[arguments]) - sends data to a jdbc driver
+query: DESCRIBE FUNCTION EXTENDED dboutput
+dboutput(jdbcstring,username,password,preparedstatement,[arguments]) - sends data to a jdbc driver
+argument 0 is the JDBC connection string
+argument 1 is the user name
+argument 2 is the password
+argument 3 is an SQL query to be used in the PreparedStatement
+argument (4-n) The remaining arguments must be primitive and are passed to the PreparedStatement object
+
 query: EXPLAIN FROM src
 
 SELECT dboutput ( 'jdbc:derby:../build/test_dboutput_db;create=true','','',
@@ -60,7 +70,7 @@
 
 limit 1
 Input: default/src
-Output: file:/home/ecapriolo/hive-20/hive-trunk/build/ql/tmp/546437302/10000
+Output: file:/home/ecapriolo/hive-617/hive-trunk/build/ql/tmp/753506919/10000
 0	0	1
 query: EXPLAIN SELECT
 
@@ -114,7 +124,7 @@
 
 FROM src WHERE key < 10
 Input: default/src
-Output: file:/home/ecapriolo/hive-20/hive-trunk/build/ql/tmp/1720943059/10000
+Output: file:/home/ecapriolo/hive-617/hive-trunk/build/ql/tmp/1030277391/10000
 0
 0
 0
@@ -125,6 +135,6 @@
 0
 1
 0
-Deleted file:/home/ecapriolo/hive-20/hive-trunk/build/test_dboutput_db
-Deleted file:/home/ecapriolo/hive-20/hive-trunk/contrib/derby.log
+Deleted file:/home/ecapriolo/hive-617/hive-trunk/build/test_dboutput_db
+Deleted file:/home/ecapriolo/hive-617/hive-trunk/contrib/derby.log
 query: DROP TEMPORARY FUNCTION dboutput