You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Dumindu Buddhika (JIRA)" <ji...@apache.org> on 2015/08/25 13:23:45 UTC
[jira] [Comment Edited] (PHOENIX-2160) Projection of specific array
index does not work
[ https://issues.apache.org/jira/browse/PHOENIX-2160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14711091#comment-14711091 ]
Dumindu Buddhika edited comment on PHOENIX-2160 at 8/25/15 11:22 AM:
---------------------------------------------------------------------
[~jamestaylor], [~ram_krish] Thanks for the reviews. I have found an issue with this while running a test.
In a query like this,
{code}
SELECT ARRAY_APPEND(doubles, doubles[2]) FROM regions WHERE region_name = 'SF Bay Area'
{code}
Where we refer to the same array at two places. When we need the whole array and a single array element (here doubles is a double array) in the same query.
But with this optimization, since we have doubles[2] in the query we remove the kv with the full array at BaseScannerRegionObserver.replaceArrayIndexElement
{code}
if (Bytes.equals(kvExp.getColumnFamily(), 0, kvExp.getColumnFamily().length,
kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength())
&& Bytes.equals(kvExp.getColumnName()
, 0, kvExp.getColumnName().length,
kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength())) {
// remove the kv that has the full array values.
result.remove(idx);
break;
}
{code}
Because of this ARRAY_APPEND fails to evaluate the array expression. Any idea on what can be done to prevent this from happening?
was (Author: dumindux):
@james taylor, [~ram_krish] Thanks for the reviews. I have found an issue with this while running a test.
In a query like this,
{code}
SELECT ARRAY_APPEND(doubles, doubles[2]) FROM regions WHERE region_name = 'SF Bay Area'
{code}
Where we refer to the same array at two places. When we need the whole array and a single array element (here doubles is a double array) in the same query.
But with this optimization, since we have doubles[2] in the query we remove the kv with the full array at BaseScannerRegionObserver.replaceArrayIndexElement
{code}
if (Bytes.equals(kvExp.getColumnFamily(), 0, kvExp.getColumnFamily().length,
kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength())
&& Bytes.equals(kvExp.getColumnName()
, 0, kvExp.getColumnName().length,
kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength())) {
// remove the kv that has the full array values.
result.remove(idx);
break;
}
{code}
Because of this ARRAY_APPEND fails to evaluate the array expression. Any idea on what can be done to prevent this from happening?
> Projection of specific array index does not work
> ------------------------------------------------
>
> Key: PHOENIX-2160
> URL: https://issues.apache.org/jira/browse/PHOENIX-2160
> Project: Phoenix
> Issue Type: Bug
> Reporter: ramkrishna.s.vasudevan
> Assignee: ramkrishna.s.vasudevan
> Attachments: PHOENIX-2160.patch, PHOENIX-2160_v2.patch, PHOENIX-2160_v3.patch, PHOENIX-2160_v4.patch
>
>
> PHOENIX-10 that allowed projection of specific array index does not work now. Was looking into the code for some thing and found this issue. Let me know if am missing something.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)