Skip to content

[EPIC] A collection of items to improve CASE performance #18075

Closed

Activity

  1. added theissue type on Oct 15, 2025
  2. pepijnve commented on Oct 20, 2025

    @pepijnve
    Contributor

    Copying this over from an arrow-rs discord discussion.

    Perhaps we can implement case when more efficiently using interleave. The current implementation strategy builds up a result one branch at a time as in this diagram (I made some mistakes in the labels, but I think the idea is clear enough).

    Diagram Image

    What if instead of merging after every branch we keep the partial results separate and instead update an index Vec<(usize,usize)> as we go. To be able to do that efficiently, we augment the record batch with a "row number" array that gets filtered along with the record batch itself. That gives us the offsets in the index vec to update. When evaluation is complete everything gets bundled up into the final result array with a single interleave operation.

    Diagram Image
  3. rluvaton commented on Oct 20, 2025

    @rluvaton
    Member
  4. rluvaton commented on Oct 21, 2025

    @rluvaton
    Member

    Added another massive case when improvement when the pattern is map like (when "aa" then 1 ...)

    PRs:

    it is 99% faster which means that you won't even notice that there is case when 😄

  5. pepijnve commented on Oct 23, 2025

    @pepijnve
    Contributor

    @alamb could you add #18152 to the description list please?

  6. pepijnve commented on Oct 28, 2025

    @pepijnve
    Contributor

    @rluvaton if you're up for it, next one is ready to go #18329

  7. alamb commented on Nov 19, 2025

    @alamb
    ContributorAuthor

    I am going to claim this particular EPIC is done for reporting purposes (though I realize we still gave #18183 outstanding)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformanceMake DataFusion faster

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions