hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1034488 - in /hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToMap.java ql/src/test/results/clientpositive/str_to_map.q.out
Date Fri, 12 Nov 2010 17:38:08 GMT
Author: namit
Date: Fri Nov 12 17:38:07 2010
New Revision: 1034488

URL: http://svn.apache.org/viewvc?rev=1034488&view=rev
Log:
HIVE-1786 Better documentation for udf str_to_map
(Siying Dong via namit)


Modified:
    hive/trunk/CHANGES.txt
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToMap.java
    hive/trunk/ql/src/test/results/clientpositive/str_to_map.q.out

Modified: hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hive/trunk/CHANGES.txt?rev=1034488&r1=1034487&r2=1034488&view=diff
==============================================================================
--- hive/trunk/CHANGES.txt (original)
+++ hive/trunk/CHANGES.txt Fri Nov 12 17:38:07 2010
@@ -105,7 +105,7 @@ Trunk -  Unreleased
     (Amareshwari Sriramadasu via namit)
 
     HIVE-1779 Add udf str_to_map
-    (Siying Dong via via namit)
+    (Siying Dong via namit)
 
   IMPROVEMENTS
 
@@ -241,11 +241,14 @@ Trunk -  Unreleased
     (Siying Dong via namit)
 
     HIVE-1754 Remove JDBM component from Map Join
-    (Liyin via He Yongqiang)    
+    (Liyin via He Yongqiang)
 
     HIVE-1782 add more debug information for hive locking
     (namit via He Yongqiang)
 
+    HIVE-1786 Better documentation for udf str_to_map
+    (Siying Dong via namit)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToMap.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToMap.java?rev=1034488&r1=1034487&r2=1034488&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToMap.java
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFStringToMap.java
Fri Nov 12 17:38:07 2010
@@ -35,7 +35,10 @@ import org.apache.hadoop.hive.serde2.typ
  *
  */
 @Description(name = "str_to_map", value = "_FUNC_(text, delimiter1, delimiter2) - "
-    + "Creates a map by parsing text ")
+    + "Creates a map by parsing text ", extended = "Split text into key-value pairs"
+    + " using two delimiters. The first delimiter seperates pairs, and the"
+    + " second delimiter sperates key and value. If only one parameter is given, default"
+    + " delimiters are used: ',' as delimiter1 and '=' as delimiter2.")
 public class GenericUDFStringToMap extends GenericUDF {
   HashMap<Object, Object> ret = new HashMap<Object, Object>();
   StringObjectInspector soi_text, soi_de1 = null, soi_de2 = null;
@@ -73,7 +76,7 @@ public class GenericUDFStringToMap exten
   public Object evaluate(DeferredObject[] arguments) throws HiveException {
     ret.clear();
     String text = soi_text.getPrimitiveJavaObject(arguments[0].get());
-    String delimiter1 = (soi_de1 == null) ? 
+    String delimiter1 = (soi_de1 == null) ?
       default_de1 : soi_de1.getPrimitiveJavaObject(arguments[1].get());
     String delimiter2 = (soi_de2 == null) ?
       default_de2 : soi_de2.getPrimitiveJavaObject(arguments[2].get());

Modified: hive/trunk/ql/src/test/results/clientpositive/str_to_map.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/str_to_map.q.out?rev=1034488&r1=1034487&r2=1034488&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/str_to_map.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/str_to_map.q.out Fri Nov 12 17:38:07 2010
@@ -8,6 +8,7 @@ PREHOOK: type: DESCFUNCTION
 POSTHOOK: query: desc function extended str_to_map
 POSTHOOK: type: DESCFUNCTION
 str_to_map(text, delimiter1, delimiter2) - Creates a map by parsing text 
+Split text into key-value pairs using two delimiters. The first delimiter seperates pairs,
and the second delimiter sperates key and value. If only one parameter is given, default delimiters
are used: ',' as delimiter1 and '=' as delimiter2.
 PREHOOK: query: explain select str_to_map('a=1,b=2,c=3',',','=')['a'] from src limit 3
 PREHOOK: type: QUERY
 POSTHOOK: query: explain select str_to_map('a=1,b=2,c=3',',','=')['a'] from src limit 3
@@ -47,11 +48,11 @@ STAGE PLANS:
 PREHOOK: query: select str_to_map('a=1,b=2,c=3',',','=')['a'] from src limit 3
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
-PREHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-28_591_6260158416663883074/-mr-10000
+PREHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-48-48_939_5414753236298860779/-mr-10000
 POSTHOOK: query: select str_to_map('a=1,b=2,c=3',',','=')['a'] from src limit 3
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
-POSTHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-28_591_6260158416663883074/-mr-10000
+POSTHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-48-48_939_5414753236298860779/-mr-10000
 1
 1
 1
@@ -94,11 +95,11 @@ STAGE PLANS:
 PREHOOK: query: select str_to_map('a:1,b:2,c:3') from src limit 3
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
-PREHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-32_534_2589249075999917145/-mr-10000
+PREHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-48-51_828_6905327639418151142/-mr-10000
 POSTHOOK: query: select str_to_map('a:1,b:2,c:3') from src limit 3
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
-POSTHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-32_534_2589249075999917145/-mr-10000
+POSTHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-48-51_828_6905327639418151142/-mr-10000
 {"b":"2","c":"3","a":"1"}
 {"b":"2","c":"3","a":"1"}
 {"b":"2","c":"3","a":"1"}
@@ -141,11 +142,11 @@ STAGE PLANS:
 PREHOOK: query: select str_to_map('a:1,b:2,c:3',',',':') from src limit 3
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
-PREHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-36_278_460631588022401435/-mr-10000
+PREHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-48-54_404_1637219732245487353/-mr-10000
 POSTHOOK: query: select str_to_map('a:1,b:2,c:3',',',':') from src limit 3
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
-POSTHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-36_278_460631588022401435/-mr-10000
+POSTHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-48-54_404_1637219732245487353/-mr-10000
 {"b":"2","c":"3","a":"1"}
 {"b":"2","c":"3","a":"1"}
 {"b":"2","c":"3","a":"1"}
@@ -204,13 +205,13 @@ from (select transform('a:1,b:2,c:3') us
 limit 3
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
-PREHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-40_008_1745894324808734321/-mr-10000
+PREHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-48-56_995_8619552318902310354/-mr-10000
 POSTHOOK: query: select str_to_map(t.ss,',',':')['a']
 from (select transform('a:1,b:2,c:3') using 'cat' as (ss) from src) t
 limit 3
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
-POSTHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-40_008_1745894324808734321/-mr-10000
+POSTHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-48-56_995_8619552318902310354/-mr-10000
 1
 1
 1
@@ -228,11 +229,11 @@ POSTHOOK: Output: default@tbl_s2m
 PREHOOK: query: select str_to_map(t,'_','=')['333'] from tbl_s2m
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tbl_s2m
-PREHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-48_099_3563726538760875441/-mr-10000
+PREHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-49-02_576_7096389194927995175/-mr-10000
 POSTHOOK: query: select str_to_map(t,'_','=')['333'] from tbl_s2m
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tbl_s2m
-POSTHOOK: Output: file:/tmp/njain/hive_2010-11-10_09-32-48_099_3563726538760875441/-mr-10000
+POSTHOOK: Output: file:/tmp/sdong/hive_2010-11-12_00-49-02_576_7096389194927995175/-mr-10000
 444
 444
 444



Mime
View raw message