static private boolean isFullQuery(IndexCallContext indexContext) { RelNode rootInCall = indexContext.getCall().rel(0); // check if the tip of the operator stack we have is also the top of the whole query, if yes, return true if (indexContext.getCall().getPlanner().getRoot() instanceof RelSubset) { final RelSubset rootSet = (RelSubset) indexContext.getCall().getPlanner().getRoot(); if (rootSet.getRelList().contains(rootInCall)) { return true; } } else { if (indexContext.getCall().getPlanner().getRoot().equals(rootInCall)) { return true; } } return false; }
public RelTraitSet newTraitSet(RelTrait... traits) { RelTraitSet set = indexContext.getCall().getPlanner().emptyTraitSet(); for (RelTrait t : traits) { if(t != null) { set = set.plus(t); } } return set; }
public AbstractIndexPlanGenerator(IndexCallContext indexContext, RexNode indexCondition, RexNode remainderCondition, RexBuilder builder, PlannerSettings settings) { super(indexContext.getCall()); this.origProject = indexContext.getLowerProject(); this.origScan = indexContext.getScan(); this.upperProject = indexContext.getUpperProject(); this.indexCondition = indexCondition; this.remainderCondition = remainderCondition; this.indexContext = indexContext; this.builder = builder; this.settings = settings; }
/** * we assume all the indexes added in indexPropList are all applicable (and covering). * For now this function is used and tested only in IndexScanWithSortOnlyPrule */ public IndexProperties getBestIndexNoFilter() { if (indexPropList.size() == 0) { return null; } RelOptPlanner planner = indexContext.getCall().getPlanner(); List<IndexGroup> candidateIndexes = Lists.newArrayList(); for (IndexProperties p : indexPropList) { p.setSatisfiesCollation(buildAndCheckCollation(p)); IndexGroup index = new IndexGroup(); index.addIndexProp(p); candidateIndexes.add(index); } Collections.sort(candidateIndexes, new IndexComparator(planner, builder)); return candidateIndexes.get(0).getIndexProps().get(0); }
new DrillParseContext(PrelUtil.getPlannerSettings(indexContext.getCall().rel(0).getCluster()));
List<IndexGroup> nonCoveringIndexes, List<IndexGroup> intersectIndexes) { RelOptPlanner planner = indexContext.getCall().getPlanner(); PlannerSettings settings = PrelUtil.getPlannerSettings(planner); List<IndexGroup> candidateIndexes = Lists.newArrayList();
public void go() throws InvalidRelException { RelNode top = indexContext.getCall().rel(0); final RelNode input; if (top instanceof DrillProjectRel) { DrillProjectRel topProject = (DrillProjectRel) top; input = topProject.getInput(); } else if (top instanceof DrillFilterRel) { DrillFilterRel topFilter = (DrillFilterRel)top; input = topFilter.getInput(); } else if (top instanceof DrillSortRel) { DrillSortRel topSort = (DrillSortRel)top; input = topSort.getInput(); } else if ( top instanceof DrillSortRel) { DrillSortRel topSort = (DrillSortRel) top; input = topSort.getInput(); } else { return; } RelTraitSet traits = input.getTraitSet().plus(Prel.DRILL_PHYSICAL); RelNode convertedInput = Prule.convert(input, traits); this.go(top, convertedInput); } }
new DrillParseContext(PrelUtil.getPlannerSettings(indexContext.getCall().rel(0).getCluster()));