anshulbaliga7 opened a new pull request, #58077: URL: https://github.com/apache/spark/pull/58077
### What changes were proposed in this pull request? Fix `InSubqueryExec.nullable` to account for whether the subquery output can produce NULLs, not just whether the child expression is nullable. ### Why are the changes needed? `x IN (subquery)` evaluates to UNKNOWN when no match is found and the subquery result contains NULL. `InSubqueryExec.nullable` was declared as `child.nullable`, ignoring the subquery output nullability. This caused codegen to emit `isNull = false` unconditionally, computing `!false = true` instead of UNKNOWN for `NOT IN` expressions, returning wrong results. The interpreted path was correct because it always checks the runtime null value regardless of the declared nullability, which is why `spark.sql.codegen.factoryMode=NO_CODEGEN` returned correct results. ### Does this PR introduce any user-facing change? Yes. Queries using `NOT IN (subquery)` with NULLs in the subquery result on FULL OUTER JOIN conditions now return correct results. ### How was this patch tested? Added regression test in `SubquerySuite` using `checkAnswer` with actual null-padded rows, and SQL golden file test in `in-joins.sql`. ### Was this patch authored or co-authored using generative AI tooling? No -- 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]
