hadoop-hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r802066 [2/2] - in /hadoop/hive/trunk: ./ ql/src/java/org/apache/hadoop/hive/ql/exec/ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/java/org/apache/hadoop/hive/ql/plan/ ql/src/java/org/apache/hadoop/hive/ql/udf/ ql/src/java/org/apache...
Date Fri, 07 Aug 2009 16:17:04 GMT
Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFPower.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFPower.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFPower.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFPower.java Fri Aug  7 16:17:01
2009
@@ -21,9 +21,16 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 
-
+@description(
+    name = "power,pow",
+    value = "_FUNC_(x1, x2) - raise x1 to the power of x2",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_(2, 3) FROM src LIMIT 1;\n" +
+        "  8"
+    )
 public class UDFPower extends UDF {
 
   private static Log LOG = LogFactory.getLog(UDFPower.class.getName());

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRTrim.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRTrim.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRTrim.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRTrim.java Fri Aug  7 16:17:01
2009
@@ -19,12 +19,20 @@
 package org.apache.hadoop.hive.ql.udf;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.Text;
 import org.apache.commons.lang.StringUtils;
 
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
+@description(
+    name = "rtrim",
+    value = "_FUNC_(str) - Removes the trailing space characters from str ",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('facebook   ') FROM src LIMIT 1;\n" +
+        "  'facebook'"
+    )
 public class UDFRTrim extends UDF {
 
   Text result = new Text();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRand.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRand.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRand.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRand.java Fri Aug  7 16:17:01
2009
@@ -23,9 +23,14 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 import org.apache.hadoop.io.LongWritable;
 
+@description(
+    name = "rand",
+    value = "_FUNC_([seed]) - Returns a pseudorandom number between 0 and 1"
+)
 @UDFType(deterministic=false)
 public class UDFRand extends UDF {
 

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExp.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExp.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExp.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExp.java Fri Aug  7
16:17:01 2009
@@ -19,12 +19,21 @@
 package org.apache.hadoop.hive.ql.udf;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.BooleanWritable;
 import org.apache.hadoop.io.Text;
 
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
+@description(
+    name = "rlike,regexp",
+    value = "str _FUNC_ regexp - Returns true if str matches regexp and " +
+    		"false otherwise",
+    extended = "Example:\n" +
+        "  > SELECT 'fb' _FUNC_ '.*' FROM src LIMIT 1;\n" +
+        "  true"
+    )
 public class UDFRegExp extends UDF {
 
   private Text lastRegex = new Text();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExpExtract.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExpExtract.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExpExtract.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExpExtract.java Fri
Aug  7 16:17:01 2009
@@ -25,12 +25,20 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 
 /**
  * UDF to extract a specific group identified by a java regex.
  * Note that if a regexp has a backslash ('\'), then need to specify '\\'
  * For example, regexp_extract('100-200', '(\\d+)-(\\d+)', 1) will return '100'
  */
+@description(
+    name = "regexp_extract",
+    value = "_FUNC_(str, regexp[, idx]) - extracts a group that matches regexp",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('100-200', '(\\d+)-(\\d+)', 1) FROM src LIMIT 1;\n" +
+        "  '100'"
+    )
 public class UDFRegExpExtract extends UDF {
   private static Log LOG = LogFactory.getLog(UDFRegExpExtract.class.getName());
 

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExpReplace.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExpReplace.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExpReplace.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRegExpReplace.java Fri
Aug  7 16:17:01 2009
@@ -19,11 +19,20 @@
 package org.apache.hadoop.hive.ql.udf;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.Text;
 
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
+@description(
+    name = "regexp_replace",
+    value = "_FUNC_(str, regexp, rep) - replace all substrings of str that " +
+    		"match regexp with rep",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('100-200', '(\\d+)', 'num') FROM src LIMIT 1;\n" +
+        "  'num-num'"
+    )
 public class UDFRegExpReplace extends UDF {
 
   private Text lastRegex = new Text();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRepeat.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRepeat.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRepeat.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRepeat.java Fri Aug  7
16:17:01 2009
@@ -21,9 +21,17 @@
 import java.util.Arrays;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
 
+@description(
+    name = "repeat",
+    value = "_FUNC_(str, n) - repeat str n times ",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('123', 2) FROM src LIMIT 1;\n" +
+        "  '123123'"
+    )
 public class UDFRepeat extends UDF { 
   private Text result = new Text();
   

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFReverse.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFReverse.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFReverse.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFReverse.java Fri Aug  7
16:17:01 2009
@@ -19,9 +19,17 @@
 package org.apache.hadoop.hive.ql.udf;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDFUtils;
 import org.apache.hadoop.io.Text;
 
+@description(
+    name = "reverse",
+    value = "_FUNC_(str) - reverse str",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('Facebook') FROM src LIMIT 1;\n" +
+        "  'koobecaF'"
+    )
 public class UDFReverse extends UDF { 
   private Text result = new Text();
   

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRound.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRound.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRound.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRound.java Fri Aug  7 16:17:01
2009
@@ -22,11 +22,18 @@
 import java.math.RoundingMode;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.LongWritable;
 
-
+@description(
+    name = "round",
+    value = "_FUNC_(x[, d]) - round x to d decimal places",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_(12.3456, 1) FROM src LIMIT 1;\n" +
+        "  12.3'"
+    )
 public class UDFRound extends UDF {
 
   DoubleWritable doubleWritable = new DoubleWritable();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRpad.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRpad.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRpad.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFRpad.java Fri Aug  7 16:17:01
2009
@@ -19,9 +19,23 @@
 package org.apache.hadoop.hive.ql.udf;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
 
+
+@description(
+    name = "rpad",
+    value = "_FUNC_(str, len, pad) - Returns str, right-padded with pad to a " +
+        "length of len",
+    extended = "If str is longer than len, the return value is shortened to " +
+        "len characters.\n" +
+        "Example:\n" +
+        "  > SELECT _FUNC_('hi', 5, '??') FROM src LIMIT 1;\n" +
+        "  'hi???'" +
+        "  > SELECT _FUNC_('hi', 1, '??') FROM src LIMIT 1;\n" +
+        "  'h'"
+    )
 public class UDFRpad extends UDF { 
   
   private Text result = new Text();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSin.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSin.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSin.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSin.java Fri Aug  7 16:17:01
2009
@@ -21,9 +21,16 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 
-
+@description(
+    name = "sin",
+    value = "_FUNC_(x) - returns the sine of x (x is in radians)",
+    extended = "Example:\n " +
+        "  > SELECT _FUNC_(0) FROM src LIMIT 1;\n" +
+        "  0"
+    )
 public class UDFSin extends UDF {
 
   private static Log LOG = LogFactory.getLog(UDFSin.class.getName());

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSpace.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSpace.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSpace.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSpace.java Fri Aug  7 16:17:01
2009
@@ -21,9 +21,18 @@
 import java.util.Arrays;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
 
+
+@description(
+    name = "space",
+    value = "_FUNC_(n) - returns n spaces",
+    extended = "Example:\n " +
+        "  > SELECT _FUNC_(2) FROM src LIMIT 1;\n" +
+        "  '  '"
+    )
 public class UDFSpace extends UDF { 
   private Text result = new Text();
   

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSqrt.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSqrt.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSqrt.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSqrt.java Fri Aug  7 16:17:01
2009
@@ -21,12 +21,20 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 
 
 /**
  * Implementation of the SQRT UDF found in many databases.
  */
+@description(
+    name = "sqrt",
+    value = "_FUNC_(x) - returns the square root of x",
+    extended = "Example:\n " +
+        "  > SELECT _FUNC_(4) FROM src LIMIT 1;\n" +
+        "  2"
+    )
 public class UDFSqrt extends UDF {
 
   private static Log LOG = LogFactory.getLog(UDFSqrt.class.getName());

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java Fri Aug  7
16:17:01 2009
@@ -19,10 +19,24 @@
 package org.apache.hadoop.hive.ql.udf;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
 
-
+@description(
+    name = "substr,substring",
+    value = "_FUNC_(str, pos[, len]) - returns the substring of str that" +
+    		" starts at pos and is of length len",
+    extended = "pos is a 1-based index. If pos<0 the starting position is" +
+    		" determined by counting backwards from the end of str.\n" +
+    		"Example:\n " +
+        "  > SELECT _FUNC_('Facebook', 5) FROM src LIMIT 1;\n" +
+        "  'book'\n" +
+        "  > SELECT _FUNC_('Facebook', -5) FROM src LIMIT 1;\n" +
+        "  'ebook'\n" +
+        "  > SELECT _FUNC_('Facebook', 5, 1) FROM src LIMIT 1;\n" +
+        "  'b'"
+    )
 public class UDFSubstr extends UDF {
 
   Text r;

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFTrim.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFTrim.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFTrim.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFTrim.java Fri Aug  7 16:17:01
2009
@@ -19,12 +19,21 @@
 package org.apache.hadoop.hive.ql.udf;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.Text;
 import org.apache.commons.lang.StringUtils;
 
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
+@description(
+    name = "trim",
+    value = "_FUNC_(str) - Removes the leading and trailing space characters " +
+    		"from str ",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('   facebook  ') FROM src LIMIT 1;\n" +
+        "  'facebook'"
+    )
 public class UDFTrim extends UDF {
 
   Text result = new Text();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUnixTimeStamp.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUnixTimeStamp.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUnixTimeStamp.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUnixTimeStamp.java Fri
Aug  7 16:17:01 2009
@@ -26,11 +26,18 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
 
 
 @UDFType(deterministic=false)
+@description(
+    name = "unix_timestamp",
+    value = "_FUNC_([date[, pattern]]) - Returns the UNIX timestamp",
+    extended = "Converts the current or specified time to number of seconds " +
+    		"since 1970-01-01."
+    )
 public class UDFUnixTimeStamp extends UDF {
 
   private static Log LOG = LogFactory.getLog(UDFUnixTimeStamp.class.getName());

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUpper.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUpper.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUpper.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUpper.java Fri Aug  7 16:17:01
2009
@@ -19,8 +19,16 @@
 package org.apache.hadoop.hive.ql.udf;
 
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.Text;
 
+@description(
+    name = "upper,ucase",
+    value = "_FUNC_(str) - Returns str with all characters changed to uppercase",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('Facebook') FROM src LIMIT 1;\n" +
+        "  'FACEBOOK'"
+    )
 public class UDFUpper extends UDF {
 
   Text t = new Text();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFYear.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFYear.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFYear.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFYear.java Fri Aug  7 16:17:01
2009
@@ -26,10 +26,19 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
 
-
+@description(
+    name = "year",
+    value = "_FUNC_(date) - Returns the year of date",
+    extended = "date is a string in the format of 'yyyy-MM-dd HH:mm:ss' or " +
+        "'yyyy-MM-dd'.\n" +
+        "Example:\n " +
+        "  > SELECT _FUNC_('2009-30-07', 1) FROM src LIMIT 1;\n" +
+        "  2009"
+    )
 public class UDFYear extends UDF {
 
   private static Log LOG = LogFactory.getLog(UDFYear.class.getName());

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFAverage.java
Fri Aug  7 16:17:01 2009
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
@@ -36,9 +37,10 @@
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
 import org.apache.hadoop.io.LongWritable;
 
-/**
- * This class implements the COUNT aggregation function as in SQL.
- */
+@description(
+    name = "avg",
+    value = "_FUNC_(x) - Returns the mean of a set of numbers"
+)
 public class GenericUDAFAverage implements GenericUDAFResolver {
 
   @Override

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFCount.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFCount.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFCount.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFCount.java
Fri Aug  7 16:17:01 2009
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hive.ql.udf.generic;
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
@@ -29,6 +30,10 @@
 /**
  * This class implements the COUNT aggregation function as in SQL.
  */
+@description(
+    name = "count",
+    value = "_FUNC_(x) - Returns the count"
+)
 public class GenericUDAFCount implements GenericUDAFResolver {
 
   @Override

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFStd.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFStd.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFStd.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFStd.java
Fri Aug  7 16:17:01 2009
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hive.ql.udf.generic;
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
@@ -29,6 +30,10 @@
  * overriding the terminate() method of the evaluator.
  *
  */
+@description(
+    name = "std,stddev,stddev_pop",
+    value = "_FUNC_(x) - Returns the standard deviation of a set of numbers"
+)
 public class GenericUDAFStd extends GenericUDAFVariance {
   
   @Override

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFStdSample.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFStdSample.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFStdSample.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFStdSample.java
Fri Aug  7 16:17:01 2009
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hive.ql.udf.generic;
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
@@ -29,6 +30,11 @@
  * overriding the terminate() method of the evaluator.
  *
  */
+@description(
+    name = "stddev_samp",
+    value = "_FUNC_(x) - Returns the sample standard deviation of a set of " +
+		"numbers"
+)
 public class GenericUDAFStdSample extends GenericUDAFVariance {
   
   @Override

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java
Fri Aug  7 16:17:01 2009
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hive.ql.udf.generic;
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
@@ -29,9 +30,10 @@
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
 import org.apache.hadoop.io.LongWritable;
 
-/**
- * This class implements the COUNT aggregation function as in SQL.
- */
+@description(
+    name = "sum",
+    value = "_FUNC_(x) - Returns the sum of a set of numbers"
+)
 public class GenericUDAFSum implements GenericUDAFResolver {
 
   @Override

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVariance.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVariance.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVariance.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVariance.java
Fri Aug  7 16:17:01 2009
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
@@ -43,6 +44,10 @@
  *   GenericUDAFStdSample
  *
  */
+@description(
+    name = "variance,var_pop",
+    value = "_FUNC_(x) - Returns the variance of a set of numbers"
+)
 public class GenericUDAFVariance implements GenericUDAFResolver {
   
   @Override

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVarianceSample.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVarianceSample.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVarianceSample.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFVarianceSample.java
Fri Aug  7 16:17:01 2009
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hive.ql.udf.generic;
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
@@ -29,6 +30,10 @@
  * overriding the terminate() method of the evaluator.
  *
  */
+@description(
+    name = "var_samp",
+    value = "_FUNC_(x) - Returns the sample variance of a set of numbers"
+)
 public class GenericUDAFVarianceSample extends GenericUDAFVariance {
   
   @Override

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFCoalesce.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFCoalesce.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFCoalesce.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFCoalesce.java
Fri Aug  7 16:17:01 2009
@@ -22,6 +22,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
@@ -38,6 +39,13 @@
  * NOTES:
  * 1. a, b and c should have the same TypeInfo, or an exception will be thrown.
  */
+@description(
+    name = "coalesce",
+    value = "_FUNC_(a1, a2, ...) - Returns the first non-null argument",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_(NULL, 1, NULL) FROM src LIMIT 1;\n" +
+        "  1"
+    )
 public class GenericUDFCoalesce extends GenericUDF {
 
   private static Log LOG = LogFactory.getLog(GenericUDFCoalesce.class.getName());

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFElt.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFElt.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFElt.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFElt.java
Fri Aug  7 16:17:01 2009
@@ -21,6 +21,7 @@
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters;
@@ -36,6 +37,13 @@
  * 
  * @see org.apache.hadoop.hive.ql.udf.generic.GenericUDF
  */
+@description(
+    name = "elt",
+    value = "_FUNC_(n, str1, str2, ...) - returns the n-th string",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_(1, 'face', 'book') FROM src LIMIT 1;\n" +
+        "  'face'"
+    )
 public class GenericUDFElt extends GenericUDF {
 
   ObjectInspectorConverters.Converter[] converters;

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFHash.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFHash.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFHash.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFHash.java
Fri Aug  7 16:17:01 2009
@@ -23,6 +23,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
@@ -38,6 +39,10 @@
 /**
  * GenericUDF Class for computing hash values.
  */
+@description(
+    name = "hash",
+    value = "_FUNC_(a1, a2, ...) - Returns a hash value of the arguments"
+)
 public class GenericUDFHash extends GenericUDF {
 
   private static Log LOG = LogFactory.getLog(GenericUDFHash.class.getName());

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIndex.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIndex.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIndex.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFIndex.java
Fri Aug  7 16:17:01 2009
@@ -21,6 +21,7 @@
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde.Constants;
 import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector;
@@ -32,6 +33,10 @@
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
 import org.apache.hadoop.io.IntWritable;
 
+@description(
+    name = "index",
+    value = "_FUNC_(a, n) - Returns the n-th element of a "
+)
 public class GenericUDFIndex extends GenericUDF {
   private MapObjectInspector mapOI;
   private boolean mapKeyPreferWritable;

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFInstr.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFInstr.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFInstr.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFInstr.java
Fri Aug  7 16:17:01 2009
@@ -21,6 +21,7 @@
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters;
@@ -38,6 +39,14 @@
  * INSTR(str, substr)
  * </pre><p>
  */
+@description(
+    name = "instr",
+    value = "_FUNC_(str, substr) - Returns the index of the first occurance " +
+    		"of substr in str",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('Facebook', 'boo') FROM src LIMIT 1;\n" +
+        "  5"
+    )
 public class GenericUDFInstr extends GenericUDF{
 
   ObjectInspectorConverters.Converter[] converters;

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java
Fri Aug  7 16:17:01 2009
@@ -21,6 +21,7 @@
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters;
@@ -39,6 +40,14 @@
  * LOCATE(substr, str, start)
  * </pre><p>
  */
+@description(
+    name = "locate",
+    value = "_FUNC_(substr, str[, pos]) - Returns the position of the first " +
+    		"occurance of substr in str after position pos",
+    extended = "Example:\n" +
+        "  > SELECT _FUNC_('bar', 'foobarbar', 5) FROM src LIMIT 1;\n" +
+        "  7"
+    )
 public class GenericUDFLocate extends GenericUDF{
 
   ObjectInspectorConverters.Converter[] converters;

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotNull.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotNull.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotNull.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotNull.java
Fri Aug  7 16:17:01 2009
@@ -20,11 +20,16 @@
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
 import org.apache.hadoop.io.BooleanWritable;
 
+@description(
+    name = "isnotnull",
+    value = "_FUNC_ a - Returns true if a is not NULL and false otherwise"
+)
 public class GenericUDFOPNotNull extends GenericUDF {
 
   BooleanWritable result = new BooleanWritable();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNull.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNull.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNull.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNull.java
Fri Aug  7 16:17:01 2009
@@ -20,11 +20,16 @@
 
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
 import org.apache.hadoop.io.BooleanWritable;
 
+@description(
+    name = "isnull",
+    value = "_FUNC_ a - Returns true if a is NULL and false otherwise"
+)
 public class GenericUDFOPNull extends GenericUDF {
 
   BooleanWritable result = new BooleanWritable();

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSize.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSize.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSize.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSize.java
Fri Aug  7 16:17:01 2009
@@ -21,6 +21,7 @@
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde.Constants;
 import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector;
@@ -30,6 +31,10 @@
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
 import org.apache.hadoop.io.IntWritable;
 
+@description(
+    name = "size",
+    value = "_FUNC_(a) - Returns the size of a"
+)
 public class GenericUDFSize extends GenericUDF {
   private ObjectInspector returnOI;
   private IntWritable result = new IntWritable(-1);

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSplit.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSplit.java?rev=802066&r1=802065&r2=802066&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSplit.java
(original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSplit.java
Fri Aug  7 16:17:01 2009
@@ -23,6 +23,7 @@
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
+import org.apache.hadoop.hive.ql.exec.description;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
@@ -31,6 +32,14 @@
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters;
 
+@description(
+    name = "split",
+    value = "_FUNC_(str, regex) - Splits str around occurances that match " +
+		    "regex",
+    extended = "Example:\n" +
+    "  > SELECT _FUNC_('oneAtwoBthreeC', '[ABC]') FROM src LIMIT 1;\n" +
+    "  [\"one\", \"two\", \"three\"]"
+    )
 public class GenericUDFSplit extends GenericUDF {
   private ObjectInspectorConverters.Converter[] converters;
   

Added: hadoop/hive/trunk/ql/src/test/queries/clientpositive/describe_function.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientpositive/describe_function.q?rev=802066&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientpositive/describe_function.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientpositive/describe_function.q Fri Aug  7 16:17:01
2009
@@ -0,0 +1,13 @@
+DESCRIBE FUNCTION abs;
+DESCRIBE FUNCTION acos;
+DESCRIBE FUNCTION asin;
+DESCRIBE FUNCTION date_add;
+DESCRIBE FUNCTION parse_url;
+DESCRIBE FUNCTION split;
+
+DESCRIBE FUNCTION EXTENDED abs;
+DESCRIBE FUNCTION EXTENDED acos;
+DESCRIBE FUNCTION EXTENDED asin;
+DESCRIBE FUNCTION EXTENDED date_add;
+DESCRIBE FUNCTION EXTENDED parse_url;
+DESCRIBE FUNCTION EXTENDED split;

Added: hadoop/hive/trunk/ql/src/test/results/clientpositive/describe_function.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/describe_function.q.out?rev=802066&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/describe_function.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/describe_function.q.out Fri Aug 
7 16:17:01 2009
@@ -0,0 +1,55 @@
+query: DESCRIBE FUNCTION abs
+abs(x) - returns the absolute value of x
+query: DESCRIBE FUNCTION acos
+acos(x) - returns the arc cosine of x if -1<=x<=1 or NULL otherwise
+query: DESCRIBE FUNCTION asin
+asin(x) - returns the arc sine of x if -1<=x<=1 or NULL otherwise
+query: DESCRIBE FUNCTION date_add
+date_add(start_date, num_days) - Returns the date that is num_days after start_date.
+query: DESCRIBE FUNCTION parse_url
+parse_url(url, partToExtract[, key]) - extracts a part from a URL
+query: DESCRIBE FUNCTION split
+split(str, regex) - Splits str around occurances that match regex
+query: DESCRIBE FUNCTION EXTENDED abs
+abs(x) - returns the absolute value of x
+Example:
+  > SELECT abs(0) FROM src LIMIT 1;
+  0
+  > SELECT abs(-5) FROM src LIMIT 1;
+  5
+query: DESCRIBE FUNCTION EXTENDED acos
+acos(x) - returns the arc cosine of x if -1<=x<=1 or NULL otherwise
+Example:
+  > SELECT acos(1) FROM src LIMIT 1;
+  0
+  > SELECT acos(2) FROM src LIMIT 1;
+  NULL
+query: DESCRIBE FUNCTION EXTENDED asin
+asin(x) - returns the arc sine of x if -1<=x<=1 or NULL otherwise
+Example:
+  > SELECT asin(0) FROM src LIMIT 1;
+  0
+  > SELECT asin(2) FROM src LIMIT 1;
+  NULL
+query: DESCRIBE FUNCTION EXTENDED date_add
+date_add(start_date, num_days) - Returns the date that is num_days after start_date.
+start_date is a string in the format 'yyyy-MM-dd HH:mm:ss' or 'yyyy-MM-dd'. num_days is a
number. The time part of start_date is ignored.
+Example:
+   > SELECT date_add('2009-30-07', 1) FROM src LIMIT 1;
+  '2009-31-07'
+query: DESCRIBE FUNCTION EXTENDED parse_url
+parse_url(url, partToExtract[, key]) - extracts a part from a URL
+Parts: HOST, PATH, QUERY, REF, PROTOCOL, AUTHORITY, FILE, USERINFO
+key specifies which query to extract
+Example:
+  > SELECT parse_url('http://facebook.com/path/p1.php?query=1', 'HOST') FROM src LIMIT
1;
+  'facebook.com'
+  > SELECT parse_url('http://facebook.com/path/p1.php?query=1', 'QUERY') FROM src LIMIT
1;
+  'query=1'
+  > SELECT parse_url('http://facebook.com/path/p1.php?query=1', 'QUERY', 'query') FROM
src LIMIT 1;
+  '1'
+query: DESCRIBE FUNCTION EXTENDED split
+split(str, regex) - Splits str around occurances that match regex
+Example:
+  > SELECT split('oneAtwoBthreeC', '[ABC]') FROM src LIMIT 1;
+  ["one", "two", "three"]



Mime
View raw message