shehabgamin opened a new issue, #27225:
URL: https://github.com/apache/datafusion/issues/27225

   ### Describe the bug
   
   `JoinSelection` turns a `HashJoinExec` into a `SymmetricHashJoinExec` when 
both inputs are unbounded. It does this without checking `null_aware`. 
`SymmetricHashJoinExec` has no null-aware mode, so the flag is dropped and a 
`NOT IN` join becomes a plain anti join. A NULL in the subquery, or a NULL 
outer value, no longer gives SQL `NOT IN` semantics, so the query can return 
rows it should not.
   
   ### To Reproduce
   
   Build a null-aware `LeftAnti` `HashJoinExec` over two unbounded inputs and 
run `JoinSelection` on it. The result is a `SymmetricHashJoinExec`, and the 
null-aware behavior is gone.
   
   ```rust
   let join = HashJoinExec::try_new(
       left, right, on, None, &JoinType::LeftAnti, None,
       PartitionMode::CollectLeft, NullEquality::NullEqualsNothing,
       true, // null_aware
   )?;
   let optimized = JoinSelection::new().optimize(Arc::new(join), 
&ConfigOptions::new())?;
   // optimized is a SymmetricHashJoinExec
   ```
   
   ### Expected behavior
   
   A null-aware join stays a `HashJoinExec`, the only join that implements 
null-aware semantics for this case.
   
   ### Additional context
   
   _No response_
   
   ### Willingness to contribute
   
   I plan to contribute a fix for this bug independently


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