Skip to content

fix(visualization): take the union of Network Graph's two node columns - #7327

Merged
xuang7 merged 2 commits into
apache:mainfrom
kz930:fix-network-graph-node-set
Aug 8, 2026
Merged

fix(visualization): take the union of Network Graph's two node columns#7327
xuang7 merged 2 commits into
apache:mainfrom
kz930:fix-network-graph-node-set

Conversation

@kz930

@kz930 kz930 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Network Graph built its node set with set(sources + destinations). On two pandas Series + is element-wise, so the set held each source glued to its destination rather than the union of the two columns; those glued values were added to the graph as nodes, and the genuine nodes only arrived afterwards with the edges. This takes the union instead, in first-appearance order — a set iterates strings in an order that varies between processes, which would leave the node sequence unstable from run to run.

One line of code, plus a comment recording why neither + nor set is right here.

Any related issues, documentation, discussions?

Closes #7325.

How was this PR tested?

NetworkGraphOpDescSpec gains a case asserting the node set is built as a union: reverting the one-line change leaves it the only failing test. It also pins the ordered de-duplication, since a set would satisfy "union" while reordering the nodes between processes.

sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.visualization.networkGraph.NetworkGraphOpDescSpec"

Six cases, all passing.

Beyond that, the operator's generated module was dumped and executed over ten rows carrying the edges n3-to-n4, n1-to-n2 and n2-to-n3. Before the change it produced seven nodes — the four real ones plus n3n4, n2n3 and n1n2, each reporting zero connections, with n2n3 sitting in the same picture as the genuine edge from n2 to n3. After it, four nodes with the correct connection counts and no isolated dots.
Before the change:
Screenshot 2026-08-07 at 1 50 52 PM

Selecting an integer column as the source and a string column as the destination aborted the run with TypeError: unsupported operand type(s) for +: 'int' and 'str' before the change and renders normally after it.
Before the change:
Screenshot 2026-08-07 at 1 51 17 PM

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

Generated-by: Claude Code (Claude Opus 5)

@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Aug 5, 2026
@github-actions
github-actions Bot requested a review from xuang7 August 5, 2026 05:44
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. release/* labels drive the post-merge backport, so add or remove one to change where this fix lands.

Release branch Analysis
release/v1.2 Already labeled — this fix is queued to backport here.

Auto-label run.

@github-actions

github-actions Bot commented Aug 5, 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: @eugenegujing
    You can notify them by mentioning @eugenegujing in a comment.

@codecov-commenter

codecov-commenter commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.42%. Comparing base (86865f3) to head (f4f33f5).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7327      +/-   ##
============================================
+ Coverage     83.37%   83.42%   +0.04%     
- Complexity     4129     4139      +10     
============================================
  Files          1166     1167       +1     
  Lines         46424    46442      +18     
  Branches       5174     5174              
============================================
+ Hits          38707    38745      +38     
+ Misses         6000     5980      -20     
  Partials       1717     1717              
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø)
agent-service 83.65% <ø> (ø) Carriedforward from 4096382
amber 80.68% <ø> (-0.01%) ⬇️
computing-unit-managing-service 50.72% <ø> (+7.11%) ⬆️
config-service 65.97% <ø> (ø)
file-service 69.05% <ø> (ø)
frontend 84.03% <ø> (ø) Carriedforward from 4096382
notebook-migration-service 78.89% <ø> (ø)
pyamber 97.36% <ø> (ø) Carriedforward from 4096382
workflow-compiling-service 26.31% <ø> (ø)

*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 Aug 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main f46b2a7 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 379 0.231 25,556/34,025/34,025 us 🔴 -7.6% / 🔴 +114.0%
🔴 bs=100 sw=10 sl=64 781 0.477 126,237/153,415/153,415 us 🔴 +11.0% / 🔴 +39.9%
bs=1000 sw=10 sl=64 899 0.549 1,116,801/1,163,082/1,163,082 us ⚪ within ±5% / 🔴 +11.3%
Baseline details

Latest main f46b2a7 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 379 tuples/sec 409 tuples/sec 762.27 tuples/sec -7.3% -50.3%
bs=10 sw=10 sl=64 MB/s 0.231 MB/s 0.25 MB/s 0.465 MB/s -7.6% -50.3%
bs=10 sw=10 sl=64 p50 25,556 us 23,752 us 12,866 us +7.6% +98.6%
bs=10 sw=10 sl=64 p95 34,025 us 34,076 us 15,903 us -0.2% +114.0%
bs=10 sw=10 sl=64 p99 34,025 us 34,076 us 19,260 us -0.2% +76.7%
bs=100 sw=10 sl=64 throughput 781 tuples/sec 825 tuples/sec 966.64 tuples/sec -5.3% -19.2%
bs=100 sw=10 sl=64 MB/s 0.477 MB/s 0.504 MB/s 0.59 MB/s -5.4% -19.2%
bs=100 sw=10 sl=64 p50 126,237 us 120,479 us 103,594 us +4.8% +21.9%
bs=100 sw=10 sl=64 p95 153,415 us 138,255 us 109,677 us +11.0% +39.9%
bs=100 sw=10 sl=64 p99 153,415 us 138,255 us 120,247 us +11.0% +27.6%
bs=1000 sw=10 sl=64 throughput 899 tuples/sec 898 tuples/sec 998.67 tuples/sec +0.1% -10.0%
bs=1000 sw=10 sl=64 MB/s 0.549 MB/s 0.548 MB/s 0.61 MB/s +0.2% -9.9%
bs=1000 sw=10 sl=64 p50 1,116,801 us 1,111,123 us 1,009,199 us +0.5% +10.7%
bs=1000 sw=10 sl=64 p95 1,163,082 us 1,187,112 us 1,045,335 us -2.0% +11.3%
bs=1000 sw=10 sl=64 p99 1,163,082 us 1,187,112 us 1,076,869 us -2.0% +8.0%
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,527.47,200,128000,379,0.231,25556.35,34024.65,34024.65
1,100,10,64,20,2560.05,2000,1280000,781,0.477,126237.41,153414.96,153414.96
2,1000,10,64,20,22248.02,20000,12800000,899,0.549,1116800.69,1163081.63,1163081.63

The node set came from set(sources + destinations). On two pandas Series +
is element-wise, so the set held each source glued to its destination rather
than the union of the columns, and those glued values were added to the graph
as nodes; the genuine nodes only arrived afterwards, with the edges. Every
graph therefore carried one unconnected dot per distinct source-destination
pair, reporting zero connections and indistinguishable from real data, and a
pair of columns with different types aborted the run outright.

Take the union instead, in first-appearance order: a set iterates strings in
an order that varies between processes, so the node sequence would shift from
run to run.

Closes apache#7325

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kz930
kz930 force-pushed the fix-network-graph-node-set branch from 629384c to 4096382 Compare August 5, 2026 21:15
Reverting the one-line change leaves this the only failing case, so the
expression is held rather than merely written once. It also pins the ordered
de-duplication: a set would satisfy "union" while reordering the nodes between
processes, which is not what the operator needs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kz930

kz930 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@carloea2 May you take a look at this?

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

Looks good to me.

@aglinxinyuan

Copy link
Copy Markdown
Contributor

Does this operator work on main before this PR? If union already supports some cases, then this isn't really a bug fix—it's an improvement.

@kz930

kz930 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

No, it's wrong on every input. sources + destinations adds the two columns row by row, so for rows n1→n2, n2→n3, n3→n4 the node set came out as n1n2, n2n3, n3n4 — not one real node. The graph still looked almost right only because adding the edges put the real nodes back, leaving those three as extra isolated dots: seven nodes instead of four.

@xuang7 xuang7 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!

@chenlica

chenlica commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@kz930 Screenshots?

@xuang7
xuang7 added this pull request to the merge queue Aug 8, 2026
Merged via the queue into apache:main with commit 357296d Aug 8, 2026
48 checks passed
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Backport PR opened: draft #7401 (#7401) to release/v1.2, assigned to @kz930 — needs manual work because the cherry-pick conflicts.

@kz930
kz930 deleted the fix-network-graph-node-set branch August 8, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common fix release/v1.2 back porting to release/v1.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network Graph builds its node set by adding two columns element-wise, so every graph gains phantom nodes and mixed column types abort the run

7 participants