Plot the query plan
Description
This only returns the "dot" output that can be passed to other packages,
such as DiagrammeR::grViz()
.
Usage
<LazyFrame>$to_dot(
...,
optimized = TRUE,
type_coercion = TRUE,
predicate_pushdown = TRUE,
projection_pushdown = TRUE,
simplify_expression = TRUE,
slice_pushdown = TRUE,
comm_subplan_elim = TRUE,
comm_subexpr_elim = TRUE,
streaming = FALSE
)
Arguments
…
|
Not used.. |
optimized
|
Optimize the query plan. |
type_coercion
|
Logical. Coerce types such that operations succeed and run on minimal required memory. |
predicate_pushdown
|
Logical. Applies filters as early as possible at scan level. |
projection_pushdown
|
Logical. Select only the columns that are needed at the scan level. |
simplify_expression
|
Logical. Various optimizations, such as constant folding and replacing expensive operations with faster alternatives. |
slice_pushdown
|
Logical. Only load the required slice from the scan level. Don’t
materialize sliced outputs (e.g. join$head(10) ).
|
comm_subplan_elim
|
Logical. Will try to cache branching subplans that occur on self-joins or unions. |
comm_subexpr_elim
|
Logical. Common subexpressions will be cached and reused. |
streaming
|
Logical. Run parts of the query in a streaming fashion (this is in an alpha state). |
Value
A character vector
Examples
library(polars)
lf = pl$LazyFrame(
a = c("a", "b", "a", "b", "b", "c"),
b = 1:6,
c = 6:1
)
query = lf$group_by("a", maintain_order = TRUE)$agg(
pl$all()$sum()
)$sort(
"a"
)
query$to_dot() |> cat()
#> graph polars_query {
#> "SORT BY [col(\"a\")] [(0, 0)]" -- "AGG [col(\"b\").sum(), col(\"c\").sum()]
#> BY
#> [col(\"a\")] [(0, 1)] [(0, 1)]"
#> "AGG [col(\"b\").sum(), col(\"c\").sum()]
#> BY
#> [col(\"a\")] [(0, 1)] [(0, 1)]" -- "TABLE
#> π 3/3;
#> σ - [(0, 2)]"
#>
#> "TABLE
#> π 3/3;
#> σ - [(0, 2)]"[label="TABLE
#> π 3/3;
#> σ -"]
#> "SORT BY [col(\"a\")] [(0, 0)]"[label="SORT BY [col(\"a\")]"]
#> "AGG [col(\"b\").sum(), col(\"c\").sum()]
#> BY
#> [col(\"a\")] [(0, 1)] [(0, 1)]"[label="AGG [col(\"b\").sum(), col(\"c\").sum()]
#> BY
#> [col(\"a\")] [(0, 1)]"]
#>
#> }