/** * 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); }