use of com.questdb.cairo.TableReader in project questdb by bluestreak01.
the class QueryFilterAnalyserTest method setUp2.
@BeforeClass
public static void setUp2() {
try (TableModel model = new TableModel(configuration, "x", PartitionBy.NONE)) {
model.col("sym", ColumnType.SYMBOL).indexed(true, 16).col("bid", ColumnType.DOUBLE).col("ask", ColumnType.DOUBLE).col("bidSize", ColumnType.INT).col("askSize", ColumnType.INT).col("mode", ColumnType.SYMBOL).indexed(true, 4).col("ex", ColumnType.SYMBOL).indexed(true, 4).timestamp();
CairoTestUtils.create(model);
}
try (TableModel model = new TableModel(configuration, "y", PartitionBy.NONE)) {
model.col("sym", ColumnType.SYMBOL).indexed(true, 16).col("bid", ColumnType.DOUBLE).col("ask", ColumnType.DOUBLE).col("bidSize", ColumnType.INT).col("askSize", ColumnType.INT).col("mode", ColumnType.SYMBOL).indexed(true, 4).col("ex", ColumnType.SYMBOL).indexed(true, 4);
CairoTestUtils.create(model);
}
reader = new TableReader(configuration, "x");
metadata = reader.getMetadata();
noTimestampReader = new TableReader(configuration, "y");
noTimestampmetadata = noTimestampReader.getMetadata();
}
use of com.questdb.cairo.TableReader in project questdb by bluestreak01.
the class QueryModel method getTableMetadata.
public RecordMetadata getTableMetadata(CairoEngine engine, FlyweightCharSequence charSequence) throws ParserException {
// table name must not contain quotes by now
ExprNode readerNode = getTableName();
int lo = 0;
int hi = readerNode.token.length();
if (Chars.startsWith(readerNode.token, NO_ROWID_MARKER)) {
lo += NO_ROWID_MARKER.length();
}
if (lo == hi) {
throw ParserException.$(readerNode.position, "come on, where is table name?");
}
int status = engine.getStatus(readerNode.token, lo, hi);
if (status == TableUtils.TABLE_DOES_NOT_EXIST) {
throw ParserException.$(readerNode.position, "table does not exist");
}
if (status == TableUtils.TABLE_RESERVED) {
throw ParserException.$(readerNode.position, "table directory is of unknown format");
}
try (TableReader r = engine.getReader(charSequence.of(readerNode.token, lo, hi - lo))) {
return r.getMetadata();
} catch (EntryLockedException e) {
throw ParserException.position(readerNode.position).put("table is locked: ").put(charSequence);
} catch (CairoException e) {
throw ParserException.position(readerNode.position).put(e);
}
}
Aggregations