Class IndexSelector
java.lang.Object
org.apache.drill.exec.planner.index.IndexSelector
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
IndexProperties encapsulates the various metrics of a single index that are related to the current query.static class
-
Constructor Summary
ConstructorDescriptionIndexSelector
(org.apache.calcite.rex.RexNode indexCondition, org.apache.calcite.rex.RexNode otherRemainderCondition, IndexCallContext indexContext, IndexCollection collection, org.apache.calcite.rex.RexBuilder rexBuilder, double totalRows) IndexSelector
(IndexCallContext indexContext) This constructor is to build selector for no index condition case (no filter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIndex
(IndexDescriptor indexDesc, boolean isCovering, int numProjectedFields) void
analyzePrefixMatches
(IndexProperties indexProps) This method analyzes an index's columns and starting from the first column, checks which part of the filter condition matches that column.we assume all the indexes added in indexPropList are all applicable (and covering).void
getCandidateIndexes
(IndexConditionInfo.Builder infoBuilder, List<IndexGroup> coveringIndexes, List<IndexGroup> nonCoveringIndexes, List<IndexGroup> intersectIndexes) Run the index selection algorithm and return the top N indexes
-
Constructor Details
-
IndexSelector
public IndexSelector(org.apache.calcite.rex.RexNode indexCondition, org.apache.calcite.rex.RexNode otherRemainderCondition, IndexCallContext indexContext, IndexCollection collection, org.apache.calcite.rex.RexBuilder rexBuilder, double totalRows) -
IndexSelector
This constructor is to build selector for no index condition case (no filter)- Parameters:
indexContext
-
-
-
Method Details
-
addIndex
-
analyzePrefixMatches
This method analyzes an index's columns and starting from the first column, checks which part of the filter condition matches that column. This process continues with subsequent columns. The goal is to identify the portion of the filter condition that match the prefix columns. If there are additional conditions that don't match prefix columns, that condition is set as a remainder condition.- Parameters:
indexProps
-
-
getCandidateIndexes
public void getCandidateIndexes(IndexConditionInfo.Builder infoBuilder, List<IndexGroup> coveringIndexes, List<IndexGroup> nonCoveringIndexes, List<IndexGroup> intersectIndexes) Run the index selection algorithm and return the top N indexes -
getBestIndexNoFilter
we assume all the indexes added in indexPropList are all applicable (and covering). For now this function is used and tested only in IndexScanWithSortOnlyPrule
-