Wan Kun created SPARK-42360:
-------------------------------
Summary: Transform LeftOuter join with IsNull filter on right side
to Anti join
Key: SPARK-42360
URL: https://issues.apache.org/jira/browse/SPARK-42360
Project: Spark
Issue Type: Improvement
Components: SQL
Affects Versions: 3.3.1
Reporter: Wan Kun
Optimize left outer join to anti join if exists IsNull filter on the right side.
For example, query
{code:sql}
SELECT t1.*
FROM t1 LEFT JOIN t2
ON t1.id = t2.id
WHERE t2.id is null and t1.id = 1 and Rand() < 0.5
{code}
can be optimized to
{code:sql}
SELECT t1.*
FROM t1 LEFT ANTI JOIN t2
ON t1.id = t2.id
WHERE t1.id = 1 and Rand() < 0.5
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]