[
https://issues.apache.org/jira/browse/PHOENIX-1665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14349968#comment-14349968
]
Serhiy Bilousov commented on PHOENIX-1665:
------------------------------------------
I thought unnest is postgresql's analog of UNPIVOT. It looks like it at least.
[SQL Fiddle][1]
**PostgreSQL 9.3.1 Schema Setup**:
CREATE TABLE tst (id int, a text, b text, c text);
INSERT INTO tst VALUES (1, 'ant', 'cat', 'chimp'), (2, 'grape', 'mint',
'basil');
**Query 1**:
SELECT id,
unnest(array['a', 'b', 'c']) AS colname,
unnest(array[a, b, c]) AS thing
FROM tst
ORDER BY id
**[Results][2]**:
| ID | COLNAME | THING |
|----|---------|-------|
| 1 | a | ant |
| 1 | b | cat |
| 1 | c | chimp |
| 2 | a | grape |
| 2 | b | mint |
| 2 | c | basil |
[1]: http://sqlfiddle.com/#!15/8e7cb/2
[2]: http://sqlfiddle.com/#!15/8e7cb/2/0
> Implement missing ARRAY built-in functions
> -------------------------------------------
>
> Key: PHOENIX-1665
> URL: https://issues.apache.org/jira/browse/PHOENIX-1665
> Project: Phoenix
> Issue Type: Bug
> Reporter: James Taylor
> Labels: Java, gsoc2015, mentor, sql
>
> Take a look at the typical ARRAY built-in functions that are implemented in
> relational database systems
> (http://www.postgresql.org/docs/9.2/static/functions-array.html) and
> implement the same for Phoenix in Java following this guide:
> http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html
> Examples of missing functions include UNNEST, ARRAY_APPEND, ARRAY_FILL,
> ARRAY_PREPEND, etc.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)