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
FieldsModifier and TypeFieldDescriptionprotected final Set<LogicalExpression> protected final CollationContextprotected final List<LogicalExpression> The indexColumns is the list of column(s) on which this index is created.protected final StringindexName: name of the index that should be unique within the scope of a tableprotected final IndexDefinition.IndexTypeprotected 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.NullDirectionprotected final List<LogicalExpression> protected final String -
Constructor Summary
ConstructorsConstructorDescriptionDrillIndexDefinition(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 TypeMethodDescriptionbooleanallColumnsIndexed(Collection<LogicalExpression> columns) Check if this index have all the columns specified in the supplied list of columns indexedprotected booleancolumnsInIndexFields(Collection<LogicalExpression> columns, Collection<LogicalExpression> indexFields) booleanorg.apache.calcite.rel.RelCollationGet 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 LastintCheck 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.IndexTypeGet the list of columns that are in the 'included' or 'covered' fields.org.apache.calcite.rel.RelFieldCollation.NullDirectionGet 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 withinthashCode()booleanisCoveringIndex(List<LogicalExpression> columns) Check if this index 'covers' all the columns specified in the supplied list of columnsbooleanpathExactIn(SchemaPath path, Collection<LogicalExpression> exprs) booleansomeColumnsIndexed(Collection<LogicalExpression> columns) Check if this index has some columns specified in the supplied list of columns indexedprotected booleansomeColumnsInIndexFields(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:IndexDefinitionCheck to see if the field name is an index column and if so return the ordinal position in the index- Specified by:
getIndexColumnOrdinalin 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:IndexDefinitionCheck if this index 'covers' all the columns specified in the supplied list of columns- Specified by:
isCoveringIndexin interfaceIndexDefinition- Parameters:
columns-- Returns:
- True for covering index, False for non-covering
-
allColumnsIndexed
Description copied from interface:IndexDefinitionCheck if this index have all the columns specified in the supplied list of columns indexed- Specified by:
allColumnsIndexedin interfaceIndexDefinition- Parameters:
columns-- Returns:
- True if all fields are indexed, False for some or all fields is not indexed
-
someColumnsIndexed
Description copied from interface:IndexDefinitionCheck if this index has some columns specified in the supplied list of columns indexed- Specified by:
someColumnsIndexedin interfaceIndexDefinition- Parameters:
columns-- 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:IndexDefinitionGet the name of the index- Specified by:
getIndexNamein interfaceIndexDefinition
-
getTableName
Description copied from interface:IndexDefinitionGet the name of the table this index is associated with- Specified by:
getTableNamein interfaceIndexDefinition
-
getIndexType
Description copied from interface:IndexDefinitionGet the type of this index based onIndexDefinition.IndexType- Specified by:
getIndexTypein interfaceIndexDefinition- Returns:
- one of the values in
IndexDefinition.IndexType
-
getRowKeyColumns
Description copied from interface:IndexDefinitionGet the list of columns (typically 1 column) that constitute the row key (primary key)- Specified by:
getRowKeyColumnsin interfaceIndexDefinition- Returns:
-
getIndexColumns
Description copied from interface:IndexDefinitionGet the list of columns in the index key.- Specified by:
getIndexColumnsin interfaceIndexDefinition
-
getNonIndexColumns
Description copied from interface:IndexDefinitionGet the list of columns that are in the 'included' or 'covered' fields.- Specified by:
getNonIndexColumnsin interfaceIndexDefinition
-
getCollation
public org.apache.calcite.rel.RelCollation getCollation()Description copied from interface:IndexDefinitionGet the collation property (physical ordering) of the index.- Specified by:
getCollationin interfaceIndexDefinition
-
getCollationMap
Description copied from interface:IndexDefinitionGet a mapping of the LogicalExpresion/SchemaPath to its field collation - e.g Ascending/Descending, Nulls First/Nulls Last- Specified by:
getCollationMapin interfaceIndexDefinition
-
getNullsOrderingDirection
public org.apache.calcite.rel.RelFieldCollation.NullDirection getNullsOrderingDirection()Description copied from interface:IndexDefinitionGet the nulls ordering of this index- Specified by:
getNullsOrderingDirectionin interfaceIndexDefinition- Returns:
- True, if nulls first. False otherwise
-