use of com.questdb.common.SymbolTable in project questdb by bluestreak01.
the class SymRegexOperator method prepare.
@Override
public void prepare(StorageFacade facade) {
super.prepare(facade);
set.clear();
SymbolTable tab = lhs.getSymbolTable();
for (int i = 0, n = tab.size(); i < n; i++) {
if (matcher.reset(tab.value(i)).find()) {
set.add(i);
}
}
}
use of com.questdb.common.SymbolTable in project questdb by bluestreak01.
the class KvIndexSymListHeadRowSource method prepare.
@Override
public void prepare(ReaderFactory factory, StorageFacade fa, CancellationHandler cancellationHandler) {
if (filter != null) {
filter.prepare(fa);
}
SymbolTable tab = fa.getSymbolTable(columnIndex);
keys.clear();
for (int i = 0, n = values.size(); i < n; i++) {
int k = tab.getQuick(values.get(i));
if (k > -1) {
keys.add(k);
}
}
}
use of com.questdb.common.SymbolTable in project questdb by bluestreak01.
the class AbstractOptimiserTest method assertSymbol.
public static void assertSymbol(String query, int columnIndex) throws ParserException {
try (RecordSource src = compiler.compile(FACTORY_CONTAINER.getFactory(), query)) {
RecordCursor cursor = src.prepareCursor(FACTORY_CONTAINER.getFactory());
try {
SymbolTable tab = cursor.getStorageFacade().getSymbolTable(columnIndex);
while (cursor.hasNext()) {
Record r = cursor.next();
TestUtils.assertEquals(r.getSym(columnIndex), tab.value(r.getInt(columnIndex)));
}
} finally {
cursor.releaseCursor();
}
}
}
use of com.questdb.common.SymbolTable in project questdb by bluestreak01.
the class IntervalFrameCursorTest method assertIndexRowsMatchSymbol.
private static void assertIndexRowsMatchSymbol(DataFrameCursor cursor, TableReaderRecord record, int columnIndex, long expectedCount) {
// SymbolTable is table at table scope, so it will be the same for every
// data frame here. Get its instance outside of data frame loop.
SymbolTable symbolTable = cursor.getSymbolTable(columnIndex);
long rowCount = 0;
while (cursor.hasNext()) {
DataFrame frame = cursor.next();
record.jumpTo(frame.getPartitionIndex(), frame.getRowLo());
final long limit = frame.getRowHi();
final long low = frame.getRowLo();
// BitmapIndex is always at data frame scope, each table can have more than one.
// we have to get BitmapIndexReader instance once for each frame.
BitmapIndexReader indexReader = frame.getBitmapIndexReader(columnIndex);
// because out Symbol column 0 is indexed, frame has to have index.
Assert.assertNotNull(indexReader);
int keyCount = indexReader.getKeyCount();
for (int i = 0; i < keyCount; i++) {
RowCursor ic = indexReader.getCursor(i, limit - 1);
CharSequence expected = symbolTable.value(i - 1);
while (ic.hasNext()) {
long row = ic.next();
if (row < low) {
break;
}
record.setRecordIndex(row);
TestUtils.assertEquals(expected, record.getSym(columnIndex));
rowCount++;
}
}
}
Assert.assertEquals(expectedCount, rowCount);
}
use of com.questdb.common.SymbolTable in project questdb by bluestreak01.
the class AbstractTest method assertSymbol.
public void assertSymbol(String query) throws ParserException {
try (RecordSource src = compiler.compile(getFactory(), query)) {
RecordCursor cursor = src.prepareCursor(getFactory());
try {
SymbolTable tab = cursor.getStorageFacade().getSymbolTable(0);
while (cursor.hasNext()) {
Record r = cursor.next();
TestUtils.assertEquals(r.getSym(0), tab.value(r.getInt(0)));
}
} finally {
cursor.releaseCursor();
}
}
}
Aggregations