GitHub user comnetwork opened a pull request:

    https://github.com/apache/phoenix/pull/320

    PHOENIX-4820

    This patch is mainly for:
    
    1.Isolate the changes made for QueryCompiler to OrderByCompiler.
    2.Check more Expression besides ComparisonExpression for 
IsColumnConstantExpressionVisitor, add tests for InListExpression , 
CorceExpression and RVC.
    3. I think ExpressionUtil.isConstant(Expression) is not suitable for  
OrderPreservingTracker.IsConstantVisitor, isStateless() is to check if the 
expression is depend on the server state, even for RowKeyColumnExpression , 
isStateless() is false. What we want to check is if a expression is constant 
when all children of it are constants, just consider following sql:
    
    select a.ak3 from
    (select rand() ak1,length(pk2) ak2,length(pk3) ak3,length(v1) 
av1,length(v2) av2 from test order by pk2,pk3 limit 10) a
    where a.ak1 = 0.0 and a.av2 = length(substr('abc',1,1))
    group by a.ak3,CASE WHEN coalesce(a.ak1,1) > coalesce(a.av2,2) THEN 
coalesce(a.ak1,1) ELSE coalesce(a.av2,2) END,a.av1
    order by a.ak3,a.av1
    
    Obviously , because of rand(), the Determinism of expression a.ak1 is 
Determinism.PER_INVOCATION, so for expression "CASE WHEN coalesce(a.ak1,1) > 
coalesce(a.av2,2) THEN coalesce(a.ak1,1) ELSE coalesce(a.av2,2) END", the 
determinism is Determinism.PER_INVOCATION and isStateless is false , but 
because the a.ak1 and a.av2 are both constants in where clause of outer query, 
we can regard "CASE WHEN coalesce(a.ak1,1) > coalesce(a.av2,2) THEN 
coalesce(a.ak1,1) ELSE coalesce(a.av2,2) END" as constant in IsConstantVisitor.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/comnetwork/phoenix 4.x-HBase-1.3

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/phoenix/pull/320.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #320
    
----
commit ae0e6ef4dded2c3a8c3d6fffa200acbe971688f8
Author: chenglei <chenglei@...>
Date:   2018-07-31T04:34:25Z

    PHOENIX-4820 v2

----


---

Reply via email to