polars.LazyFrame.show_graph#
- LazyFrame.show_graph(
- *,
- optimized: bool = True,
- show: bool = True,
- output_path: str | Path | None = None,
- raw_output: bool = False,
- figsize: tuple[float, float] = (16.0, 12.0),
- type_coercion: bool = True,
- _type_check: bool = True,
- predicate_pushdown: bool = True,
- projection_pushdown: bool = True,
- simplify_expression: bool = True,
- slice_pushdown: bool = True,
- comm_subplan_elim: bool = True,
- comm_subexpr_elim: bool = True,
- cluster_with_columns: bool = True,
- collapse_joins: bool = True,
- streaming: bool = False,
- _check_order: bool = True,
显示查询计划的图表。
请注意,必须安装Graphviz才能渲染可视化效果(如果尚未安装,您可以在此处下载:https://graphviz.org/download)。
- Parameters:
- optimized
优化查询计划。
- show
显示图表。
- output_path
将图形写入磁盘。
- raw_output
返回点语法。这不能与
show和/或output_path结合使用。- figsize
如果
show == True,则传递给matplotlib。- type_coercion
进行类型强制优化。
- predicate_pushdown
执行谓词下推优化。
- projection_pushdown
执行投影下推优化。
- simplify_expression
运行简化表达式优化。
- slice_pushdown
切片下推优化。
- comm_subplan_elim
将尝试缓存出现在自连接或联合上的分支子计划。
- comm_subexpr_elim
常见的子表达式将被缓存并重复使用。
- cluster_with_columns
将顺序独立的调用合并到with_columns。
- collapse_joins
将连接和过滤器合并为一个更快的连接。
- streaming
以流式方式运行查询的部分内容(此功能处于alpha状态)。
示例
>>> lf = pl.LazyFrame( ... { ... "a": ["a", "b", "a", "b", "b", "c"], ... "b": [1, 2, 3, 4, 5, 6], ... "c": [6, 5, 4, 3, 2, 1], ... } ... ) >>> lf.group_by("a", maintain_order=True).agg(pl.all().sum()).sort( ... "a" ... ).show_graph()