alex-plekhanov commented on code in PR #10117:
URL: https://github.com/apache/ignite/pull/10117#discussion_r916578233
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/IndexScan.java:
##########
@@ -159,6 +162,47 @@ public IndexScan(
}
}
+ /**
+ * Gets first or last records from all segments.
+ *
+ * @param notNull If {@code true}, null values is skipped.
+ */
+ public List<Row> firstOrLast(boolean first, boolean notNull) {
+ reserve();
+
+ IndexingQueryFilter filter = new IndexingQueryFilterImpl(kctx, topVer,
parts);
+ BPlusTree.TreeRowClosure<IndexRow, IndexRow> rowFilter = notNull ?
+ new BPlusTree.TreeRowClosure<IndexRow, IndexRow>() {
+ /** {@inheritDoc} */
+ @Override public boolean apply(BPlusTree<IndexRow, IndexRow>
tree, BPlusIO<IndexRow> io, long pageAddr,
+ int idx) throws IgniteCheckedException {
+ return
!F.isEmptyOrNulls(indexRow2Row(io.getLookupRow(tree, pageAddr, idx)));
Review Comment:
It's not correct to use some general isEmptyOrNulls, since Row it's an some
abstract type, it can be anything (currently it's only array, but perhaps in
some time in future there will be BinaryObject row available). Let's just check
index row (indexRow.key(0).type = IndexKeyTypes.NULL). Also looks like notNull
is always true, so this parameter is not required.
--
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]