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

James Taylor commented on PHOENIX-2796:
---------------------------------------

That code optimizes what gets returned from the server when only specific 
elements are selected in an array. Maybe that's done elsewhere with similar 
code, but we want to keep the optimization (and there should be tests for it as 
it was broken for a long time, but got fixed with new tests in place as far as 
I remember).

So a query like this, over an array with 100K elements, would only return two 
array element values per row:
{code}
SELECT a[20],a[100] FROM T WHERE k IN (1,2,3);
{code}

Do you remember which tests we added [~Dumindux]?

> Remove unnecessary code for handling array data type
> ----------------------------------------------------
>
>                 Key: PHOENIX-2796
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2796
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Samarth Jain
>
> [~ram_krish][~Dumindux] - In BaseScannerRegionObserver, I am seeing this 
> piece of code which is buggy and is not serving any purpose either. The bug 
> is that it ends up removing the wrong key value from the result in 
> result.remove(idx). Step through the code when you are running 
> ArrayIT#testServerArrayElementProjection2 as an example. 
> FWIW, I commented it out and the tests in ArrayIT all passed. Can you guys 
> please check? 
> {code}
> for (KeyValueColumnExpression kvExp : arrayKVRefs) {
>                     if (kvExp.evaluate(tuple, ptr)) {
>                         for (int idx = tuple.size() - 1; idx >= 0; idx--) {
>                             Cell kv = tuple.getValue(idx);
>                             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}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to