Skip to content

Configure optimization toggles

Source code

Description

Configure the optimization toggles for the lazy query

Usage

<LazyFrame>$set_optimization_toggle(
  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,
  eager = FALSE
)

Arguments

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).
eager Logical. Run the query eagerly.

Value

LazyFrame with specified optimization toggles

Examples

library(polars)

pl$LazyFrame(mtcars)$set_optimization_toggle(type_coercion = FALSE)
#> $ok
#> polars LazyFrame
#>  $describe_optimized_plan() : Show the optimized query plan.
#> 
#> Naive plan:
#> DF ["mpg", "cyl", "disp", "hp"]; PROJECT */11 COLUMNS; SELECTION: "None"
#> 
#> $err
#> NULL
#> 
#> attr(,"class")
#> [1] "extendr_result"