shedar opened a new issue, #28081:
URL: https://github.com/apache/doris/issues/28081

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   2.0.2
   
   ### What's Wrong?
   
   Query `select ... where exists(subquery)` ignores the condition subquery has 
"group by"
   
   ### What You Expected?
   
   "group by" and "having" to be supported in exists subquery
   
   ### How to Reproduce?
   
   ```sql
   create table t1 (
       id int
   )
   UNIQUE KEY (`id`)
   DISTRIBUTED BY HASH(`id`) BUCKETS 1
   PROPERTIES ("replication_allocation" = "tag.location.default: 1");
   
   create table t2 (
       id int,
       t1_id int
   )
   UNIQUE KEY (`id`)
   DISTRIBUTED BY HASH(`id`) BUCKETS 1
   PROPERTIES ("replication_allocation" = "tag.location.default: 1");
   
   insert into t1 (id) values (1),(2),(3),(4),(5),(6);
   insert into t2 (id, t1_id) values (1,1),(2,1),(3,3),(4,5),(5,5),(6,5);
   
   select t1.id from t1 inner join t2 on t1.id = t2.t1_id group by t1.id;
   -- OK: returns 1,3,5 as expected
   select distinct t1.id from t1 where exists(select 1 from t2 where t1.id = 
t2.t1_id);
   -- OK: returns 1,3,5 as expected
   select distinct t1.id from t1 where exists(select 1 from t2 where t1.id = 
t2.t1_id GROUP BY t2.t1_id);
   -- BUG: returns 1,2,3,4,5,6 (all rows); expected 1,3,5
   
   ```
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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

Reply via email to