Yingyi Bu has posted comments on this change.

Change subject: Intersect the 2ndary indexes before primary search
......................................................................


Patch Set 3:

(5 comments)

https://asterix-gerrit.ics.uci.edu/#/c/578/3/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java
File 
asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java:

Line 148:             // one primary + 2nd indexes, choose primary index 
directly.
2nd->secondary


Line 178:                 throw new AlgebricksException("The data source root 
should be the same");
"be the same" -->"have the same operator type."


Line 183:             if (lop.getInputs().get(0).getValue().getOperatorTag() != 
LogicalOperatorTag.ORDER) {
This check seems not necessary.

The requiredPropertiesForChildren() of lop will make sure the input is ordered.


Line 192:                     throw new AlgebricksException("It should not 
happen, the order by expression is not variables");
It seems that the code can be simplified a bit because the intersect only cares 
about input live variables:
 for (int i = 0; i < subRoots.size(); i++) {    176
            if (lop.getOperatorTag() != subRoots.get(i).getOperatorTag()) {     
                
                throw new AlgebricksException("The data source root should have 
the same operator type"); 
            }
            if (lop.getInputs().size() != 1) {

                throw new AlgebricksException("The primary search has multiple 
input");
            
            } 
           
           ILogicalOperator curRoot = subRoots.get(i);
 
           // This should be a ListSet instead of a HashSet to make sure

           // live variables from different branches are aligned in the same 
way.
 
           Set<LogicalVariable> liveVars = new ListSet<>(); 

           VariableUtilities.getLiveVariables(curRoot, listSet);
 
           inputVars.add(liveVars);
}


Line 207:         
intersect.setExecutionMode(AbstractLogicalOperator.ExecutionMode.LOCAL);
Is this necessary?  The SetExecutionModeRule will be applied later in physical 
rewrites.


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/578
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie167918fb23e39c8728840e4a90c1b85bf1bde85
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Jianfeng Jia <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Jianfeng Jia <[email protected]>
Gerrit-Reviewer: Taewoo Kim <[email protected]>
Gerrit-Reviewer: Yingyi Bu <[email protected]>
Gerrit-HasComments: Yes

Reply via email to