Skip to content

feat: keep and send the results of every output port - #9271

Open
sshiv012 wants to merge 5 commits into
apache:mainfrom
sshiv012:sshiv012/result-port-1-store
Open

sshiv012 wants to merge 5 commits into
apache:mainfrom
sshiv012:sshiv012/result-port-1-store

Conversation

@sshiv012

@sshiv012 sshiv012 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

An operator's result was tracked and sent for its first output port only. WorkflowResultStore was keyed by operator, and WebResultUpdateEvent carried one update and one set of table statistics per operator. The frontend paged any other port on request and re-read it on a timer. This PR sends every external output port through the same path, with no special case for port 0. It folds in #9272, as suggested in review.

Backend

  • WorkflowResultStore is keyed by GlobalPortIdentity; internal ports are left out.
  • onResultUpdate records result_size and result_count in operator_port_executions for every table port, not only port 0. This builds on feat(amber): record each result port's output mode and row count #9049's updateResultSizeAndCount.
  • WebResultUpdateEvent keys both updates and tableStats by operator id, then by output port index, for every port including 0. There is no separate portUpdates field. Each port uses its own output mode and its own table statistics.
{ "updates":    { "Split-1": { "0": {...}, "1": {...} } },
  "tableStats": { "Split-1": { "0": {...}, "1": {...} } } }

Frontend

  • WorkflowResultService keeps one map of paged results and one of visualization results, both keyed "op:port". getPaginatedResultService, getResultService, hasAnyResult and similar getters take a portIndex that defaults to 0. getPortPaginatedResultService is removed.
  • OperatorPaginationResultService uses the same page cache, live updates, statistics and requests for every port.
  • ResultTableFrameComponent follows the updates and statistics of the port it shows. So the pinned window's port tabs (feat(frontend): pin an operator's result beside it, with a tab per output port #9063) no longer re-read a later port on a timer or when the operator completes.

Compatibility

The websocket message shape changes: an operator's update is now nested under its port index. The frontend and backend ship together, so nothing else reads it. Nothing stored changes: operator_port_executions keeps the same columns, and saved workflows are untouched.

Any related issues, documentation, discussions?

Related: discussion #8914. Supersedes #9272. Builds on #9049 and #9063.

How was this PR tested?

  • Scala: ExecutionResultServiceSpec (42), TexeraWebSocketEventSpec (11), WorkflowResultStoreSpec (7) and WorkflowServiceSpec (11, with STORAGE_WAREHOUSE_ENABLED=false). The new tests cover:
    • every port landing in updates, keyed by port;
    • per-port table statistics, and none for an HTML port;
    • only changed ports being sent;
    • each table port's size and row count being recorded.
  • Frontend: full ng test suite (254 files) passes, with new per-port tests for WorkflowResultService, OperatorPaginationResultService and ResultTableFrameComponent.

Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SRmgtBces67YppgKLHoZHa

@Yicong-Huang Yicong-Huang added the release/v1.3 back porting to release/v1.3 label Nov 3, 2026
@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Nov 3, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 November 3, 2026 05:25
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
✅ release/v1.3 Already labeled — this fix is queued to backport here. @mengw15 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other.
✅ release/v1.2 Already labeled — this fix is queued to backport here. @xuang7 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other.

Auto-label run.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @kz930, @aglinxinyuan, @mengw15
    You can notify them by mentioning @kz930, @aglinxinyuan, @mengw15 in a comment.

@sshiv012 sshiv012 changed the title fix(amber): keep result metadata per output port feat(amber): keep result metadata per output port Nov 3, 2026
@sshiv012
sshiv012 force-pushed the sshiv012/result-port-1-store branch from 49a1693 to c2d2848 Compare November 3, 2026 05:27
@codecov-commenter

codecov-commenter commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.57%. Comparing base (bf6bf9f) to head (cef08c8).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9271   +/-   ##
=========================================
  Coverage     91.57%   91.57%           
- Complexity     5182     5184    +2     
=========================================
  Files          1300     1300           
  Lines         58131    58074   -57     
  Branches       7615     7610    -5     
=========================================
- Hits          53235    53183   -52     
+ Misses         2958     2954    -4     
+ Partials       1938     1937    -1     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.55% <ø> (-0.01%) ⬇️ Carriedforward from 82cea12
amber 85.46% <100.00%> (+<0.01%) ⬆️
computing-unit-managing-service 63.88% <ø> (ø)
config-service 87.50% <ø> (ø)
file-service 82.16% <ø> (ø)
frontend 96.45% <100.00%> (-0.01%) ⬇️
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.50% <ø> (+0.11%) ⬆️ Carriedforward from 82cea12
result-service 85.71% <ø> (ø)
workflow-compiling-service 78.30% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 3 better · 🔴 6 worse · ⚪ 6 noise (<±5%) · 0 without baseline

Compared against main bf6bf9f benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 710 0.433 11,822/21,953/21,953 us 🟢 -14.4% / 🔴 +58.4%
🟢 bs=100 sw=10 sl=64 1,690 1.031 57,588/76,765/76,765 us 🟢 -13.3% / 🟢 -28.2%
🔴 bs=1000 sw=10 sl=64 2,059 1.256 474,208/665,702/665,702 us 🔴 +22.9% / 🟢 +46.4%
Baseline details

Latest main bf6bf9f from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 710 tuples/sec 749 tuples/sec 1,019 tuples/sec -5.2% -30.4%
bs=10 sw=10 sl=64 MB/s 0.433 MB/s 0.457 MB/s 0.622 MB/s -5.3% -30.4%
bs=10 sw=10 sl=64 p50 11,822 us 13,807 us 10,136 us -14.4% +16.6%
bs=10 sw=10 sl=64 p95 21,953 us 20,526 us 13,860 us +7.0% +58.4%
bs=10 sw=10 sl=64 p99 21,953 us 20,526 us 16,484 us +7.0% +33.2%
bs=100 sw=10 sl=64 throughput 1,690 tuples/sec 1,630 tuples/sec 1,363 tuples/sec +3.7% +24.0%
bs=100 sw=10 sl=64 MB/s 1.031 MB/s 0.995 MB/s 0.832 MB/s +3.6% +23.9%
bs=100 sw=10 sl=64 p50 57,588 us 56,525 us 79,194 us +1.9% -27.3%
bs=100 sw=10 sl=64 p95 76,765 us 88,532 us 87,022 us -13.3% -11.8%
bs=100 sw=10 sl=64 p99 76,765 us 88,532 us 106,894 us -13.3% -28.2%
bs=1000 sw=10 sl=64 throughput 2,059 tuples/sec 2,029 tuples/sec 1,407 tuples/sec +1.5% +46.4%
bs=1000 sw=10 sl=64 MB/s 1.256 MB/s 1.238 MB/s 0.859 MB/s +1.5% +46.3%
bs=1000 sw=10 sl=64 p50 474,208 us 490,710 us 776,422 us -3.4% -38.9%
bs=1000 sw=10 sl=64 p95 665,702 us 541,787 us 814,091 us +22.9% -18.2%
bs=1000 sw=10 sl=64 p99 665,702 us 541,787 us 860,577 us +22.9% -22.6%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,281.79,200,128000,710,0.433,11821.55,21952.76,21952.76
1,100,10,64,20,1183.44,2000,1280000,1690,1.031,57587.65,76764.71,76764.71
2,1000,10,64,20,9715.62,20000,12800000,2059,1.256,474207.58,665701.76,665701.76

@sshiv012
sshiv012 marked this pull request as ready for review November 4, 2026 22:04
@sshiv012

sshiv012 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@Xiao-zhen-Liu please remove release 1.2/1.3 labels if you can! I mentioned fix and it got tagged.

@mengw15 mengw15 removed the release/v1.3 back porting to release/v1.3 label Nov 9, 2026
@Xiao-zhen-Liu
Xiao-zhen-Liu requested review from Xiao-zhen-Liu and removed request for mengw15 and xuang7 November 11, 2026 02:29
@Xiao-zhen-Liu Xiao-zhen-Liu removed the release/v1.2 back porting to release/v1.2 label Nov 12, 2026

@Xiao-zhen-Liu Xiao-zhen-Liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for breaking this out cleanly and rebasing onto main, @sshiv012! Keying WorkflowResultStore by GlobalPortIdentity (excluding internal ports), looking up each port's output mode via outputModeOf, and recording result_size per table port in operator_port_executions all look great.

Looking at #9271 together with #9272 (and #9054), one design question comes up: the result pipeline still special-cases port 0 (isFirstPort = portId == PortIdentity() in ExecutionResultService.scala and portIndex === 0 in workflow-result.service.ts) and adds a separate path in #9272 for ports >= 1. Ideally, the result logic should be generic to any output port rather than specific to the first port:

Layer Port-0-special-cased split (#9054 + #9271 + #9272) on Split-1 (port 0: 3 rows, port 1: 12 rows) Port-generic design
Backend diff handler (ExecutionResultService.scala) Checks if (isFirstPort). #9271 drops result updates and tableStats for port 1; #9272 routes port 0 to updates and port 1 to portUpdates, and still skips tableStats for port 1. Drop isFirstPort so every changed external output port (opId, portId) writes convertWebResultUpdate and (when outputMode != SINGLE_SNAPSHOT) getTableStatistics into the same per-port maps.
Websocket event (WebResultUpdateEvent.scala) Splits port 0 (updates, tableStats keyed by opId) from later ports (portUpdates keyed by opId -> portIndex, with no stats for later ports). Key both fields uniformly by opId -> portIndex for all ports (including port 0): updates: Map[String, Map[Int, WebResultUpdate]] and tableStats: Map[String, Map[Int, Map[String, Map[String, Any]]]] (without a separate portUpdates field).
Frontend result service (workflow-result.service.ts) Keeps paginatedResultServices, operatorResultServices, and resultUpdateStream for port 0 alongside otherPortResultServices, otherPortDataServices, livePaginatedPorts, and portResultUpdateStream for ports >= 1, branching on portIndex === 0. Keep one map per output kind keyed by portKey(operatorID, portIndex) ("Split-1:0", "Split-1:1"), one update handler, and default portIndex: number = 0 on existing getters (getPaginatedResultService(opId, portIndex = 0)).
Frontend pagination cache (OperatorPaginationResultService) Disables resultCache when this.portIndex !== 0 (useCache = this.portIndex === 0 && ...), sets currentTotalNumTuples in handlePaginationResult only when portIndex !== 0, and omits portIndex on requests for port 0. Since every port receives live WebPaginationUpdate (totalNumTuples and dirtyPageIndices) and tableStats, use the same resultCache, handleResultUpdate, handleStatsUpdate, and ResultPaginationRequest logic for every portIndex.

Since the isFirstPort branch in #9271 is only needed while WebResultUpdateEvent remains keyed by operator ID alone, could we either update WebResultUpdateEvent and WorkflowResultService to the uniform per-port structure here or fold #9272 into this PR so we can avoid introducing the port-0 special case? I also left a few small inline notes below, and removed the accidental release/v1.2 label so the backport check clears.

An operator's result was tracked and sent for its first output port only:
WorkflowResultStore was keyed by operator, WebResultUpdateEvent carried one
update and one set of table statistics per operator, and the frontend paged
any other port on request and re-read it on a timer. Every external output
port now goes through the same path.

- WorkflowResultStore is keyed by GlobalPortIdentity; internal ports are left
  out.
- onResultUpdate records result_size and result_count in
  operator_port_executions for every table port, not only port 0.
- WebResultUpdateEvent keys `updates` and `tableStats` by operator id, then by
  output port index, for every port including 0. Each port uses its own
  output mode and its own table statistics.
- WorkflowResultService keeps one map of paged results and one of
  visualization results, both keyed by operator and port; the getters take a
  port index that defaults to 0. Every port uses the same page cache, live
  updates and statistics.
- The result table follows the updates and statistics of the port it shows,
  so it no longer re-reads a later port's page on a timer or on completion.

Related: apache/texera discussion apache#8914.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SRmgtBces67YppgKLHoZHa
@sshiv012
sshiv012 force-pushed the sshiv012/result-port-1-store branch from 81cb1d2 to 60f03c7 Compare November 19, 2026 05:02
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Nov 19, 2026
@sshiv012 sshiv012 changed the title feat(amber): keep result metadata per output port feat: keep and send the results of every output port Nov 19, 2026
The diff handler looked up and opened a port's result document twice, once
for the result update and once for the table statistics. It now opens it once
and hands it to convertWebResultUpdate. The runtime statistics size is
recorded once per poll and the console message size once per changed
operator, rather than once per changed port.

Also corrects a test comment about the change detector: it makes the diff
handler run, but only ports whose row count changed are sent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SRmgtBces67YppgKLHoZHa
@sshiv012

Copy link
Copy Markdown
Contributor Author

Thanks @Xiao-zhen-Liu. I folded #9272 into this PR and took the port-generic design:

  • Backend: isFirstPort is gone. Every changed external output port writes its result update, and every table port writes its table statistics. Both are keyed by operator id, then by port index, for every port including 0. There is no separate portUpdates field.
  • Frontend: WorkflowResultService keeps one map of table results and one of visualization results, keyed "op:port". The existing getters take portIndex = 0. Every port uses the same page cache, live updates, statistics and request logic. The result table follows the port it shows, so the pinned window from feat(frontend): pin an operator's result beside it, with a tab per output port #9063 no longer re-reads port 1 on a timer.
  • Rebase: rebased onto current main. The conflict with feat(amber): record each result port's output mode and row count #9049 is resolved by keeping its size and row-count recording in onResultUpdate, now for every table port.
  • Nits: addressed inline in 1ca1877.

The description is updated. I'll close #9272 as folded in here.

🤖 Generated with Claude Code

@Xiao-zhen-Liu Xiao-zhen-Liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for folding #9272 into this PR, @sshiv012. I reviewed the updated branch from main at cef08c8d42. Every external output port goes through the same path: updates and table statistics are keyed by operator and port index, each changed port's storage document is opened once per poll, and execution statistics and console sizes are recorded once per poll and once per changed operator. All four earlier comments are addressed. The only failing check, the macOS frontend job, hit a hook timeout in an unrelated preset service test while Ubuntu and Windows frontend checks passed. Approving, with one optional naming nit inline.

import org.apache.texera.amber.core.virtualidentity.OperatorIdentity
import org.apache.texera.amber.core.workflow.GlobalPortIdentity

case class OperatorResultMetadata(tupleCount: Int = 0, changeDetector: String = "")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Each entry in the result store describes one output port rather than a whole operator, so this metadata class could say port instead of operator. Fine to leave as is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed it to PortResultMetadata (including its spec) in 7980b5d. Thanks for the review!

…etadata

Each entry in WorkflowResultStore now describes one output port, keyed by
GlobalPortIdentity, so the metadata class is named for a port.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SRmgtBces67YppgKLHoZHa

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common engine frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants