<#6434 [Core feature] Add default Renderer for pol...
# flyte-github
c
#6434 [Core feature] Add default Renderer for polars LazyFrame Issue created by HansBambel ### Motivation: Why do you think this is important? I noticed that my task does not work anymore when I switched from using a polars
DataFrame
as input to a polars
LazyFrame
due to a Renderer for
LazyFrame
missing. Since LazyFrames are supported out of the box, I was wondering why this is throwing an error as I did not explicitly ask for the input parameters being rendered in the Deck. ### Goal: What should the final outcome look like, ideally? Add a renderer for a
LazyFrame
. Since these only contain the execution plan it should be fine to just display that (see below for suggested implementation). I created a MRE: class LazyFrameRenderer: """Display the execution plan of a LazyFrame.""" def to_html(self, df: pl.LazyFrame) -> str: assert isinstance(df, pl.LazyFrame) explain_string = df.explain() return MarkdownIt().render(explain_string) @task(container_image=ImageSpec(packages=["polars"])) def get_data() -> pl.DataFrame: return pl.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}) @task(container_image=ImageSpec(packages=["polars"]), enable_deck=True) def showcase_data(data: pl.DataFrame) -> Annotated[pl.LazyFrame, LazyFrameRenderer()]: """Showcase the data in a deck.""" return data.lazy() @workflow() def lazyframe_deck() -> pl.LazyFrame: df = get_data() lf = showcase_data(df) return lf ### Describe alternatives you've considered I also tried annotating the input parameter
LazyFrame
with a custom renderer, but this still did not work as the input parameters are checked from another list apparently. ### Propose: Link/Inline OR Additional context class LazyFrameRenderer: """Display the execution plan of a LazyFrame.""" def to_html(self, df: pl.LazyFrame) -> str: assert isinstance(df, pl.LazyFrame) explain_string = df.explain() return MarkdownIt().render(explain_string) This renderer should probably be added to
StructuredDatasetTransformerEngine.Renderers
### Are you sure this issue hasn't been raised already? • Yes ### Have you read the Code of Conduct? • Yes flyteorg/flyte