use of com.questdb.std.ex.JournalException in project questdb by bluestreak01.
the class JournalPartitionSource method prepareCursor.
@Override
@SuppressWarnings("unchecked")
public PartitionCursor prepareCursor(ReaderFactory factory) {
try {
this.journal = factory.reader(metadata);
this.journal.refresh();
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
storageFacade.of(journal.getMetadata());
partitionCount = journal.getPartitionCount();
partitionIndex = 0;
return this;
}
use of com.questdb.std.ex.JournalException in project questdb by bluestreak01.
the class KvIndexStrLambdaHeadRowSource method prepareCursor.
@Override
public RowCursor prepareCursor(PartitionSlice slice) {
try {
Partition partition = rec.partition = slice.partition.open();
KVIndex index = partition.getIndexForColumn(columnIndex);
VariableColumn col = partition.varCol(columnIndex);
long lo = slice.lo - 1;
long hi = slice.calcHi ? partition.size() : slice.hi + 1;
rows.clear();
for (int i = 0, n = hashes.size(); i < n; i++) {
IndexCursor c = index.cursor(hashes.getQuick(i));
while (c.hasNext()) {
long r = rec.rowid = c.next();
if (r > lo && r < hi && Chars.equals(col.getFlyweightStr(r), keys.get(i)) && (filter == null || filter.getBool(rec))) {
rows.add(r);
break;
}
}
}
rows.sort();
cursor = 0;
return this;
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
}
use of com.questdb.std.ex.JournalException in project questdb by bluestreak01.
the class KvIndexSymLambdaHeadRowSource method prepareCursor.
@Override
public RowCursor prepareCursor(PartitionSlice slice) {
try {
Partition partition = rec.partition = slice.partition.open();
KVIndex index = partition.getIndexForColumn(columnIndex);
long lo = slice.lo - 1;
long hi = slice.calcHi ? partition.size() : slice.hi + 1;
rows.clear();
for (int i = 0, n = keys.size(); i < n; i++) {
IndexCursor c = index.cursor(keys.get(i));
while (c.hasNext()) {
long r = rec.rowid = c.next();
if (r > lo && r < hi && (filter == null || filter.getBool(rec))) {
rows.add(r);
break;
}
}
}
rows.sort();
cursor = 0;
return this;
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
}
use of com.questdb.std.ex.JournalException in project questdb by bluestreak01.
the class KvIndexIntLookupRowSource method prepareCursor.
@Override
public RowCursor prepareCursor(PartitionSlice slice) {
try {
column = slice.partition.fixCol(columnIndex);
KVIndex index = slice.partition.getIndexForColumn(columnIndex);
this.indexCursor = newCursor ? index.newFwdCursor(key) : index.fwdCursor(key);
this.lo = slice.lo - 1;
this.hi = slice.calcHi ? slice.partition.open().size() : slice.hi + 1;
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
return this;
}
use of com.questdb.std.ex.JournalException in project questdb by bluestreak01.
the class KvIndexStrListHeadRowSource method prepareCursor.
@Override
public RowCursor prepareCursor(PartitionSlice slice) {
try {
Partition partition = rec.partition = slice.partition.open();
KVIndex index = partition.getIndexForColumn(columnIndex);
VariableColumn col = partition.varCol(columnIndex);
long lo = slice.lo - 1;
long hi = slice.calcHi ? partition.size() : slice.hi + 1;
rows.clear();
for (int i = 0, n = values.size(); i < n; i++) {
IndexCursor c = index.cursor(Hash.boundedHash(values.get(i), buckets));
while (c.hasNext()) {
long r = rec.rowid = c.next();
if (r > lo && r < hi && col.cmpStr(r, values.get(i)) && (filter == null || filter.getBool(rec))) {
rows.add(r);
break;
}
}
}
rows.sort();
keyIndex = 0;
return this;
} catch (JournalException e) {
throw new JournalRuntimeException(e);
}
}
Aggregations