[
https://issues.apache.org/jira/browse/PHOENIX-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14047795#comment-14047795
]
James Taylor commented on PHOENIX-952:
--------------------------------------
Thanks for the patch, [~ram_krish]. This version is much cleaner. However, the
evaluate method in ArrayAnyComparisonExpression is doing more work than it
should - it'll end up re-doing part of the expression compilation for every row
that gets evaluated.
Instead, if you create a kind of placeholder ParseNode as I mentioned above for
ArrayAnyParseNode, you can then replace it at compile time (which gets executed
once per statement instead of once per row), in
ExpressionCompile.visitLeave(ArrayAnyParseNode). This will perform much better.
The trick is that the ArrayAnyExpression would have an expression that
represents the array element reference position as a member variable. Each time
through the loop in the ArrayAnyExpression.evaluate method, you'd increment the
INTEGER represented in the byte array that backs the expression to the next
position in the array. The boolean ComparisonExpression wouldn't change (i.e.
you wouldn't need to allocate a new one with each iteration of the loop). It
would just evaluate the one side against the result of de-referencing the array
using the regular built-in function.
Make sense?
> 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,
> Phoenix-952_4.patch, Phoenix-952_5.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)