IndexConditionInfo.Builder infoBuilder = IndexConditionInfo.newBuilder(condition, distFKeyIndexes, builder, scanRel); idxConditionMap = infoBuilder.getIndexConditionMap();
/** * Given a list of Index Expressions(usually indexed fields/functions from one or a set of indexes), * separate a filter condition into * 1), relevant subset of conditions (by relevant, it means at least one given index Expression was found) and, * 2), the rest in remainderCondition * @param relevantPaths * @param condition * @return */ public IndexConditionInfo indexConditionRelatedToFields(List<LogicalExpression> relevantPaths, RexNode condition) { // Use the same filter analyzer that is used for partitioning columns RewriteCombineBinaryOperators reverseVisitor = new RewriteCombineBinaryOperators(true, builder); condition = condition.accept(reverseVisitor); RexSeparator separator = new RexSeparator(relevantPaths, scan, builder); RexNode indexCondition = separator.getSeparatedCondition(condition); if (indexCondition == null) { return new IndexConditionInfo(null, null, false); } List<RexNode> conjuncts = RelOptUtil.conjunctions(condition); List<RexNode> indexConjuncts = RelOptUtil.conjunctions(indexCondition); for (RexNode indexConjunction: indexConjuncts) { RexUtil.removeAll(conjuncts, indexConjunction); } RexNode remainderCondition = RexUtil.composeConjunction(builder, conjuncts, false); indexCondition = indexCondition.accept(reverseVisitor); return new IndexConditionInfo(indexCondition, remainderCondition, true); }
public IndexSelector(RexNode indexCondition, RexNode otherRemainderCondition, IndexCallContext indexContext, IndexCollection collection, RexBuilder rexBuilder, double totalRows) { this.indexCondition = indexCondition; this.otherRemainderCondition = otherRemainderCondition; this.indexContext = indexContext; this.totalRows = totalRows; this.stats = indexContext.getGroupScan().getStatistics(); this.rexBuilder = rexBuilder; this.builder = IndexConditionInfo.newBuilder(indexCondition, collection, rexBuilder, indexContext.getScan()); this.primaryTableScan = indexContext.getScan(); this.indexPropList = Lists.newArrayList(); }
return; IndexConditionInfo.Builder infoBuilder = IndexConditionInfo.newBuilder(condition, collection, builder, indexContext.scan); IndexConditionInfo cInfo = infoBuilder.getCollectiveInfo(indexContext); boolean isValidIndexHint = infoBuilder.isValidIndexHint(indexContext);
IndexConditionInfo.Builder infoBuilder = IndexConditionInfo.newBuilder(condition, distFKeyIndexes, builder, scanRel); idxConditionMap = infoBuilder.getIndexConditionMap();