[
https://issues.apache.org/jira/browse/PHOENIX-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14009204#comment-14009204
]
James Taylor commented on PHOENIX-952:
--------------------------------------
Here's the rule you'd muck with in the PhoenixSQL.g grammar along with an
example for the EQ:
{code}
boolean_expression returns [ParseNode ret]
: l=value_expression ((EQ (r=value_expression | ((all=ALL | any=ANY)
LPAREN r=value_expression RPAREN)) {$ret = factory.equal(l,r, all != null, any
!= null); } )
| ...
{code}
Then in the factory method, if ALL or ANY was used, you'd create the ParseNode
structure mentioned above, otherwise you'd do what's done today. Then just
continue with the items here:
- Add a visitEnter/visitLeave for ArrayAnyCombinedParseNode and
ArrayAllCombinedParseNode to ParseNodeVisitor
There are numerous ways you could refactor this to capture all the boolean
expressions supported by ANY or ALL, perhaps folding all cases of EQ,GT,LT,
etc. into a single rule or using a factory method that rejiggers/wraps what's
already returned at the end of the rule.
It looks like ALL(array) IS NULL is not supported by Postgres - the ANY/ALL has
to be on the RHS, otherwise there's an ambiguity in the grammar. I guess it's
fine for us to do the same.
> 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)