use of com.questdb.griffin.common.ExprNode in project questdb by bluestreak01.
the class SqlLexerOptimiser method optimiseBooleanNot.
private void optimiseBooleanNot(QueryModel model) throws ParserException {
ExprNode where = model.getWhereClause();
if (where != null) {
model.setWhereClause(optimiseBooleanNot(where, false));
}
if (model.getNestedModel() != null) {
optimiseBooleanNot(model.getNestedModel());
}
ObjList<QueryModel> joinModels = model.getJoinModels();
for (int i = 1, n = joinModels.size(); i < n; i++) {
optimiseBooleanNot(joinModels.getQuick(i));
}
}
use of com.questdb.griffin.common.ExprNode in project questdb by bluestreak01.
the class SqlLexerOptimiser method addFilterOrEmitJoin.
private void addFilterOrEmitJoin(QueryModel parent, int idx, int ai, CharSequence an, ExprNode ao, int bi, CharSequence bn, ExprNode bo) {
if (ai == bi && Chars.equals(an, bn)) {
deletedContexts.add(idx);
return;
}
if (ai == bi) {
// (same table)
ExprNode node = exprNodePool.next().of(ExprNode.OPERATION, "=", 0, 0);
node.paramCount = 2;
node.lhs = ao;
node.rhs = bo;
addWhereNode(parent, ai, node);
} else {
// (different tables)
JoinContext jc = contextPool.next();
jc.aIndexes.add(ai);
jc.aNames.add(an);
jc.aNodes.add(ao);
jc.bIndexes.add(bi);
jc.bNames.add(bn);
jc.bNodes.add(bo);
jc.slaveIndex = ai > bi ? ai : bi;
jc.parents.add(ai < bi ? ai : bi);
emittedJoinClauses.add(jc);
}
deletedContexts.add(idx);
}
use of com.questdb.griffin.common.ExprNode in project questdb by bluestreak01.
the class SqlLexerOptimiser method parseTimestamp.
private ExprNode parseTimestamp(CharSequence tok) throws ParserException {
if (Chars.equalsNc("timestamp", tok)) {
expectTok('(');
final ExprNode result = expectLiteral();
expectTok(')');
return result;
}
return null;
}
use of com.questdb.griffin.common.ExprNode in project questdb by bluestreak01.
the class SqlLexerOptimiser method concatFilters.
private ExprNode concatFilters(ExprNode old, ExprNode filter) {
if (old == null) {
return filter;
} else {
ExprNode n = exprNodePool.next().of(ExprNode.OPERATION, "and", 0, 0);
n.paramCount = 2;
n.lhs = old;
n.rhs = filter;
return n;
}
}
use of com.questdb.griffin.common.ExprNode in project questdb by bluestreak01.
the class SqlLexerOptimiser method makeOperation.
private ExprNode makeOperation(CharSequence token, ExprNode lhs, ExprNode rhs) {
ExprNode expr = exprNodePool.next().of(ExprNode.OPERATION, token, 0, 0);
expr.paramCount = 2;
expr.lhs = lhs;
expr.rhs = rhs;
return expr;
}
Aggregations