Xiao-zhen-Liu opened a new pull request, #6729:
URL: https://github.com/apache/texera/pull/6729

   ### What changes were proposed in this PR?
   
   This adds the `CACHE_REUSED` workflow-aggregated state and the statistics 
handling for a cached region. It is the state-and-stats slice of the operator 
output port result cache (MVP). It lands dormant and does not change behavior 
on an empty cache.
   
   - Add `CACHE_REUSED = 11` to the `WorkflowAggregatedState` enum, mapped in 
`Utils` to a display string (`CacheReused`), a parse case, and DB status code 
`6`.
   - `ExecutionUtils.aggregateStates` takes an optional `cachedState`; when 
every state in the group equals it, the group rolls up to `CACHE_REUSED`. It 
defaults to `None`, so every existing caller is unchanged. Only the 
operator-level `aggregateMetrics` passes it.
   - `ExecutionUtils.aggregatePortMetrics` treats a negative count/size as an 
unknown value and keeps the aggregated port metrics unknown; 
`ExecutionUtils.sumNonNegative` skips those sentinels when 
`ExecutionStatsService` sums operator totals. A cached input port has no live 
tuple count, so it carries this unknown marker.
   
   Empty-cache safety: with an empty cache nothing produces `CACHE_REUSED` or a 
negative tuple count, so `cachedState` stays `None` (the new branch is 
unreachable) and every count is non-negative (both sentinel paths are 
identity). The enum value is appended with no renumber, and the only code that 
matches on the enum (`Utils`) has catch-alls. The engine behaves identically to 
today until a later PR marks operators as reused from cache.
   
   ### Any related issues, documentation, discussions?
   
   Closes #5883. Part of #5881 (operator output port result cache, MVP). Design 
discussion: #5880.
   
   ### How was this PR tested?
   
   Added unit tests. `ExecutionUtilsSpec` covers the `cachedState` branch 
(all-cached rolls up to `CACHE_REUSED`, branch precedence over 
completed/terminated/running, and the empty-cache regression that the optional 
argument is byte-identical to the existing overload when no cached state is 
present), the `-1` unknown-port sentinel in `aggregatePortMetrics`, its 
propagation through `aggregateMetrics`, and `sumNonNegative`. `UtilsSpec` 
covers the display and parse round-trip, the status code `6`, and that it is 
distinct from `COMPLETED`. The two specs pass (63 cases), and 
`scalafmtCheckAll` is clean.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 4.8 (Claude Code)
   


-- 
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]

Reply via email to