[
https://issues.apache.org/jira/browse/PHOENIX-953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14723756#comment-14723756
]
Maryann Xue edited comment on PHOENIX-953 at 8/31/15 5:40 PM:
--------------------------------------------------------------
Found that Teradata has an interesting extension to UNNEST: the key_expr
(http://www.info.teradata.com/HTMLPubs/DB_TTU_15_00/index.html#page/SQL_Reference/B035_1145_015K/ARRAY_Functions.063.036.html).
Guess it's useful for joining the UNNEST result to its original table, to
achieve the same goal as running query:
SELECT s.student_id, t.score
FROM score_table AS s,
UNNEST((SELECT scores FROM score_table AS s2 WHERE s2.student_id =
s.student_id)) AS t(score)
Without this extension, the above query could only be run with nested loop join
which is very inefficient in Phoenix.
was (Author: maryannxue):
Found that Teradata has an interesting extension to UNNEST: the key_expr. Guess
it's useful for joining the UNNEST result to its original table, to achieve the
same goal as running query:
SELECT s.student_id, t.score
FROM score_table AS s,
UNNEST((SELECT scores FROM score_table AS s2 WHERE s2.student_id =
s.student_id)) AS t(score)
Without this extension, the above query could only be run with nested loop join
which is very inefficient in Phoenix.
> Support UNNEST for ARRAY
> ------------------------
>
> Key: PHOENIX-953
> URL: https://issues.apache.org/jira/browse/PHOENIX-953
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: James Taylor
> Assignee: Dumindu Buddhika
> Fix For: 4.6
>
> Attachments: PHOENIX-953-v1.patch, PHOENIX-953-v2.patch,
> PHOENIX-953-v3.patch, PHOENIX-953-v4.patch
>
>
> The UNNEST built-in function converts an array into a set of rows. This is
> more than a built-in function, so should be considered an advanced project.
> For an example, see the following Postgres documentation:
> http://www.postgresql.org/docs/8.4/static/functions-array.html
> http://www.anicehumble.com/2011/07/postgresql-unnest-function-do-many.html
> http://tech.valgog.com/2010/05/merging-and-manipulating-arrays-in.html
> So the UNNEST is a way of converting an array to a flattened "table" which
> can then be filtered on, ordered, grouped, etc.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)