xzj7019 commented on code in PR #24630:
URL: https://github.com/apache/doris/pull/24630#discussion_r1332628936


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubExprAnalyzer.java:
##########
@@ -72,7 +73,13 @@ public Expression visitNot(Not not, CascadesContext context) 
{
     @Override
     public Expression visitExistsSubquery(Exists exists, CascadesContext 
context) {
         AnalyzedResult analyzedResult = analyzeSubquery(exists);
-
+        if (analyzedResult.rootIsLimitZero()) {
+            return BooleanLiteral.of(exists.isNot());
+        }
+        if (analyzedResult.isCorrelated() && 
analyzedResult.rootIsLimitWithOffset()) {
+            throw new AnalysisException("Unsupported correlated subquery with 
a LIMIT clause with offset > 0 "

Review Comment:
   currently select * from t1 where [not] exists (select * from t2 where t1.c1 
= t2.c1 limit 1 offset 1); will return wrong result.



-- 
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

Reply via email to