jayzhan211 commented on code in PR #25560:
URL: https://github.com/apache/datafusion/pull/25560#discussion_r4093315509


##########
datafusion/optimizer/src/decorrelate_predicate_subquery.rs:
##########
@@ -234,7 +297,7 @@ fn in_subquery_value_mark_join(
         .map_or(plan_err!("single expression required."), Ok)?;
     let in_predicate = Expr::eq(expr.clone(), output_expr.clone());
     let Some((matched_plan, matched)) =
-        mark_join(left, subquery, Some(&in_predicate), false, alias)?
+        mark_join(left, subquery, Some(&in_predicate), false, alias, true)?

Review Comment:
   The `matched` mark here is only read by `CASE WHEN matched THEN true`, where 
NULL falls through exactly like FALSE, and UNKNOWN comes from the separate 
`subquery_has_null`/`subquery_non_empty` joins. By the rule this PR states, 
this join doesn't need null-aware. Keeping it pins every projection `x IN 
(subquery)` to CollectLeft and blocks the `RightMark` swap. I tried `false` 
locally: results for `SELECT id, z, id IN (SELECT i.id FROM i WHERE i.z < o.z) 
FROM o` are unchanged, the plan becomes a plain `RightMark` hash join, and the 
null_aware/subquery slt files still pass. Fine to do in a follow-up.
   
   ```diff
        let Some((matched_plan, matched)) =
   -        mark_join(left, subquery, Some(&in_predicate), false, alias, true)?
   +        mark_join(left, subquery, Some(&in_predicate), false, alias, false)?
        else {
   ```



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