public CoveringIndexPlanGenerator(IndexLogicalPlanCallContext indexContext, FunctionalIndexInfo functionInfo, IndexGroupScan indexGroupScan, RexNode indexCondition, RexNode remainderCondition, RexBuilder builder, PlannerSettings settings) { super(indexContext, indexCondition, remainderCondition, builder, settings); this.indexGroupScan = indexGroupScan; this.functionInfo = functionInfo; this.indexDesc = functionInfo.getIndexDesc(); }
public CoveringPlanNoFilterGenerator(IndexCallContext indexContext, FunctionalIndexInfo functionInfo, boolean isSingleton, PlannerSettings settings) { super(indexContext, null, null, null, settings); this.functionInfo = functionInfo; this.indexDesc = functionInfo == null ? null : functionInfo.getIndexDesc(); this.indexGroupScan = functionInfo == null ? null : functionInfo.getIndexDesc().getIndexGroupScan(); this.isSingletonSortedStream = isSingleton; }
/** * Build collation property for project, the one closer to the Scan * @param projectRexs the expressions to project * @param project the project between projectRexs and input, it could be null if no such intermediate project(lower project) * @param input the input RelNode to the project, usually it is the scan operator. * @param indexInfo the index for which we are building index plan * @param context the context of this index planning process * @return the output RelCollation */ public static RelCollation buildCollationProject(List<RexNode> projectRexs, DrillProjectRelBase project, RelNode input, FunctionalIndexInfo indexInfo, IndexCallContext context) { Map<LogicalExpression, Integer> projectExprs = getProjectExprs(projectRexs, project, input); return buildCollationForExpressions(projectExprs, indexInfo.getIndexDesc(), context); }
for (LogicalExpression expr : indexInfo.getIndexDesc().getIndexColumns()) { if (!projectExprs.containsKey(expr)) { break; RelFieldCollation.Direction dir = indexInfo.getIndexDesc().getCollation().getFieldCollations().get(idxFieldCount).direction; if ( dir == null) { break;
/** * For a particular table scan for table T1 and an index on that table, find out if it is a covering index * @return */ static public boolean isCoveringIndex(IndexCallContext indexContext, FunctionalIndexInfo functionInfo) { if (functionInfo.hasFunctional()) { // need info from full query return queryCoveredByIndex(indexContext, functionInfo); } DbGroupScan groupScan = (DbGroupScan) getGroupScan(indexContext.getScan()); List<LogicalExpression> tableCols = Lists.newArrayList(); tableCols.addAll(groupScan.getColumns()); return functionInfo.getIndexDesc().isCoveringIndex(tableCols); }
return functionInfo.getIndexDesc().isCoveringIndex(leftPaths);