hadoop-hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zheng Shao (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HIVE-554) Add GenericUDF to create arrays, maps, and structs
Date Tue, 03 Nov 2009 03:11:59 GMT

    [ https://issues.apache.org/jira/browse/HIVE-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772857#action_12772857
] 

Zheng Shao commented on HIVE-554:
---------------------------------

I mean the functions like this. We can build the string in a little different way. (It applies
to both array and map).

I don't think we need JSON format in the explain result, since the expression in explain result
is not in JSON anyway.

{code}
+  public String getDisplayString(String[] children) {
+    StringBuilder sb = new StringBuilder();
+    sb.append("[");
+    for(int i=0; i<children.length; i++) {
+      sb.append(children[i]);
+      if(i+1 != children.length) {
+        sb.append(",");
+      }
+    }
+    sb.append("]");
+    return sb.toString();
+  }
+}
+  public String getDisplayString(String[] children) {
+    StringBuilder sb = new StringBuilder();
+    sb.append("[");
+    for(int i=0; i<children.length; i++) {
+      sb.append(children[i]);
+      if(i+1 != children.length) {
+        sb.append(",");
+      }
+    }
+    sb.append("]");
+    return sb.toString();
+  }
+}
{code}


> Add GenericUDF to create arrays, maps, and structs
> --------------------------------------------------
>
>                 Key: HIVE-554
>                 URL: https://issues.apache.org/jira/browse/HIVE-554
>             Project: Hadoop Hive
>          Issue Type: New Feature
>            Reporter: Zheng Shao
>            Assignee: Paul Yang
>         Attachments: HIVE-554.1.patch
>
>
> Here is an example:
> {code}
> SELECT array(1,2,3)[3], map("a":1,"b":2,"c":3)["a"], struct(user_id:3, revenue: sum(rev))
> FROM table
> GROUP BY user_id;
> {code}
> This is relatively easy to do with the GenericUDF framework, and will greatly increase
the flexibility of the language.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message