YangShaw commented on code in PR #11264: URL: https://github.com/apache/doris/pull/11264#discussion_r937302880
########## fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/ExpressionTranslator.java: ########## @@ -141,10 +145,48 @@ public Expr visitNullSafeEqual(NullSafeEqual nullSafeEqual, PlanTranslatorContex @Override public Expr visitNot(Not not, PlanTranslatorContext context) { - return new org.apache.doris.analysis.CompoundPredicate( - org.apache.doris.analysis.CompoundPredicate.Operator.NOT, - not.child(0).accept(this, context), - null); + if (not.child() instanceof InPredicate) { + InPredicate inPredicate = (InPredicate) not.child(); + List<Expr> inList = inPredicate.getOptions().stream() + .map(e -> translate(e, context)) + .collect(Collectors.toList()); + return new org.apache.doris.analysis.InPredicate( + inPredicate.getCompareExpr().accept(this, context), + inList, + true); + } else if (not.child() instanceof Like) { + Like like = (Like) not.child(); + LikePredicate likePredicate = (LikePredicate) visitLike(like, context); + CompoundPredicate compoundPredicate = new CompoundPredicate(CompoundPredicate.Operator.NOT, + likePredicate, + null); + return compoundPredicate; + } else if (not.child() instanceof Regexp) { + Regexp regexp = (Regexp) not.child(); + LikePredicate likePredicate = (LikePredicate) visitRegexp(regexp, context); + CompoundPredicate compoundPredicate = new CompoundPredicate(CompoundPredicate.Operator.NOT, + likePredicate, + null); + return compoundPredicate; + } else if (not.child() instanceof Between) { + Between between = (Between) not.child(); + BetweenPredicate betweenPredicate = new BetweenPredicate( + between.getCompareExpr().accept(this, context), + between.getLowerBound().accept(this, context), + between.getUpperBound().accept(this, context), + true); + return betweenPredicate; Review Comment: Yes, I have realized this after ran some queries. I will delete this case and reset visitBetween later. -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org