diff --git a/Cargo.toml b/Cargo.toml index 8d009fd..cd19995 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,8 @@ members = [ ] [workspace.dependencies] -polars = { version = "0.35", default-features = false } -polars-core = { version = "0.35", default-features = false } -polars-ffi = { version = "0.35", default-features = false } -polars-plan = { version = "0.35", default-feautres = false } -polars-lazy = { version = "0.35", default-features = false } +polars = { version = "0.36.2", default-features = false } +polars-core = { version = "0.36.2", default-features = false } +polars-ffi = { version = "0.36.2", default-features = false } +polars-plan = { version = "0.36.2", default-feautres = false } +polars-lazy = { version = "0.36.2", default-features = false } diff --git a/README.md b/README.md index 5225b7c..a7eaa81 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ struct PigLatinKwargs { capitalize: bool, } -#[polars_expr(output_type=Utf8)] +#[polars_expr(output_type=String)] fn pig_latinnify(inputs: &[Series], kwargs: PigLatinKwargs) -> PolarsResult { - let ca = inputs[0].utf8()?; - let out: Utf8Chunked = + let ca = inputs[0].str()?; + let out: StringChunked = ca.apply_to_buffer(|value, output| pig_latin_str(value, kwargs.capitalize, output)); Ok(out.into_series()) } diff --git a/example/derive_expression/expression_lib/src/expressions.rs b/example/derive_expression/expression_lib/src/expressions.rs index 8a34c1c..ac69934 100644 --- a/example/derive_expression/expression_lib/src/expressions.rs +++ b/example/derive_expression/expression_lib/src/expressions.rs @@ -24,10 +24,10 @@ fn pig_latin_str(value: &str, capitalize: bool, output: &mut String) { } } -#[polars_expr(output_type=Utf8)] +#[polars_expr(output_type=String)] fn pig_latinnify(inputs: &[Series], kwargs: PigLatinKwargs) -> PolarsResult { - let ca = inputs[0].utf8()?; - let out: Utf8Chunked = + let ca = inputs[0].str()?; + let out: StringChunked = ca.apply_to_buffer(|value, output| pig_latin_str(value, kwargs.capitalize, output)); Ok(out.into_series()) } @@ -53,17 +53,17 @@ fn split_offsets(len: usize, n: usize) -> Vec<(usize, usize)> { } /// This expression will run in parallel if the `context` allows it. -#[polars_expr(output_type=Utf8)] +#[polars_expr(output_type=String)] fn pig_latinnify_with_paralellism( inputs: &[Series], context: CallerContext, kwargs: PigLatinKwargs, ) -> PolarsResult { use rayon::prelude::*; - let ca = inputs[0].utf8()?; + let ca = inputs[0].str()?; if context.parallel() { - let out: Utf8Chunked = + let out: StringChunked = ca.apply_to_buffer(|value, output| pig_latin_str(value, kwargs.capitalize, output)); Ok(out.into_series()) } else { @@ -82,7 +82,7 @@ fn pig_latinnify_with_paralellism( }) .collect(); - Ok(Utf8Chunked::from_chunk_iter(ca.name(), chunks.into_iter().flatten()).into_series()) + Ok(StringChunked::from_chunk_iter(ca.name(), chunks.into_iter().flatten()).into_series()) }) } } @@ -96,8 +96,8 @@ fn jaccard_similarity(inputs: &[Series]) -> PolarsResult { #[polars_expr(output_type=Float64)] fn hamming_distance(inputs: &[Series]) -> PolarsResult { - let a = inputs[0].utf8()?; - let b = inputs[1].utf8()?; + let a = inputs[0].str()?; + let b = inputs[1].str()?; let out: UInt32Chunked = arity::binary_elementwise_values(a, b, crate::distances::naive_hamming_dist); Ok(out.into_series()) @@ -145,11 +145,11 @@ pub struct MyKwargs { /// If you want to accept `kwargs`. You define a `kwargs` argument /// on the second position in you plugin. You can provide any custom struct that is deserializable /// with the pickle protocol (on the rust side). -#[polars_expr(output_type=Utf8)] +#[polars_expr(output_type=String)] fn append_kwargs(input: &[Series], kwargs: MyKwargs) -> PolarsResult { let input = &input[0]; - let input = input.cast(&DataType::Utf8)?; - let ca = input.utf8().unwrap(); + let input = input.cast(&DataType::String)?; + let ca = input.str().unwrap(); Ok(ca .apply_to_buffer(|val, buf| { diff --git a/pyo3-polars-derive/Cargo.toml b/pyo3-polars-derive/Cargo.toml index ff532b2..f338be8 100644 --- a/pyo3-polars-derive/Cargo.toml +++ b/pyo3-polars-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-polars-derive" -version = "0.3.0" +version = "0.4.0" edition = "2021" license = "MIT" readme = "README.md" diff --git a/pyo3-polars/Cargo.toml b/pyo3-polars/Cargo.toml index 08c2863..f073664 100644 --- a/pyo3-polars/Cargo.toml +++ b/pyo3-polars/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-polars" -version = "0.9.0" +version = "0.10.0" edition = "2021" license = "MIT" readme = "../README.md" @@ -17,7 +17,7 @@ polars-ffi = { workspace = true, optional = true } polars-lazy = { workspace = true, optional = true } polars-plan = { workspace = true, optional = true } pyo3 = "0.20.0" -pyo3-polars-derive = { version = "0.3.0", path = "../pyo3-polars-derive", optional = true } +pyo3-polars-derive = { version = "0.4.0", path = "../pyo3-polars-derive", optional = true } serde = { version = "1", optional = true } serde-pickle = { version = "1", optional = true } thiserror = "1"