[ 
https://issues.apache.org/jira/browse/HIVEMALL-264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16998880#comment-16998880
 ] 

Makoto Yui commented on HIVEMALL-264:
-------------------------------------

{code:java}
SELECT
  l.country,
  sum(r.android) as android,
  sum(r.pc) as pc,
  sum(r.iphone) as iphone
from
  htable l
  LATERAL VIEW pivot(array('android','pc','iphone'), platform, sales) as r
group by
  l.country

SELECT
  l.country,
  r.platform,
  r.sales
FROM
  htable l
  LATERAL VIEW unpivot(array('android','pc','iphone'), l.andoird_sales, 
l.pc_sales, l.iphone_sales) r as platform, sales
{code}

> pivot/unpivot UDF
> -----------------
>
>                 Key: HIVEMALL-264
>                 URL: https://issues.apache.org/jira/browse/HIVEMALL-264
>             Project: Hivemall
>          Issue Type: Wish
>            Reporter: Makoto Yui
>            Priority: Minor
>
> Support pivot/unpivot UDF.
> [https://support.treasuredata.com/hc/en-us/articles/360001451248-Hive-Presto-Standard-SQL-Tips]
> [https://docs.snowflake.net/manuals/sql-reference/constructs/pivot.html]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to