use of com.questdb.griffin.lexer.model.IntrinsicModel in project questdb by bluestreak01.
the class QueryFilterAnalyser method extract.
IntrinsicModel extract(AliasTranslator translator, ExprNode node, RecordMetadata m, String preferredKeyColumn, int timestampIndex) throws ParserException {
reset();
this.timestamp = timestampIndex < 0 ? null : m.getColumnName(timestampIndex);
this.preferredKeyColumn = preferredKeyColumn;
IntrinsicModel model = models.next();
if (removeAndIntrinsics(translator, model, node, m)) {
return model;
}
ExprNode root = node;
while (!stack.isEmpty() || node != null) {
if (node != null) {
if (Chars.equals("and", node.token)) {
if (!removeAndIntrinsics(translator, model, node.rhs, m)) {
stack.push(node.rhs);
}
node = removeAndIntrinsics(translator, model, node.lhs, m) ? null : node.lhs;
} else {
node = stack.poll();
}
} else {
node = stack.poll();
}
}
applyKeyExclusions(translator, model);
model.filter = collapseIntrinsicNodes(root);
return model;
}
Aggregations