Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix cache dot visualization #15311

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions crates/polars-plan/src/dot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,21 @@ impl LogicalPlan {
id: cache_id,
cache_hits,
} => {
// Always increment cache ids as the `DotNode[0, 0]` will insert a new graph, which we don't want.
let cache_id = cache_id.saturating_add(1);
let fmt = if *cache_hits == UNLIMITED_CACHE {
Cow::Borrowed("CACHE")
} else {
Cow::Owned(format!("CACHE: {} times", *cache_hits))
};
let current_node = DotNode {
branch: *cache_id,
id: *cache_id,
branch: cache_id,
id: cache_id,
fmt: &fmt,
};
// here we take the cache id, to ensure the same cached subplans get the same ids
self.write_dot(acc_str, prev_node, current_node, id_map)?;
input.dot(acc_str, (*cache_id, cache_id + 1), current_node, id_map)
input.dot(acc_str, (cache_id, cache_id + 1), current_node, id_map)
},
Selection { predicate, input } => {
let pred = fmt_predicate(Some(predicate));
Expand Down
Loading