Search in sources :

Example 1 with IntrinsicModel

use of io.questdb.griffin.model.IntrinsicModel in project questdb by bluestreak01.

the class WhereClauseParser method extract.

IntrinsicModel extract(AliasTranslator translator, ExpressionNode node, RecordMetadata m, CharSequence preferredKeyColumn, int timestampIndex, FunctionParser functionParser, RecordMetadata metadata, SqlExecutionContext executionContext) throws SqlException {
    this.timestamp = timestampIndex < 0 ? null : m.getColumnName(timestampIndex);
    this.preferredKeyColumn = preferredKeyColumn;
    IntrinsicModel model = models.next();
    if (removeAndIntrinsics(translator, model, node, m, functionParser, metadata, executionContext)) {
        return model;
    }
    ExpressionNode root = node;
    while (!stack.isEmpty() || node != null) {
        if (node != null) {
            if (isAndKeyword(node.token)) {
                if (!removeAndIntrinsics(translator, model, node.rhs, m, functionParser, metadata, executionContext)) {
                    stack.push(node.rhs);
                }
                node = removeAndIntrinsics(translator, model, node.lhs, m, functionParser, metadata, executionContext) ? null : node.lhs;
            } else {
                node = stack.poll();
            }
        } else {
            node = stack.poll();
        }
    }
    applyKeyExclusions(translator, model);
    model.filter = collapseIntrinsicNodes(root);
    return model;
}
Also used : ExpressionNode(io.questdb.griffin.model.ExpressionNode) IntrinsicModel(io.questdb.griffin.model.IntrinsicModel)

Aggregations

ExpressionNode (io.questdb.griffin.model.ExpressionNode)1 IntrinsicModel (io.questdb.griffin.model.IntrinsicModel)1