Skip to content

feat(amber): record each result port's output mode and row count - #9049

Merged
mengw15 merged 6 commits into
apache:mainfrom
mengw15:feat/8994-persist-port-output-mode-count
Nov 6, 2026
Merged

mengw15 merged 6 commits into
apache:mainfrom
mengw15:feat/8994-persist-port-output-mode-count

Conversation

@mengw15

@mengw15 mengw15 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Records two facts per result port in operator_port_executions, so a finished execution's results can be listed without the computing unit (#5363):

  • output_mode (new output_mode_enum): whether the port's result is a paginated table or a visualization. Today only the engine's physical plan knows this, and it lives in the CU. The engine already looks up the output port when it creates the port's storage, so OperatorPortResultUriAvailable now carries the port's declared mode, and the row is inserted with it.
  • result_count: the number of rows, written with result_size in one update each time the results are polled and once more when the run ends, so it does not depend on an open browser tab. Visualization (SINGLE_SNAPSHOT) ports keep a null count; they are never paged. Like result_size, it is recorded only for an operator's first result port for now, so the other ports of an operator such as Split keep a null count.

result_size moves with it: it was written from the websocket diff handler, which runs once per connected browser and not at all without one.

Schema change: sql/updates/52.sql (idempotent), texera_ddl.sql, and a changelog.xml entry. Existing rows keep both columns null. Nothing reads the columns yet; that is #8995.

Any related issues, documentation, discussions?

Closes #8994. Part of #5363, proposed in #8945.

How was this PR tested?

  • ExecutionResultServiceSpec: the mode carried by the event is persisted; every output mode maps to the stored value of its name and an unrecognized one is rejected; a run that ends with no browser connected records its table port's size and count (this fails on the previous code), and a SINGLE_SNAPSHOT port records no count.
  • WorkflowExecutionsResourceSpec: updateResultSizeAndCount sets both columns on the matching row.
  • Removed the mode and count writes and confirmed exactly the three corresponding tests fail.
  • Applied 52.sql twice to a local database (the second run is a no-op), and ran the full texera_ddl.sql into a scratch database.

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

Generated-by: Claude Code (claude-opus-5-5)

@mengw15
mengw15 requested a balanced review from Copilot October 20, 2026 20:23

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Adds persistence of result-port metadata (declared output mode and row count) into operator_port_executions so completed workflow results can be listed without consulting the computing unit’s physical plan.

Changes:

  • Introduces output_mode_enum, plus output_mode and result_count columns for operator_port_executions (DDL + Liquibase update).
  • Extends OperatorPortResultUriAvailable to carry OutputMode and persists it when storing result URIs.
  • Records table-result row counts into RESULT_COUNT and adds/updates unit tests around mode/count behavior.
File Description
sql/​updates/​52.sql Adds idempotent migration for enum + new columns
sql/​texera_ddl.sql Updates baseline schema with new enum + columns
sql/​changelog.xml Registers Liquibase changeSet for update 52
amber/​src/​main/​scala/​org/​apache/​texera/​web/​service/​ExecutionResultService.scala Persists output mode; writes result_count via resource update
amber/​src/​main/​scala/​org/​apache/​texera/​web/​resource/​dashboard/​user/​workflow/​WorkflowExecutionsResource.scala Adds updateResultCount DB update helper
amber/​src/​main/​scala/​org/​apache/​texera/​amber/​engine/​architecture/​scheduling/​RegionExecutionManager.scala Includes output mode in result-URI event
amber/​src/​main/​scala/​org/​apache/​texera/​amber/​engine/​architecture/​coordinator/​ClientEvent.scala Extends event payload to include output mode
amber/​src/​test/​scala/​org/​apache/​texera/​web/​service/​ExecutionResultServiceSpec.scala Adds coverage for output mode mapping and result_count persistence rules
amber/​src/​test/​scala/​org/​apache/​texera/​web/​resource/​dashboard/​user/​workflow/​WorkflowExecutionsResourceSpec.scala Adds test for updateResultCount behavior

Review effort: Lite

Comment thread sql/updates/52.sql Resolved
@mengw15
mengw15 requested a balanced review from Copilot October 20, 2026 22:31

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues
3 resolved since last review

Review effort: Lite

Comment thread sql/updates/52.sql Resolved
@github-actions github-actions Bot added feature engine ddl-change Changes to the TexeraDB DDL labels Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

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

  • Committers with relevant context: @parshimers
    You can request their reviews formally with /request-review @parshimers.

  • Contributors with relevant context: @kz930, @yrenat, @Yicong-Huang
    You can notify them by mentioning @kz930, @yrenat, @Yicong-Huang in a comment.

@mengw15
mengw15 force-pushed the feat/8994-persist-port-output-mode-count branch from 6305d59 to 9e316d6 Compare October 26, 2026 19:06
@mengw15
mengw15 requested review from bobbai00 and kunwp1 October 26, 2026 19:06
@codecov-commenter

codecov-commenter commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.86%. Comparing base (e70d67e) to head (828c52d).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...he/texera/web/service/ExecutionResultService.scala 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9049      +/-   ##
============================================
- Coverage     92.20%   91.86%   -0.35%     
- Complexity     4977     5021      +44     
============================================
  Files          1275     1275              
  Lines         55568    55957     +389     
  Branches       7163     7280     +117     
============================================
+ Hits          51237    51404     +167     
- Misses         2555     2731     +176     
- Partials       1776     1822      +46     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.53% <ø> (ø) Carriedforward from ef97aa1
amber 85.91% <90.00%> (-0.87%) ⬇️
computing-unit-managing-service 64.02% <ø> (ø)
config-service 87.61% <ø> (ø)
file-service 82.29% <ø> (ø)
frontend 96.57% <ø> (ø) Carriedforward from ef97aa1
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.54% <ø> (ø) Carriedforward from ef97aa1
workflow-compiling-service 77.95% <ø> (ø)

*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 Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main e70d67e 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 411 0.251 24,349/30,004/30,004 us 🔴 +27.9% / 🔴 +132.8%
🔴 bs=100 sw=10 sl=64 831 0.508 117,348/160,308/160,308 us 🔴 +14.7% / 🔴 +80.2%
⚪ bs=1000 sw=10 sl=64 976 0.596 1,023,255/1,069,411/1,069,411 us ⚪ within ±5% / 🔴 +25.5%
Baseline details

Latest main e70d67e from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 411 tuples/sec 483 tuples/sec 953.99 tuples/sec -14.9% -56.9%
bs=10 sw=10 sl=64 MB/s 0.251 MB/s 0.295 MB/s 0.582 MB/s -14.9% -56.9%
bs=10 sw=10 sl=64 p50 24,349 us 19,031 us 10,584 us +27.9% +130.0%
bs=10 sw=10 sl=64 p95 30,004 us 27,470 us 12,888 us +9.2% +132.8%
bs=10 sw=10 sl=64 p99 30,004 us 27,470 us 16,266 us +9.2% +84.5%
bs=100 sw=10 sl=64 throughput 831 tuples/sec 875 tuples/sec 1,242 tuples/sec -5.0% -33.1%
bs=100 sw=10 sl=64 MB/s 0.508 MB/s 0.534 MB/s 0.758 MB/s -4.9% -33.0%
bs=100 sw=10 sl=64 p50 117,348 us 111,826 us 83,370 us +4.9% +40.8%
bs=100 sw=10 sl=64 p95 160,308 us 139,762 us 88,966 us +14.7% +80.2%
bs=100 sw=10 sl=64 p99 160,308 us 139,762 us 101,186 us +14.7% +58.4%
bs=1000 sw=10 sl=64 throughput 976 tuples/sec 989 tuples/sec 1,276 tuples/sec -1.3% -23.5%
bs=1000 sw=10 sl=64 MB/s 0.596 MB/s 0.604 MB/s 0.779 MB/s -1.3% -23.5%
bs=1000 sw=10 sl=64 p50 1,023,255 us 1,009,056 us 815,662 us +1.4% +25.5%
bs=1000 sw=10 sl=64 p95 1,069,411 us 1,064,927 us 864,800 us +0.4% +23.7%
bs=1000 sw=10 sl=64 p99 1,069,411 us 1,064,927 us 896,884 us +0.4% +19.2%
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,486.55,200,128000,411,0.251,24349.40,30003.97,30003.97
1,100,10,64,20,2405.30,2000,1280000,831,0.508,117348.27,160307.90,160307.90
2,1000,10,64,20,20490.25,20000,12800000,976,0.596,1023254.57,1069410.67,1069410.67

@kunwp1 kunwp1 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.

LGTM!

operator_port_executions gains output_mode and result_count, so a finished
execution's results can be listed without the computing unit: the mode lives
only in the engine's physical plan, and the count otherwise needs each table
opened. OperatorPortResultUriAvailable carries the port's declared mode, and
the count is written where result_size already is, from the result store's
own count.

Closes apache#8994
- Schema-qualify the type and table in 52.sql: the liquibase runner
  strips `SET search_path` before applying update scripts.
- Return Option from toOutputModeEnum instead of null.
- Reword updateResultCount's Scaladoc to name the table it writes.
Merge updateResultSize and updateResultCount into updateResultSizeAndCount:
both columns of the same row were written on every result-update tick.
@mengw15
mengw15 force-pushed the feat/8994-persist-port-output-mode-count branch from 9e316d6 to af143f8 Compare October 29, 2026 19:25

@bobbai00 bobbai00 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.

🔴 1 must-fix · 1 advisory · 0 polish: the mode is recorded reliably at insert, but the count is only written while a browser session watches the run.

Design & architecture (1)

  • sql/texera_ddl.sql:105: output_mode_enum mirrors the proto OutputMode with no pointer either way (advisory, see inline)

Correctness (1)

  • ExecutionResultService.scala:459: result_count is written only while a websocket session is subscribed (must-fix, see inline)
Verification trace

Traced when the count write runs at af143f8. updateResultSizeAndCount is reached only from the result store's diff handler, which StateStore calls from the map stage behind getWebsocketEventObservable. Its only production subscriber is WorkflowService.connect, one per websocket session; the poll, the terminal-state callback and SyncExecutionResource never subscribe. Reproduced the operator chain on rxjava 3.1.12, the version amber pins: no subscriber gave 0 handler runs over three state changes, changes after the only subscriber disposed were never processed, and two subscribers ran it twice per change. Leaving the workspace closes the socket while WorkflowLifecycleManager keeps a RUNNING execution alive, and the state is cleaned up 30 s after the run ends.

Comment thread sql/texera_ddl.sql Resolved
# Conflicts:
#	amber/src/test/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowExecutionsResourceSpec.scala
The result store's diff handler runs once per websocket subscriber and
not at all without one, so a run that ended after its tab closed kept a
stale or empty count. Write size and count from onResultUpdate instead,
which runs on every poll and once more when the run ends.

Cross-reference OutputMode and output_mode_enum, and store no mode rather
than fail the insert for a mode toOutputModeEnum does not know.
@github-actions github-actions Bot added the common label Nov 5, 2026

@bobbai00 bobbai00 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.

LGTM. left some NIT comments

A declared port cannot be Unrecognized, so the Option only covered a case
that does not occur. Throw on it, as convertWebResultUpdate does, and walk
OutputMode.values in the test so a mode missing from the match fails there.
@mengw15
mengw15 added this pull request to the merge queue Nov 6, 2026
Merged via the queue into apache:main with commit 8cfacf2 Nov 6, 2026
38 checks passed
@mengw15
mengw15 deleted the feat/8994-persist-port-output-mode-count branch November 6, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common ddl-change Changes to the TexeraDB DDL engine feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist each result port's output mode and row count

5 participants