Vladsz83 commented on code in PR #10153:
URL: https://github.com/apache/ignite/pull/10153#discussion_r994269116
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java:
##########
@@ -428,6 +429,44 @@ public LogicalRelImplementor(
}
}
+ /** {@inheritDoc} */
+ @Override public Node<Row> visit(IgniteIndexBound rel) {
+ IgniteTable tbl = rel.getTable().unwrap(IgniteTable.class);
+ IgniteIndex idx = tbl.getIndex(rel.indexName());
+ IgniteTypeFactory typeFactory = ctx.getTypeFactory();
+ ColocationGroup grp = ctx.group(rel.sourceId());
+ ImmutableBitSet requiredColumns = rel.requiredColumns();
+ RelDataType rowType = tbl.getRowType(typeFactory, requiredColumns);
+
+ if (idx != null && !tbl.isIndexRebuildInProgress()) {
+ return new ScanNode<>(ctx, rowType,
idx.findFirstOrLast(rel.first(), ctx, ctx.group(rel.sourceId()),
+ requiredColumns));
+ }
+ else {
+ Iterable<Row> rowsIter = tbl.scan(
+ ctx,
+ grp,
+ null,
+ null,
+ rel.requiredColumns()
+ );
+
+ Node<Row> scanNode = new ScanNode<>(ctx, rowType, rowsIter);
+
+ RelCollation collation =
idx.collation().apply(LogicalScanConverterRule.createMapping(
+ null,
+ requiredColumns,
+ tbl.getRowType(typeFactory).getFieldCount()
+ ));
+
+ SortNode<Row> sortNode = new SortNode<>(ctx, rowType,
expressionFactory.comparator(collation));
Review Comment:
Fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]