if (first) {
// TODO optimization: this loops through NULL elements
Cursor cursor = find(session, null, null);
while (cursor.next()) {
SearchRow row = cursor.getSearchRow();
Value v = row.getValue(firstColumn.getColumnId());
if (v != ValueNull.INSTANCE) {
return cursor;
}
}
return cursor;
}
Cursor baseCursor = base.findFirstOrLast(session, false);
Cursor deltaCursor = delta.findFirstOrLast(session, false);
MultiVersionCursor cursor = new MultiVersionCursor(session, this, baseCursor, deltaCursor, sync);
cursor.loadCurrent();
// TODO optimization: this loops through NULL elements
while (cursor.previous()) {
SearchRow row = cursor.getSearchRow();
if (row == null) {
break;
}
Value v = row.getValue(firstColumn.getColumnId());
if (v != ValueNull.INSTANCE) {
return cursor;
}
}
return cursor;