use of com.questdb.ql.sys.SystemViewFactory in project questdb by bluestreak01.
the class QueryModel method collectJournalMetadata.
public RecordMetadata collectJournalMetadata(Factory factory) throws ParserException {
if (journalMetadata != null) {
return journalMetadata;
}
ExprNode readerNode = getJournalName();
if (readerNode.type != ExprNode.LITERAL && readerNode.type != ExprNode.CONSTANT) {
throw QueryError.$(readerNode.position, "Journal name must be either literal or string constant");
}
String reader = stripMarker(Chars.stripQuotes(readerNode.token));
SystemViewFactory systemViewFactory = SysFactories.getFactory(reader);
if (systemViewFactory != null) {
return systemViewFactory.getMetadata();
}
int status = factory.getConfiguration().exists(reader);
if (status == JournalConfiguration.DOES_NOT_EXIST) {
throw QueryError.$(readerNode.position, "Journal does not exist");
}
if (status == JournalConfiguration.EXISTS_FOREIGN) {
throw QueryError.$(readerNode.position, "Journal directory is of unknown format");
}
try {
return journalMetadata = factory.getConfiguration().readMetadata(reader);
} catch (JournalException e) {
throw QueryError.$(readerNode.position, e.getMessage());
}
}
Aggregations