Skip to content

refactor: call the operator IR a DAG, not a graph or tree - #544

Merged
zzylol merged 2 commits into
mainfrom
refactor/dag-naming
Oct 2, 2026
Merged

zzylol merged 2 commits into
mainfrom
refactor/dag-naming

Conversation

@zzylol

@zzylol zzylol commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

QueryExpr and SummaryNode share children through Rc, so the operator IR is a DAG. This PR renames everything that called it a graph or a tree: types, functions, local variables, test names, comments and docs, including old_docs/.

Type renames: DagGraph→ExportDAG, NamedGraph→NamedDAG, WorkloadGraph→WorkloadDAG, SummaryDagGraph→SummaryDAG, ReferenceGraph→ReferenceDAG, ResolveTreeError→ResolveDAGError, SharedSubtree(Strategy)→SharedSubDAG(Strategy).

Function renames: share_common_subtrees→share_common_sub_dags, and the same pattern for share_common_summary_subtrees.

Naming convention: every type and trait name spells it DAG, including those already on main (PostAsapDag→PostAsapDAG, CompiledPhysicalDag→CompiledPhysicalDAG, PhysicalDag→PhysicalDAG, DagNode→DAGNode, DagCompiler→DAGCompiler, …). snake_case identifiers and JSON keys use dag / sub_dag, as Rust naming lints require. A test-local type Dag alias becomes InventoryDAG, because clippy's upper_case_acronyms lint rejects an all-caps DAG.

Downstream: ASAPQuery-backend pins this repo at f46cbf6c and imports some of these types (e.g. PostAsapDagDocument, DagCompiler). It is unaffected until it bumps that pin, and the bump will need the matching renames.

Export JSON (breaking): the keys graph, post_graph and pre_asap_subgraph are now dag, post_dag and pre_asap_sub_dag. The dag-viewer and its fixtures are updated, but exports written before this change no longer load in the viewer. No other repo reads these keys.

Wording: sentences that contrasted a DAG with a tree are reworded to say what they mean, e.g. "counts a shared node once per path" instead of "tree-shaped".

Not renamed: BTreeMap/BTreeSet, DataFusion's TreeNode API, the vendored MetricsQL parser, git's "working tree", cargo tree, GitHub /tree/ URLs, Mermaid's graph/subgraph keywords, and the dagre tight-tree option.

Test plan

  • cargo fmt --check, cargo clippy --workspace --all-targets (no warnings)
  • cargo test --workspace (1524 passed)
  • python3 -m unittest discover -s tools/dag-viewer -p test_render.py
  • dag_export --post-asap --default-cost output has dag/post_dag keys and renders with render.py
  • Load an export in viewer.js in a browser (JS not syntax-checked locally: no node)

🤖 Generated with Claude Code

zzylol and others added 2 commits October 2, 2026 18:50
QueryExpr and SummaryNode children are Rc-shared, so the IR is a DAG.
Rename types, functions, locals, tests, comments and docs accordingly:

- ExportDAG/NamedDAG/WorkloadDAG/SummaryDAG (was DagGraph/NamedGraph/
  WorkloadGraph/SummaryDagGraph), ReferenceDAG, ResolveDAGError,
  SharedSubDAG(Strategy), share_common_sub_dags, *_sub_dag test names.
- Export JSON keys: graph -> dag, post_graph -> post_dag,
  pre_asap_subgraph -> pre_asap_sub_dag; dag-viewer and fixtures follow.
  Exports written before this change no longer load in the viewer.

Unchanged: BTreeMap/BTreeSet, DataFusion TreeNode, the vendored MetricsQL
parser, git "working tree", `cargo tree`, URLs, and Mermaid keywords.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PostAsapDag -> PostAsapDAG, CompiledPhysicalDag -> CompiledPhysicalDAG,
PhysicalDag(Node) -> PhysicalDAG(Node), DagNode -> DAGNode, and every other
type/trait name containing `Dag`, plus their doc and comment references.
A test-local `type Dag` becomes `InventoryDAG` (an all-caps `DAG` alias
would trip clippy::upper_case_acronyms). `cytoscapeDagre` is the vendored
dagre plugin's name and stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant