Create a graph representation of the Expression. explain runs the optimizer and creates a graph of the optimized expression with graphviz. No computation is triggered. Parameters ---------- stage: {"logical", "simplified-logical", "tuned-logical", "physical"
(self, stage: OptimizerStage = "fused", format: str | None = None)
| 527 | return out.expr.analyze(filename=filename, format=format) |
| 528 | |
| 529 | def explain(self, stage: OptimizerStage = "fused", format: str | None = None): |
| 530 | """Create a graph representation of the Expression. |
| 531 | |
| 532 | explain runs the optimizer and creates a graph of the optimized expression |
| 533 | with graphviz. No computation is triggered. |
| 534 | |
| 535 | Parameters |
| 536 | ---------- |
| 537 | stage: {"logical", "simplified-logical", "tuned-logical", "physical", "simplified-physical", "fused"} |
| 538 | The optimizer stage that is returned. Default is "fused". |
| 539 | |
| 540 | - logical: outputs the expression as is |
| 541 | - simplified-logical: simplifies the expression which includes predicate |
| 542 | pushdown and column projection. |
| 543 | - tuned-logical: applies additional optimizations like partition squashing |
| 544 | - physical: outputs the physical expression; this expression can actually |
| 545 | be computed |
| 546 | - simplified-physical: runs another simplification after the physical |
| 547 | plan is generated |
| 548 | - fused: fuses the physical expression to reduce the nodes in the graph. |
| 549 | |
| 550 | .. warning:: |
| 551 | The optimizer stages are subject to change. |
| 552 | format: str, default None |
| 553 | The format of the output. Default is "png". |
| 554 | |
| 555 | Returns |
| 556 | ------- |
| 557 | None, but opens a new window with the graph visualization and outputs |
| 558 | a file with the graph representation. |
| 559 | """ |
| 560 | out = self |
| 561 | if not isinstance(out, Scalar): |
| 562 | out = out.repartition(npartitions=1) |
| 563 | return out.expr.explain(stage, format) |
| 564 | |
| 565 | def pprint(self): |
| 566 | """Outputs a string representation of the DataFrame. |
nothing calls this directly
no test coverage detected