Skip to content

Commit

Permalink
adapter: Thread for_cache to controller graphviz request
Browse files Browse the repository at this point in the history
Thread the contents of the FOR CACHE clause, if present, all the way
through to the graphviz controller RPC. This allows running EXPLAIN
[SIMPLIFIED] GRAPHVIZ [FOR CACHE <q>] in a SQL console.

Release-Note-Core: Add a new `FOR CACHE <q>` clause to the end of the
  `EXPLAIN GRAPHVIZ` SQL command to allow limiting the generated
  graphviz to only the nodes for a named cached query.
Change-Id: I2cf07903a51f992e0b3fd27170c599ae9bde324e
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/6131
Tested-by: Buildkite CI
Reviewed-by: Luke Osborne <luke@readyset.io>
  • Loading branch information
glittershark committed Sep 27, 2023
1 parent 1203bd6 commit c948a59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions readyset-adapter/src/backend.rs
Expand Up @@ -1914,9 +1914,10 @@ where
SqlQuery::Explain(nom_sql::ExplainStatement::LastStatement) => {
self.explain_last_statement()
}
SqlQuery::Explain(nom_sql::ExplainStatement::Graphviz { simplified, .. }) => {
self.noria.graphviz(*simplified).await
}
SqlQuery::Explain(nom_sql::ExplainStatement::Graphviz {
simplified,
for_cache,
}) => self.noria.graphviz(*simplified, for_cache.clone()).await,
SqlQuery::Explain(nom_sql::ExplainStatement::Domains) => {
self.noria.explain_domains().await
}
Expand Down
3 changes: 2 additions & 1 deletion readyset-adapter/src/backend/noria_connector.rs
Expand Up @@ -523,6 +523,7 @@ impl NoriaConnector {
pub(crate) async fn graphviz(
&mut self,
simplified: bool,
for_query: Option<Relation>,
) -> ReadySetResult<QueryResult<'static>> {
let label = if simplified {
"SIMPLIFIED GRAPHVIZ"
Expand All @@ -536,7 +537,7 @@ impl NoriaConnector {
.noria
.graphviz(GraphvizOptions {
detailed: !simplified,
..Default::default()
for_query,
})
.await?;

Expand Down

0 comments on commit c948a59

Please sign in to comment.