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

   ### 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
   
   版本如下:
   show frontends; --doris-2.1.9-rc02-3390475e02
   show backends; --doris-2.1.9-rc02-3390475e02
   
   ### What's Wrong?
   
   现象:下面第一条sql可以查询出数据,第二条sql也能查询出数据,第三条sql也能查出数据,第四条sql不能查出数据。
   
问题:第一、三、四条sql的结果是对的,第二条sql结果是错误的,因为第一条sql查出结果,第二条肯定是不能查出来的,第三条和第二条互斥,第四条和第二条的逻辑是一样的,怀疑是so_b2c和so_b2c_ref都有id字段,做关联的时候sr.target_id
 = sb2c.id优化成sr.target_id = sr.id导致的。
   select id from so_b2c_ref where is_deleted = false and (target_id = 
'1844549571100737537' or source_id = '1844549571100737537');
   select sb2c.id from so_b2c sb2c where sb2c.id = '1844549571100737537' and 
not exists (select sr.id from so_b2c_ref sr where sr.is_deleted = false and 
(sr.target_id = sb2c.id or sr.source_id = sb2c.id));
   select sb2c.id from so_b2c sb2c where sb2c.id = '1844549571100737537' and 
exists (select sr.id from so_b2c_ref sr where sr.is_deleted = false and 
(sr.target_id = sb2c.id or sr.source_id = sb2c.id));
   select sb2c.id from so_b2c sb2c where sb2c.id = '1844549571100737537' and 
sb2c.id not in (select target_id from so_b2c_ref where is_deleted = false) and 
sb2c.id not in (select source_id from so_b2c_ref where is_deleted = false);
   
   ### What You Expected?
   
   第二条sql查询不出数据
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   No
   
   ### 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