use of org.apache.ignite.internal.sql.engine.rel.logical.IgniteLogicalIndexScan in project ignite-3 by apache.
the class ExposeIndexRule method onMatch.
/**
* {@inheritDoc}
*/
@Override
public void onMatch(RelOptRuleCall call) {
IgniteLogicalTableScan scan = call.rel(0);
RelOptCluster cluster = scan.getCluster();
RelOptTable optTable = scan.getTable();
InternalIgniteTable igniteTable = optTable.unwrap(InternalIgniteTable.class);
List<RexNode> proj = scan.projects();
RexNode condition = scan.condition();
ImmutableBitSet requiredCols = scan.requiredColumns();
List<IgniteLogicalIndexScan> indexes = igniteTable.indexes().keySet().stream().map(idxName -> igniteTable.toRel(cluster, optTable, idxName, proj, condition, requiredCols)).collect(Collectors.toList());
if (indexes.isEmpty()) {
return;
}
Map<RelNode, RelNode> equivMap = new HashMap<>(indexes.size());
for (int i = 1; i < indexes.size(); i++) {
equivMap.put(indexes.get(i), scan);
}
call.transformTo(indexes.get(0), equivMap);
}
Aggregations