mingmwang commented on PR #6457:
URL: 
https://github.com/apache/arrow-datafusion/pull/6457#issuecomment-1572309442

   > @mingmwang doris don't support `project correlated subquery`
   
   @jackwener 
   Could you please to check this query in Apache Dorics ?
   `select t1.t1_int from t1 where (select count(*) from t2 where t1.t1_id = 
t2.t2_id) < t1.t1_int`
   
   ```
           "Projection: t1.t1_int [t1_int:UInt32;N]",
           "  Filter: CASE WHEN __scalar_sq_1.__always_true IS NULL THEN 
Int64(0) ELSE __scalar_sq_1.COUNT(UInt8(1)) END < CAST(t1.t1_int AS Int64) 
[t1_int:UInt32;N, COUNT(UInt8(1)):Int64;N, __always_true:Boolean;N]",
           "    Projection: t1.t1_int, __scalar_sq_1.COUNT(UInt8(1)), 
__scalar_sq_1.__always_true [t1_int:UInt32;N, COUNT(UInt8(1)):Int64;N, 
__always_true:Boolean;N]",
           "      Left Join: t1.t1_id = __scalar_sq_1.t2_id [t1_id:UInt32;N, 
t1_int:UInt32;N, COUNT(UInt8(1)):Int64;N, t2_id:UInt32;N, 
__always_true:Boolean;N]",
           "        TableScan: t1 projection=[t1_id, t1_int] [t1_id:UInt32;N, 
t1_int:UInt32;N]",
           "        SubqueryAlias: __scalar_sq_1 [COUNT(UInt8(1)):Int64;N, 
t2_id:UInt32;N, __always_true:Boolean]",
           "          Projection: COUNT(UInt8(1)), t2.t2_id, __always_true 
[COUNT(UInt8(1)):Int64;N, t2_id:UInt32;N, __always_true:Boolean]",
           "            Aggregate: groupBy=[[t2.t2_id, Boolean(true) AS 
__always_true]], aggr=[[COUNT(UInt8(1))]] [t2_id:UInt32;N, 
__always_true:Boolean, COUNT(UInt8(1)):Int64;N]",
           "              TableScan: t2 projection=[t2_id] [t2_id:UInt32;N]",
   
   ```
   I think this might also lead to the `count` bug if not handled correctly 
even it is the predicate scalar subquery. 


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

Reply via email to