Search in sources :

Example 1 with ExpressionContext

use of com.pingcap.tikv.parser.MySqlParser.ExpressionContext in project tispark by pingcap.

the class AstBuilder method visitLogicalExpression.

public Expression visitLogicalExpression(MySqlParser.LogicalExpressionContext ctx) {
    ExpressionContext left = ctx.expression(0);
    ExpressionContext right = ctx.expression(1);
    switch(ctx.logicalOperator().getText()) {
        case "and":
            return LogicalBinaryExpression.and(visitChildren(left), visitChildren(right));
        case "or":
            return LogicalBinaryExpression.or(visitChildren(left), visitChildren(right));
        case "xor":
            return LogicalBinaryExpression.xor(visitChildren(left), visitChildren(right));
    }
    throw new UnsupportedSyntaxException(ctx.toString() + ": it is not possible reach to this line of code");
}
Also used : UnsupportedSyntaxException(com.pingcap.tikv.exception.UnsupportedSyntaxException) ExpressionContext(com.pingcap.tikv.parser.MySqlParser.ExpressionContext)

Aggregations

UnsupportedSyntaxException (com.pingcap.tikv.exception.UnsupportedSyntaxException)1 ExpressionContext (com.pingcap.tikv.parser.MySqlParser.ExpressionContext)1