You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/06/27 13:43:24 UTC
[GitHub] [doris] morrySnow commented on a diff in pull request #10411: [feature](nereids) support like and regexp predicate
morrySnow commented on code in PR #10411:
URL: https://github.com/apache/doris/pull/10411#discussion_r907406194
##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -178,6 +178,7 @@ booleanExpression
predicate
: NOT? kind=BETWEEN lower=valueExpression AND upper=valueExpression
+ | NOT? kind=(LIKE | REGEXP) pattern=valueExpression
Review Comment:
we have RLIKE in DorisLexer.g4 represent both 'RLIKE' and 'REGEXP'
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -576,6 +582,38 @@ public Expression withBetween(PredicateContext ctx, Expression e) {
return isNotBetween ? new Not(betweenPredicate) : betweenPredicate;
}
+ /**
+ * Generate like predicate.
+ *
+ * @param ctx PredicateContext
+ * @param e Expression
+ * @return Expression
+ */
+ public Expression withLike(PredicateContext ctx, Expression e) {
+ boolean isNotLike = ctx.NOT() != null ? true : false;
+ LikePredicate likePredicate = new LikePredicate(
+ e,
+ expression(ctx.pattern)
+ );
+ return isNotLike ? new Not(likePredicate) : likePredicate;
Review Comment:
in another pr, we refactor this and generate process in withPredicate
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org