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

James Taylor commented on PHOENIX-2160:
---------------------------------------

bq. the dummy KeyValue added is lost somehow.
We should get to the root cause of this.

bq. Two KeyValueColumnExpression objects need not be created. Create one and 
use it.
+1 to Ram's comment

I'm not clear where this code is, as it's not in the patch.
{code}
if (projector != null) {
                    Tuple tuple = projector.projectResults(new 
ResultTuple(Result.create(result)));
                    result.clear();
                    result.add(tuple.getValue(0));
{code}

Can you re-attach the latest patch, [~Dumindux], as I'm having a hard time 
following your comment above?

Also, we need a unit test plus a way of indicating (probably in the explain 
plan would be best), that this optimization is being used. Just something 
simple that checks for the scan attributes having a non null 
BaseScannerRegionObserver.SPECIFIC_ARRAY_INDEX value in ExplainTable. Something 
at the end of this function, perhaps?
{code}
    protected void explain(String prefix, List<String> planSteps) {
        StringBuilder buf = new StringBuilder(prefix);
        ScanRanges scanRanges = context.getScanRanges();
        Scan scan = context.getScan();
        ...
        groupBy.explain(planSteps, groupByLimit);
        if (scan.getAttribute(BaseScannerRegionObserver.SPECIFIC_ARRAY_INDEX) 
!= null) {
                planSteps.add("    SERVER ARRAY ELEMENT PROJECTION");           
     
        }
{code}

Then we can have a unit test in QueryCompilerTest that changes the explain plan 
when an array element is projected to ensure we see this string in the explain 
plan.




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