lowka commented on code in PR #2199:
URL: https://github.com/apache/ignite-3/pull/2199#discussion_r1236762824


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ScannableTableImpl.java:
##########
@@ -63,6 +72,113 @@ public <RowT> Publisher<RowT> scan(ExecutionContext<RowT> 
ctx, PartitionWithTerm
             pub = internalTable.scan(partWithTerm.partId(), txAttributes.id(), 
recipient, null, null, null, 0, null);
         }
 
-        return StorageScanNode.convertPublisher(pub, (item) -> 
rowConverter.toRow(ctx, item, rowFactory, requiredColumns));
+        return new TransformingPublisher<>(pub, item -> 
rowConverter.toRow(ctx, item, rowFactory, requiredColumns));
     }
+
+    /** {@inheritDoc} */
+    @Override
+    public <RowT> Publisher<RowT> indexRangeScan(ExecutionContext<RowT> ctx, 
PartitionWithTerm partWithTerm, RowFactory<RowT> rowFactory,
+            int indexId, String indexName, List<String> columns, @Nullable 
RangeCondition<RowT> cond, @Nullable BitSet requiredColumns) {
+
+        BinaryTupleSchema indexRowSchema = 
RowConverter.createIndexRowSchema(columns, tableDescriptor);
+        TxAttributes txAttributes = ctx.txAttributes();
+
+        Publisher<BinaryRow> pub;
+        BinaryTuplePrefix lower;
+        BinaryTuplePrefix upper;
+
+        int flags = 0;
+
+        if (cond == null) {
+            flags = SortedIndex.INCLUDE_LEFT | SortedIndex.INCLUDE_RIGHT;
+            lower = null;
+            upper = null;
+        } else {
+            lower = toBinaryTuplePrefix(ctx, indexRowSchema, cond.lower(), 
rowFactory);
+            upper = toBinaryTuplePrefix(ctx, indexRowSchema, cond.upper(), 
rowFactory);
+
+            flags |= (cond.lowerInclude()) ? SortedIndex.INCLUDE_LEFT : 0;
+            flags |= (cond.upperInclude()) ? SortedIndex.INCLUDE_RIGHT : 0;
+        }
+
+        if (txAttributes.readOnly()) {
+            pub = internalTable.scan(
+                    partWithTerm.partId(),
+                    txAttributes.time(),
+                    ctx.localNode(),
+                    indexId,
+                    lower,
+                    upper,
+                    flags,
+                    requiredColumns
+            );
+        } else {
+            pub = internalTable.scan(
+                    partWithTerm.partId(),
+                    txAttributes.id(),
+                    new PrimaryReplica(ctx.localNode(), partWithTerm.term()),
+                    indexId,
+                    lower,
+                    upper,
+                    flags,
+                    requiredColumns
+            );
+        }
+
+        return new TransformingPublisher<>(pub, item -> 
rowConverter.toRow(ctx, item, rowFactory, requiredColumns));
+    }
+
+    @Override
+    public <RowT> Publisher<RowT> indexLookup(ExecutionContext<RowT> ctx, 
PartitionWithTerm partWithTerm, RowFactory<RowT> rowFactory,
+            int indexId, String indexName, List<String> columns, RowT key, 
@Nullable BitSet requiredColumns) {

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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to