Skip to content

Optimize semi, anti-joins to avoid dynamic dispatch for comparison #22877

Closed

Description

@neilconway

Is your feature request related to a problem or challenge?

The RightSemi/RightAnti existence probe code path (#22828) verifies each candidate build/probe pair via JoinKeyComparator, whose arrow DynComparator is a boxed closure — an indirect call per candidate pair, which also blocks inlining.

We could instead specialize for joins on primitive types and do the type lookup only once per chunk.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. neilconway commented on Jun 10, 2026

    @neilconway
    ContributorAuthor

    take

  2. alamb commented on Jun 10, 2026

    @alamb
    Contributor

    This will make a big improvement. It would be great to find some way to reuse the join key key comparisons across join operators

  3. mbutrovich commented on Jun 10, 2026

    @mbutrovich
    Contributor

    This will make a big improvement. It would be great to find some way to reuse the join key key comparisons across join operators

    Another "I did this already in SMJ" post: #21484 :)

    Looking forward to seeing this in HJ, but #21484 should give an idea of performance win from this change.

  4. neilconway commented on Jun 11, 2026

    @neilconway
    ContributorAuthor

    Sorry for the confusion -- this was actually an issue I created to track a self-TODO while working on the existence probe implementation for semijoins. My initial implementation did a scalar equality comparison as part of the hash chain walk, which is what lead to per-element dynamic dispatch. The revised version does vectorized equality over a chunk of candidate matches, which avoids the per-element dynamic dispatch. So we're good here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions