From f6fcee1bfb9512474d6be50e693f23e76d5be197 Mon Sep 17 00:00:00 2001 From: Stijn de Gooijer Date: Wed, 19 Jun 2024 22:01:59 +0200 Subject: [PATCH] docs: Fix some warnings during doc build --- docs/_build/API_REFERENCE_LINKS.yml | 4 +++- .../user-guide/expressions/user-defined-functions.py | 8 +++++--- py-polars/polars/lazyframe/frame.py | 8 ++++++-- py-polars/src/lazyframe/mod.rs | 5 ++++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/docs/_build/API_REFERENCE_LINKS.yml b/docs/_build/API_REFERENCE_LINKS.yml index 02d8fd143ff3..ea02e59d4358 100644 --- a/docs/_build/API_REFERENCE_LINKS.yml +++ b/docs/_build/API_REFERENCE_LINKS.yml @@ -1,7 +1,8 @@ python: DataFrame: https://docs.pola.rs/api/python/stable/reference/dataframe/index.html - Categorical: https://docs.pola.rs/api/python/stable/reference/api/polars.Categorical.html + LazyFrame: https://docs.pola.rs/api/python/stable/reference/lazyframe/index.html Series: https://docs.pola.rs/api/python/stable/reference/series/index.html + Categorical: https://docs.pola.rs/api/python/stable/reference/api/polars.Categorical.html select: https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.select.html filter: https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.filter.html with_columns: https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.with_columns.html @@ -151,6 +152,7 @@ python: rust: DataFrame: https://docs.pola.rs/api/rust/dev/polars/frame/struct.DataFrame.html + LazyFrame: https://docs.pola.rs/api/rust/dev/polars/prelude/struct.LazyFrame.html Series: https://docs.pola.rs/api/rust/dev/polars/series/struct.Series.html Categorical: name: Categorical diff --git a/docs/src/python/user-guide/expressions/user-defined-functions.py b/docs/src/python/user-guide/expressions/user-defined-functions.py index 6edb63f5024a..6c248691e1a9 100644 --- a/docs/src/python/user-guide/expressions/user-defined-functions.py +++ b/docs/src/python/user-guide/expressions/user-defined-functions.py @@ -46,7 +46,9 @@ def add_counter(val: int) -> int: out = df.select( - pl.col("values").map_elements(add_counter).alias("solution_map_elements"), + pl.col("values") + .map_elements(add_counter, return_dtype=pl.Int64) + .alias("solution_map_elements"), (pl.col("values") + pl.int_range(1, pl.len() + 1)).alias("solution_expr"), ) print(out) @@ -54,8 +56,8 @@ def add_counter(val: int) -> int: # --8<-- [start:combine] out = df.select( - pl.struct(["keys", "values"]) - .map_elements(lambda x: len(x["keys"]) + x["values"]) + pl.struct("keys", "values") + .map_elements(lambda x: len(x["keys"]) + x["values"], return_dtype=pl.Int64) .alias("solution_map_elements"), (pl.col("keys").str.len_bytes() + pl.col("values")).alias("solution_expr"), ) diff --git a/py-polars/polars/lazyframe/frame.py b/py-polars/polars/lazyframe/frame.py index b520be9b1a80..26ecc093ffbe 100644 --- a/py-polars/polars/lazyframe/frame.py +++ b/py-polars/polars/lazyframe/frame.py @@ -1041,6 +1041,9 @@ def explain( if tree_format: format = "tree" + if streaming: + issue_unstable_warning("Streaming mode is considered unstable.") + if optimized: ldf = self._ldf.optimization_toggle( type_coercion, @@ -1872,7 +1875,6 @@ def collect( if streaming: issue_unstable_warning("Streaming mode is considered unstable.") - comm_subplan_elim = False ldf = self._ldf.optimization_toggle( type_coercion, @@ -2048,7 +2050,6 @@ def collect_async( if streaming: issue_unstable_warning("Streaming mode is considered unstable.") - comm_subplan_elim = False ldf = self._ldf.optimization_toggle( type_coercion, @@ -2622,6 +2623,9 @@ def fetch( comm_subexpr_elim = False cluster_with_columns = False + if streaming: + issue_unstable_warning("Streaming mode is considered unstable.") + lf = self._ldf.optimization_toggle( type_coercion, predicate_pushdown, diff --git a/py-polars/src/lazyframe/mod.rs b/py-polars/src/lazyframe/mod.rs index 9de61cd2b022..ba63b6b94aea 100644 --- a/py-polars/src/lazyframe/mod.rs +++ b/py-polars/src/lazyframe/mod.rs @@ -489,7 +489,7 @@ impl PyLazyFrame { projection_pushdown: bool, simplify_expr: bool, slice_pushdown: bool, - comm_subplan_elim: bool, + mut comm_subplan_elim: bool, comm_subexpr_elim: bool, cluster_with_columns: bool, streaming: bool, @@ -512,6 +512,9 @@ impl PyLazyFrame { ldf = ldf.with_new_streaming(new_streaming); } + if streaming { + comm_subplan_elim = false; + } #[cfg(feature = "cse")] { ldf = ldf.with_comm_subplan_elim(comm_subplan_elim);