apache / apache/datafusion

Replace `Box`es with `Arc` in the `Expr` `enum`.

Open
#9,577 17 comments 2 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?

_No response_

### Describe the solution you'd like

According to following stackoverflow [discussion](https://stackoverflow.com/a/76403415/10554257). `Box`s can deep copy when called with `.clone()` method (according to `.clone()` implementation of the underlying type.).

For `Box` this is the case. I think this usage might be the reason of some deep stack usages seen during the planning.

See related issues: [#9375](https://github.com/apache/arrow-datafusion/issues/9375), [#8837](https://github.com/apache/arrow-datafusion/issues/8837).

I think, replacing `Box` usages with `Arc` under the `enum Expr` would improve performance. I am not familiar with the implications of these two approaches in other places. I wonder what community thinks about this change. Would it be better, unnecessary, etc?

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Expr enum and its Box usages, then read related issues #9375 and #8837 and the linked Stack Overflow discussion. Identify the implications of replacing these boxes with Arc across callers and tests; done would require an agreed design and evidence that the change improves the reported stack usage without breaking behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.