From 90ff20e0cf7ed68d3931cf2da89f31f41a91273f Mon Sep 17 00:00:00 2001 From: Alexander Beedie Date: Mon, 29 Jul 2024 15:53:51 +0400 Subject: [PATCH] move into `polars-compute` --- crates/polars-arrow/src/legacy/kernels/mod.rs | 1 - crates/polars-compute/src/lib.rs | 4 ++-- .../legacy/kernels/binary.rs => polars-compute/src/size.rs} | 6 +++--- crates/polars-ops/src/chunked_array/binary/namespace.rs | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) rename crates/{polars-arrow/src/legacy/kernels/binary.rs => polars-compute/src/size.rs} (65%) diff --git a/crates/polars-arrow/src/legacy/kernels/mod.rs b/crates/polars-arrow/src/legacy/kernels/mod.rs index 22e65e2cfda1..cdb7cb9c2057 100644 --- a/crates/polars-arrow/src/legacy/kernels/mod.rs +++ b/crates/polars-arrow/src/legacy/kernels/mod.rs @@ -3,7 +3,6 @@ use std::iter::Enumerate; use crate::array::BooleanArray; use crate::bitmap::utils::BitChunks; pub mod atan2; -pub mod binary; pub mod concatenate; pub mod ewm; #[cfg(feature = "compute_take")] diff --git a/crates/polars-compute/src/lib.rs b/crates/polars-compute/src/lib.rs index b6ab2642485b..df8e1df6585a 100644 --- a/crates/polars-compute/src/lib.rs +++ b/crates/polars-compute/src/lib.rs @@ -8,15 +8,15 @@ use arrow::types::NativeType; pub mod arithmetic; +pub mod arity; pub mod comparisons; pub mod filter; pub mod float_sum; pub mod if_then_else; pub mod min_max; +pub mod size; pub mod unique; -pub mod arity; - // Trait to enable the scalar blanket implementation. pub trait NotSimdPrimitive: NativeType {} diff --git a/crates/polars-arrow/src/legacy/kernels/binary.rs b/crates/polars-compute/src/size.rs similarity index 65% rename from crates/polars-arrow/src/legacy/kernels/binary.rs rename to crates/polars-compute/src/size.rs index dca6516e8c24..199a945e1d10 100644 --- a/crates/polars-arrow/src/legacy/kernels/binary.rs +++ b/crates/polars-compute/src/size.rs @@ -1,6 +1,6 @@ -use crate::array::{Array, ArrayRef, BinaryViewArray, UInt32Array}; -use crate::buffer::Buffer; -use crate::datatypes::ArrowDataType; +use arrow::array::{Array, ArrayRef, BinaryViewArray, UInt32Array}; +use arrow::buffer::Buffer; +use arrow::datatypes::ArrowDataType; pub fn binary_size_bytes(array: &BinaryViewArray) -> ArrayRef { let values: Buffer<_> = array.len_iter().collect(); diff --git a/crates/polars-ops/src/chunked_array/binary/namespace.rs b/crates/polars-ops/src/chunked_array/binary/namespace.rs index c34ef31144ab..6e4a29e86874 100644 --- a/crates/polars-ops/src/chunked_array/binary/namespace.rs +++ b/crates/polars-ops/src/chunked_array/binary/namespace.rs @@ -1,12 +1,12 @@ #[cfg(feature = "binary_encoding")] use std::borrow::Cow; -use arrow::legacy::kernels::binary::*; #[cfg(feature = "binary_encoding")] use base64::engine::general_purpose; #[cfg(feature = "binary_encoding")] use base64::Engine as _; use memchr::memmem::find; +use polars_compute::size::binary_size_bytes; use polars_core::prelude::arity::{broadcast_binary_elementwise_values, unary_elementwise_values}; use super::*;