[CORE] Make `SubstraitContext` immutable
- Dominant language
- Scala
- Stars
- 1.6k
- Forks
- 657
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 80
Description
`SubstraitContext` is passed across different operators for generating Substrait plan. It's mutable by some APIs ([example](https://github.com/apache/incubator-gluten/blob/e436fa4899eee052a5ed019542d8ce5a4183ffd5/gluten-substrait/src/main/scala/org/apache/gluten/substrait/SubstraitContext.scala#L109-L113)), making it's behavior unpredictable in localized code.
We can do some refactors to make it immutable to ease maintenance and to simplify code. If needed, builder / factory patterns can be added.
Contributor guide
Research direction
Start with gluten-substrait/src/main/scala/org/apache/gluten/substrait/SubstraitContext.scala, especially the mutable APIs around lines 109–113 mentioned in the issue. Trace how SubstraitContext is passed across operators and determine the refactoring scope; done means its behavior is immutable, with builder or factory patterns added if needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100