apache / apache/gluten

[CORE] Make `SubstraitContext` immutable

Open
#9,636 0 comments 0 reactions 0 assignees View on GitHub
enhancement
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.