[ https://issues.apache.org/jira/browse/PHOENIX-953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14654752#comment-14654752 ]
Maryann Xue commented on PHOENIX-953: ------------------------------------- Yes, the very fundamental thing we need for unnest is an UnnestArrayResultIterator (maybe as an inner class of UnnestArrayQueryPlan), which takes an array and emits a new tuple for each of the array's element. The UnnestArrayQueryPlan may derive from DelegateQueryPlan, which has an input plan. For example, "select unnest(array1) from t", we'll get a ScanPlan on table 't' wrapped by an UnnestArrayQueryPlan. I just implemented the extension for VALUES (https://docs.oracle.com/javadb/10.8.3.0/devguide/cdevtricks807365.html) on the calcite branch and committed a new class called LiteralResultIterationQueryPlan (which is an enhanced version of EmptyTableQueryPlan). I think this should be helpful for the "no from clause UNNEST" and might be exactly what it needs. > 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 > > 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)