[
https://issues.apache.org/jira/browse/PHOENIX-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14008781#comment-14008781
]
ramkrishna.s.vasudevan commented on PHOENIX-952:
------------------------------------------------
[~jamestaylor]
Do you mean first we will parse the ANY/ALL expression as individual node and
while coming to the ParseNodeRewriter where we form the comparison node , we
could rewrite to form a new type of node which has the following
Type - ANY(SOME)/ALL,
Compare op - ==,<,<= etc
LHS - Literal expression
RHS - the array type column name.
Now when ever this new node is encountered we form a new type of Expression
that has an evaluate method that understands the above syntax (if is ANY/ALL)
and works based on that.
So with the new type of change am seeing it will create the following
ArrayAnyAllParseNode - The initial node that represents the RHS in the
following expression
{code}
a = ANY(b)
{code}
The above node will have the info whether the node is of type ANY or ALL and
the array type column name and its type.
A corresponding expression would be formed ArrayAnyAllExpression that has an
evaluate method that evaluates the ARRay type col name . On seeing this above
node ArrayAnyAllParseNode in the ParseNodeRewriter of the comparisonExpression
create a new type of node
ArrayAnyAllComparisonNode - This will have the CompareOp also passed with it
and same as ArrayAnyAllParseNode .
Create a corresponding expression node ArrayAnyAllCombinedExpression that does
the actual evaluation for which the children are the ArrayAnyAllExpression and
the LiteralExpression (the actual LHS).
Another thing that I noted was in the patch the .g file is modified so that the
ANY/ALL is evaluated as 'term' that comes inside the 'value_expression'.
If I try to add an 'any_expression' or 'all_expression' it was not working
because already the not_expression is expecting a LPAREN. In the latest
approach mentioned above the ComparisonExpression is untouched.
> Support ANY and ALL built-ins for ARRAYs
> ----------------------------------------
>
> Key: PHOENIX-952
> URL: https://issues.apache.org/jira/browse/PHOENIX-952
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 3.0.0, 4.0.0
> Reporter: James Taylor
> Assignee: ramkrishna.s.vasudevan
> Fix For: 3.1, 4.1
>
> Attachments: Phoenix-932_1.patch, Phoenix-932_2.patch
>
>
> There's currently no good way to search array elements. We should support the
> ANY and ALL built-ins for our ARRAY type like Postgres does:
> http://www.postgresql.org/docs/9.1/static/arrays.html#ARRAYS-SEARCHING
--
This message was sent by Atlassian JIRA
(v6.2#6252)