From 6e38a9a865601023097bf4b9bd16b957b66f4a90 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 22e65e2cfda18..cdb7cb9c20570 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 b6ab2642485b4..df8e1df6585ac 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 dca6516e8c245..199a945e1d105 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 24b48abc0bd96..6552a2c0fdb6c 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; use super::*;