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

Maryann Xue commented on PHOENIX-953:
-------------------------------------

Thanks for the patch, [~Dumindux]! Some comments on the UnnestArrayQueryPlan:

1. It's pretty smart to avoid creating new Tuples by delegating the logic to 
UnnestExpression. But I think this deviates from its semantics and makes the 
behavior of a ResultIterator dependent on this expression and thus on its 
consumer. So it might be good to let the UnnestResultIterator to return a new 
tuple for each array element and maybe share some underlying storage if 
possible.

2. Add more information to the explain-plan so that it reflects the UNNEST 
operation.

3. Use a "end" or "closed" flag for the iterator. Otherwise, if consumer 
continues to call "next()" after hitting the end, "delegate.next()" will be 
executed again, which might or might not cause real problems in Phoenix but is 
not a good practice.

> 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)

Reply via email to