adonis0147 commented on code in PR #10847:
URL: https://github.com/apache/doris/pull/10847#discussion_r920950490
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/ExpressionTranslator.java:
##########
@@ -190,6 +192,25 @@ public Expr visitCompoundPredicate(CompoundPredicate
compoundPredicate, PlanTran
compoundPredicate.child(1).accept(this, context));
}
+ @Override
+ public Expr visitStringRegexPredicate(StringRegexPredicate
stringRegexPredicate, PlanTranslatorContext context) {
+ NodeType nodeType = stringRegexPredicate.getType();
+ org.apache.doris.analysis.LikePredicate.Operator staleOp;
+ switch (nodeType) {
+ case LIKE:
+ staleOp = LikePredicate.Operator.LIKE;
+ break;
+ case REGEXP:
+ staleOp = LikePredicate.Operator.REGEXP;
+ break;
+ default:
+ throw new AnalysisException(String.format("Unknown node type:
%s", nodeType.name()));
+ }
+ return new org.apache.doris.analysis.LikePredicate(staleOp,
+ stringRegexPredicate.child(0).accept(this, context),
+ stringRegexPredicate.child(1).accept(this, context));
Review Comment:
It is better to use `left()` and `right()` instead of `child(0)` and
`child(1)`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]