yangzhg opened a new issue #3483:
URL: https://github.com/apache/incubator-doris/issues/3483


   if the subquery of case when clause in when condition and it returns empty 
set,  then the whole query return empty set,
   this is because doris rewrite subquery in case when to cross join, if a 
subqery return empty the cross join return empty. 
   e.g. 
   ```
   select case when (select k1 sum from t1 where  k1 <0) > t2. then t2.k1 else 
0 end a from t2;
   ```
   this query will rewrite to 
   ```
   select case when tt.k1 > t2. then t2.k1 else 0 end a from t2, (select k1 sum 
from t1 where  k1 <0 ) as tt;
   ```
   if `select k1 sum from t1 where  k1 <0` is an empty set, then the query is 
empty, but in mysql this returns `else 0` branch as the resulet.
   in doris we can not handle subquery very well, so shoud report an error when 
subquery is empty


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

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