[
https://issues.apache.org/jira/browse/PHOENIX-953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14694076#comment-14694076
]
Julian Hyde commented on PHOENIX-953:
-------------------------------------
[~maryannxue], That capability you refer to - to reference a previous table in
the same FROM clause - is the LATERAL keyword in standard SQL. In the standard,
if you use UNNEST, you implicit get LATERAL.
I don't see that we can achieve anything useful without LATERAL. Even if you
use a sub-query, won't you need to refer to the other table via a correlating
variable? E.g.
{code}SELECT o.id, li.quantity, li.prodId
FROM Orders AS o,
UNNEST((SELECT o2.lineitems FROM orders AS o2 WHERE o2.id = o.id)) AS li{code}
Note the double parentheses above, necessary because the argument to UNNEST is
an expression (in this case a scalar sub-query) and not a query.
> 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
> Attachments: PHOENIX-953-v1.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)