Skip to content

[SQL] Use stable sorting for the circuit graph -- will produce fewer …#5796

Merged
mihaibudiu merged 1 commit intomainfrom
issue5752
Mar 17, 2026
Merged

[SQL] Use stable sorting for the circuit graph -- will produce fewer …#5796
mihaibudiu merged 1 commit intomainfrom
issue5752

Conversation

@mihaibudiu
Copy link
Copy Markdown
Contributor

…changes when program is edited. Today the graph is resorted in some circumstances, and the sort is not stable. This may causes unnecessary changes in the output Rust program when the SQL program is edited, especially with regards to global constants that are shared between multiple operators. A stable sort should make these changes less likely.

Fixes #5752

Describe Manual Test Plan

Ran all Java tests manually

…changes when program is edited

Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
Copy link
Copy Markdown

@mythical-fred mythical-fred left a comment

Choose a reason for hiding this comment

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

LGTM. Kahn's over DFS-reversePost is the right call -- stable output means fewer spurious diffs when re-compiling unchanged programs. The addNode guarantee (every node gets an empty edge list on insertion) means the this.edges.get(u) call in the main loop is safe. The early-return optimization in LinearPostprocessRetainKeys is a nice bonus.

@mihaibudiu mihaibudiu added this pull request to the merge queue Mar 17, 2026
Merged via the queue into main with commit 7bd0ecd Mar 17, 2026
1 check passed
@mihaibudiu mihaibudiu deleted the issue5752 branch March 17, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SQL] Use a stable topological sort for the circuit graph

3 participants