Class DrillIndexDefinition
java.lang.Object
org.apache.drill.exec.planner.index.DrillIndexDefinition
- All Implemented Interfaces:
IndexDefinition
- Direct Known Subclasses:
AbstractIndexDescriptor
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.drill.exec.planner.index.IndexDefinition
IndexDefinition.IndexType
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Set<LogicalExpression>
protected final CollationContext
protected final List<LogicalExpression>
The indexColumns is the list of column(s) on which this index is created.protected final String
indexName: name of the index that should be unique within the scope of a tableprotected final IndexDefinition.IndexType
protected final List<LogicalExpression>
nonIndexColumns: the list of columns that are included in the index as 'covering' columns but are not themselves indexed.protected final org.apache.calcite.rel.RelFieldCollation.NullDirection
protected final List<LogicalExpression>
protected final String
-
Constructor Summary
ConstructorDescriptionDrillIndexDefinition
(List<LogicalExpression> indexCols, CollationContext indexCollationContext, List<LogicalExpression> nonIndexCols, List<LogicalExpression> rowKeyColumns, String indexName, String tableName, IndexDefinition.IndexType type, org.apache.calcite.rel.RelFieldCollation.NullDirection nullsDirection) -
Method Summary
Modifier and TypeMethodDescriptionboolean
allColumnsIndexed
(Collection<LogicalExpression> columns) Check if this index have all the columns specified in the supplied list of columns indexedprotected boolean
columnsInIndexFields
(Collection<LogicalExpression> columns, Collection<LogicalExpression> indexFields) boolean
org.apache.calcite.rel.RelCollation
Get the collation property (physical ordering) of the index.Map<LogicalExpression,
org.apache.calcite.rel.RelFieldCollation> Get a mapping of the LogicalExpresion/SchemaPath to its field collation - e.g Ascending/Descending, Nulls First/Nulls Lastint
Check to see if the field name is an index column and if so return the ordinal position in the indexGet the list of columns in the index key.Get the name of the indexGet the type of this index based onIndexDefinition.IndexType
Get the list of columns that are in the 'included' or 'covered' fields.org.apache.calcite.rel.RelFieldCollation.NullDirection
Get the nulls ordering of this indexGet the list of columns (typically 1 column) that constitute the row key (primary key)Get the name of the table this index is associated withint
hashCode()
boolean
isCoveringIndex
(List<LogicalExpression> columns) Check if this index 'covers' all the columns specified in the supplied list of columnsboolean
pathExactIn
(SchemaPath path, Collection<LogicalExpression> exprs) boolean
someColumnsIndexed
(Collection<LogicalExpression> columns) Check if this index has some columns specified in the supplied list of columns indexedprotected boolean
someColumnsInIndexFields
(Collection<LogicalExpression> columns, Collection<LogicalExpression> indexFields) toString()
-
Field Details
-
indexColumns
The indexColumns is the list of column(s) on which this index is created. If there is more than 1 column, the order of the columns is important: index on {a, b} is not the same as index on {b, a} NOTE: the indexed column could be of type columnfamily.column -
nonIndexColumns
nonIndexColumns: the list of columns that are included in the index as 'covering' columns but are not themselves indexed. These are useful for covering indexes where the query request can be satisfied directly by the index and avoid accessing the table altogether. -
allIndexColumns
-
rowKeyColumns
-
indexCollationContext
-
indexName
indexName: name of the index that should be unique within the scope of a table -
tableName
-
indexType
-
nullsDirection
protected final org.apache.calcite.rel.RelFieldCollation.NullDirection nullsDirection
-
-
Constructor Details
-
DrillIndexDefinition
public DrillIndexDefinition(List<LogicalExpression> indexCols, CollationContext indexCollationContext, List<LogicalExpression> nonIndexCols, List<LogicalExpression> rowKeyColumns, String indexName, String tableName, IndexDefinition.IndexType type, org.apache.calcite.rel.RelFieldCollation.NullDirection nullsDirection)
-
-
Method Details
-
getIndexColumnOrdinal
Description copied from interface:IndexDefinition
Check to see if the field name is an index column and if so return the ordinal position in the index- Specified by:
getIndexColumnOrdinal
in interfaceIndexDefinition
- Parameters:
path
- The field path you want to compare to index column names.- Returns:
- Return ordinal of the indexed column if valid, otherwise return -1
-
isCoveringIndex
Description copied from interface:IndexDefinition
Check if this index 'covers' all the columns specified in the supplied list of columns- Specified by:
isCoveringIndex
in interfaceIndexDefinition
- Returns:
- True for covering index, False for non-covering
-
allColumnsIndexed
Description copied from interface:IndexDefinition
Check if this index have all the columns specified in the supplied list of columns indexed- Specified by:
allColumnsIndexed
in interfaceIndexDefinition
- Returns:
- True if all fields are indexed, False for some or all fields is not indexed
-
someColumnsIndexed
Description copied from interface:IndexDefinition
Check if this index has some columns specified in the supplied list of columns indexed- Specified by:
someColumnsIndexed
in interfaceIndexDefinition
- Returns:
- True if some fields are indexed, False if none of the fields are indexed
-
pathExactIn
-
columnsInIndexFields
protected boolean columnsInIndexFields(Collection<LogicalExpression> columns, Collection<LogicalExpression> indexFields) -
someColumnsInIndexFields
protected boolean someColumnsInIndexFields(Collection<LogicalExpression> columns, Collection<LogicalExpression> indexFields) -
toString
-
equals
-
hashCode
public int hashCode() -
getIndexName
Description copied from interface:IndexDefinition
Get the name of the index- Specified by:
getIndexName
in interfaceIndexDefinition
-
getTableName
Description copied from interface:IndexDefinition
Get the name of the table this index is associated with- Specified by:
getTableName
in interfaceIndexDefinition
-
getIndexType
Description copied from interface:IndexDefinition
Get the type of this index based onIndexDefinition.IndexType
- Specified by:
getIndexType
in interfaceIndexDefinition
- Returns:
- one of the values in
IndexDefinition.IndexType
-
getRowKeyColumns
Description copied from interface:IndexDefinition
Get the list of columns (typically 1 column) that constitute the row key (primary key)- Specified by:
getRowKeyColumns
in interfaceIndexDefinition
- Returns:
-
getIndexColumns
Description copied from interface:IndexDefinition
Get the list of columns in the index key.- Specified by:
getIndexColumns
in interfaceIndexDefinition
-
getNonIndexColumns
Description copied from interface:IndexDefinition
Get the list of columns that are in the 'included' or 'covered' fields.- Specified by:
getNonIndexColumns
in interfaceIndexDefinition
-
getCollation
public org.apache.calcite.rel.RelCollation getCollation()Description copied from interface:IndexDefinition
Get the collation property (physical ordering) of the index.- Specified by:
getCollation
in interfaceIndexDefinition
-
getCollationMap
Description copied from interface:IndexDefinition
Get a mapping of the LogicalExpresion/SchemaPath to its field collation - e.g Ascending/Descending, Nulls First/Nulls Last- Specified by:
getCollationMap
in interfaceIndexDefinition
-
getNullsOrderingDirection
public org.apache.calcite.rel.RelFieldCollation.NullDirection getNullsOrderingDirection()Description copied from interface:IndexDefinition
Get the nulls ordering of this index- Specified by:
getNullsOrderingDirection
in interfaceIndexDefinition
- Returns:
- True, if nulls first. False otherwise
-