apache / apache/datafusion

Null-Aware Anti Join Support

Open
#4,211 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
(This section helps Arrow developers understand the context and *why* for this feature, in addition to the *what*)

For Anti joins, null key values in both sides need to be carefully treated.
http://structureddata.org/2008/05/22/null-aware-anti-join/

When we have an Anti Join(Left Anti or Right Anti), like `A Left Anti Join B on (A.id = B.id)`, the real join conditions
should be `A Left Anti Join B on ((Or(A.id = B.id), IsNull(A.id = B.id)))`, this can not be executed as HashJoins directly.

For left Anti Join, if the right side contains Null values, should return Empty Relation
For right Anti Join, if the left side contains Null values, should return Empty Relation.
For HashJoin, it is relatively easy to implement such logic when the partition mode is CollectLeft, there is challenge when the partition mode is Partitioned.

Section 6: Null-Aware Anti Join (NAAJ)
http://www.vldb.org/pvldb/vol2/vldb09-423.pdf

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Research direction

Start by reading the HashJoin implementation and tracing its CollectLeft and Partitioned modes. Use the linked null-aware anti-join references to define the expected behavior, then verify that left anti joins become empty when the right side has null keys and right anti joins do so when the left side has null keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.