[VL] Enable RAS planner by default in Velox backend
- Dominant language
- Scala
- Stars
- 1.6k
- Forks
- 657
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 80
Description
RAS planner has been added into code base for 6 months, and it's time to move it forward.
In our company, an internal fallback benchmark, which consists of queries with considerable number of operators that fell back to vanilla Spark (by manually switching the operator off in Gluten or by unsupported expressions), has been showing averagely ~20% overall speedup (for certain queries, up to ~300%) when RAS planner is turned on and a well-tuned RAS cost model is set.
Note the cost model we are testing on internally is still based on hardcoded estimated cost numbers for operators, without reading logical statistics from vanilla Spark. So we still have space to enhance the cost model work in future.
And given that we are now able to align query plans generated between RAS planner and legacy planner with the new default cost model https://github.com/apache/incubator-gluten/pull/6493, it's feasible now to turn on RAS planner for Velox by default.
Note, one of the biggest difference between RAS planner and legacy planner is that RAS planner doesn't support [whole stage fallback](https://github.com/apache/incubator-gluten/blob/37d09c1092a3916a28f23da9b27cc799a8885a5e/shims/common/src/main/scala/org/apache/gluten/GlutenConfig.scala#L1206-L1212). Since RAS planner achieves similar effect via cost model. If you are using that feature and are not prepared moving to RAS, then in your case RAS should be turned off after the change is made. (TODO: raise a warning or error message to user when whole stage fallback and RAS are both enabled)
And note, switching to RAS planner doesn't mean deprecation of legacy columnar rules. In a way RAS is only in charge of the computation offloading part in the entire columnar planning procedure. Regular Spark columnar rules can still be inserted to RAS's columnar rule list. Meanwhile we will soon add a API for backends for inserting RAS rules as well.
Code references:
1. RAS rule applier: https://github.com/apache/incubator-gluten/blob/main/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/enumerated/EnumeratedApplier.scala
2. RAS rule list: https://github.com/apache/incubator-gluten/blob/37d09c1092a3916a28f23da9b27cc799a8885a5e/backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala#L90-L120
Contributor guide
Research direction
Start with the RAS rule applier in gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/enumerated/EnumeratedApplier.scala and the Velox rule list in backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxRuleApi.scala. Review PR 6493 and the existing whole-stage fallback configuration; done means RAS is enabled by default for Velox while legacy columnar rules remain usable and the fallback interaction is addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala, spark
- Domain
- backend-api-design, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100