Search in sources :

Example 1 with LikePredicate

use of io.crate.sql.tree.LikePredicate in project crate by crate.

the class AstBuilder method visitLike.

@Override
public Node visitLike(SqlBaseParser.LikeContext context) {
    Expression escape = null;
    if (context.escape != null) {
        escape = (Expression) visit(context.escape);
    }
    boolean ignoreCase = context.LIKE() == null && context.ILIKE() != null;
    Expression result = new LikePredicate((Expression) visit(context.value), (Expression) visit(context.pattern), escape, ignoreCase);
    if (context.NOT() != null) {
        result = new NotExpression(result);
    }
    return result;
}
Also used : SubscriptExpression(io.crate.sql.tree.SubscriptExpression) IfExpression(io.crate.sql.tree.IfExpression) NotExpression(io.crate.sql.tree.NotExpression) SearchedCaseExpression(io.crate.sql.tree.SearchedCaseExpression) LogicalBinaryExpression(io.crate.sql.tree.LogicalBinaryExpression) ArraySliceExpression(io.crate.sql.tree.ArraySliceExpression) ArraySubQueryExpression(io.crate.sql.tree.ArraySubQueryExpression) SimpleCaseExpression(io.crate.sql.tree.SimpleCaseExpression) SubqueryExpression(io.crate.sql.tree.SubqueryExpression) InListExpression(io.crate.sql.tree.InListExpression) ParameterExpression(io.crate.sql.tree.ParameterExpression) ArrayComparisonExpression(io.crate.sql.tree.ArrayComparisonExpression) Expression(io.crate.sql.tree.Expression) ComparisonExpression(io.crate.sql.tree.ComparisonExpression) ArithmeticExpression(io.crate.sql.tree.ArithmeticExpression) NegativeExpression(io.crate.sql.tree.NegativeExpression) NotExpression(io.crate.sql.tree.NotExpression) ArrayLikePredicate(io.crate.sql.tree.ArrayLikePredicate) LikePredicate(io.crate.sql.tree.LikePredicate)

Aggregations

ArithmeticExpression (io.crate.sql.tree.ArithmeticExpression)1 ArrayComparisonExpression (io.crate.sql.tree.ArrayComparisonExpression)1 ArrayLikePredicate (io.crate.sql.tree.ArrayLikePredicate)1 ArraySliceExpression (io.crate.sql.tree.ArraySliceExpression)1 ArraySubQueryExpression (io.crate.sql.tree.ArraySubQueryExpression)1 ComparisonExpression (io.crate.sql.tree.ComparisonExpression)1 Expression (io.crate.sql.tree.Expression)1 IfExpression (io.crate.sql.tree.IfExpression)1 InListExpression (io.crate.sql.tree.InListExpression)1 LikePredicate (io.crate.sql.tree.LikePredicate)1 LogicalBinaryExpression (io.crate.sql.tree.LogicalBinaryExpression)1 NegativeExpression (io.crate.sql.tree.NegativeExpression)1 NotExpression (io.crate.sql.tree.NotExpression)1 ParameterExpression (io.crate.sql.tree.ParameterExpression)1 SearchedCaseExpression (io.crate.sql.tree.SearchedCaseExpression)1 SimpleCaseExpression (io.crate.sql.tree.SimpleCaseExpression)1 SubqueryExpression (io.crate.sql.tree.SubqueryExpression)1 SubscriptExpression (io.crate.sql.tree.SubscriptExpression)1