[ 
https://issues.apache.org/jira/browse/PHOENIX-2160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14711091#comment-14711091
 ] 

Dumindu Buddhika commented on PHOENIX-2160:
-------------------------------------------

@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)

Reply via email to