LuciferYang opened a new pull request, #12586:
URL: https://github.com/apache/gluten/pull/12586

   ### What changes were proposed in this pull request?
   
   Follow-up dead-code cleanup missed by #12522 (L3 planner-core review R6). 
`GlutenCost` in `extension/columnar/cost/` has always had exactly one 
implementation (`LongCost`), yet was declared as an open `trait` and the 
`costComparator` fell back through a `case _ => throw new 
IllegalStateException("Unexpected cost type")` branch that was unreachable in 
practice.
   
   **Changes**
   
   - Seal the trait: `trait GlutenCost` → `sealed trait GlutenCost`. Scala 2 
requires sealed subclasses to live in the same compilation unit, so `LongCost` 
is co-located in `GlutenCost.scala`.
   - Delete `LongCost.scala` (its contents were merged into `GlutenCost.scala`).
   - Remove the unreachable `case _ => throw new 
IllegalStateException("Unexpected cost type")` branch in 
`LongCostModel.costComparator`. After sealing, `case LongCost(value) => value` 
is exhaustive by construction.
   
   The two other `match` expressions in `LongCostModel` — `sum` and `diff` — 
already destructure `(LongCost(_), LongCost(_))` and remain exhaustive after 
sealing. Downstream imports of `GlutenCost` across `gluten-core`, 
`backends-velox`, and `backends-clickhouse` are unaffected. This is a 
compile-time-only tightening with no behavior change.
   
   ### How was this patch tested?
   
   - `./build/mvn -Pbackends-velox -Pspark-3.5 -pl gluten-core -am test-compile 
-DskipTests`: SUCCESS
   - `./build/mvn -Pbackends-velox -Pspark-3.5 -pl backends-velox -am 
test-compile -DskipTests`: SUCCESS
   - `./build/mvn -Pbackends-clickhouse -Pspark-3.3 -Pdelta -pl 
backends-clickhouse -am test-compile -DskipTests`: SUCCESS
   - `./dev/format-scala-code.sh`: no additional diff
   - Compilation runs under `-Wconf:any:e` (fatal warnings), so exhaustiveness 
of the two remaining `LongCost(_), LongCost(_)` destructure matches is 
compiler-verified after the seal.
   - Verified via `grep -rn 'extends GlutenCost\|with GlutenCost'` that 
`LongCost` is the sole implementation across the whole repository.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude claude-opus-4-7
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to