@Override public boolean allColumnsIndexed(Collection<LogicalExpression> columns) { return columnsInIndexFields(columns, indexColumns); }
public DrillIndexDescriptor(DrillIndexDefinition def) { this(def.indexColumns, def.indexCollationContext, def.nonIndexColumns, def.rowKeyColumns, def.indexName, def.getTableName(), def.getIndexType(), def.nullsDirection); }
@Override public boolean someColumnsIndexed(Collection<LogicalExpression> columns) { return someColumnsInIndexFields(columns, indexColumns); }
protected boolean columnsInIndexFields(Collection<LogicalExpression> columns, Collection<LogicalExpression> indexFields) { // we need to do extra check, so we could allow the case when query condition expression is not identical with indexed fields // and they still could use the index either by implicit cast or the difference is allowed, e.g. width of varchar for (LogicalExpression col : columns) { if (col instanceof CastExpression) { if (!castIsCompatible((CastExpression) col, indexFields)) { return false; } } else { if (!pathExactIn((SchemaPath)col, indexFields)) { return false; } } } return true;//indexFields.containsAll(columns); }
protected boolean someColumnsInIndexFields(Collection<LogicalExpression> columns, Collection<LogicalExpression> indexFields) { // we need to do extra check, so we could allow the case when query condition expression is not identical with indexed fields // and they still could use the index either by implicit cast or the difference is allowed, e.g. width of varchar for (LogicalExpression col : columns) { if (col instanceof CastExpression) { if (castIsCompatible((CastExpression) col, indexFields)) { return true; } } else { if (pathExactIn((SchemaPath)col, indexFields)) { return true; } } } return false; }