diff --git a/Cargo.lock b/Cargo.lock index c8d5c79dc4da..61b10bd731af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2916,6 +2916,7 @@ dependencies = [ "ahash", "apache-avro", "avro-schema", + "chrono", "either", "ethnum", "futures", @@ -3209,6 +3210,7 @@ version = "0.45.1" dependencies = [ "ahash", "bitflags", + "chrono", "futures", "memchr", "once_cell", @@ -3270,6 +3272,7 @@ dependencies = [ "jsonpath_lib_polars_vendor", "memchr", "num-traits", + "once_cell", "polars-arrow", "polars-compute", "polars-core", @@ -3341,6 +3344,7 @@ dependencies = [ "futures", "hashbrown 0.15.2", "num-traits", + "once_cell", "polars-arrow", "polars-compute", "polars-core", @@ -3403,6 +3407,7 @@ dependencies = [ "bincode", "bytemuck", "bytes", + "chrono", "chrono-tz", "either", "flate2", @@ -3413,6 +3418,8 @@ dependencies = [ "numpy", "once_cell", "polars", + "polars-arrow", + "polars-compute", "polars-core", "polars-error", "polars-expr", @@ -3426,6 +3433,7 @@ dependencies = [ "polars-time", "polars-utils", "pyo3", + "rayon", "recursive", "serde_json", "thiserror 2.0.9", @@ -3468,6 +3476,7 @@ dependencies = [ "polars-time", "polars-utils", "rand", + "regex", "serde", "sqlparser", ] @@ -3509,6 +3518,7 @@ dependencies = [ "chrono", "chrono-tz", "now", + "num-traits", "once_cell", "polars-arrow", "polars-compute", @@ -3516,6 +3526,7 @@ dependencies = [ "polars-error", "polars-ops", "polars-utils", + "rayon", "regex", "serde", "strum_macros", diff --git a/crates/polars-core/src/chunked_array/temporal/duration.rs b/crates/polars-core/src/chunked_array/temporal/duration.rs index d7e5e7ae6678..a0a9c07205f8 100644 --- a/crates/polars-core/src/chunked_array/temporal/duration.rs +++ b/crates/polars-core/src/chunked_array/temporal/duration.rs @@ -1,4 +1,5 @@ -use crate::export::chrono::Duration as ChronoDuration; +use chrono::Duration as ChronoDuration; + use crate::fmt::{fmt_duration_string, iso_duration_string}; use crate::prelude::DataType::Duration; use crate::prelude::*; diff --git a/crates/polars-core/src/export.rs b/crates/polars-core/src/export.rs deleted file mode 100644 index af2774f4ff1c..000000000000 --- a/crates/polars-core/src/export.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[cfg(feature = "temporal")] -pub use chrono; -pub use polars_compute::cast; -#[cfg(any(feature = "strings", feature = "temporal"))] -pub use regex; -#[cfg(feature = "serde")] -pub use serde; -pub use {arrow, num_traits as num, once_cell, rayon}; - -pub use crate::hashing::_boost_hash_combine; diff --git a/crates/polars-core/src/fmt.rs b/crates/polars-core/src/fmt.rs index fdfa3b70c40b..2365f99f895c 100644 --- a/crates/polars-core/src/fmt.rs +++ b/crates/polars-core/src/fmt.rs @@ -22,8 +22,6 @@ use comfy_table::modifiers::*; use comfy_table::presets::*; #[cfg(any(feature = "fmt", feature = "fmt_no_tty"))] use comfy_table::*; -#[cfg(feature = "dtype-duration")] -use itoa; use num_traits::{Num, NumCast}; use polars_error::feature_gated; diff --git a/crates/polars-core/src/hashing/mod.rs b/crates/polars-core/src/hashing/mod.rs index 370401eb6e3e..854b7d29737c 100644 --- a/crates/polars-core/src/hashing/mod.rs +++ b/crates/polars-core/src/hashing/mod.rs @@ -6,12 +6,6 @@ use std::hash::{BuildHasherDefault, Hash, Hasher}; pub use identity::*; pub use vector_hasher::*; -// hash combine from c++' boost lib -#[inline] -pub fn _boost_hash_combine(l: u64, r: u64) -> u64 { - l ^ r.wrapping_add(0x9e3779b9u64.wrapping_add(l << 6).wrapping_add(r >> 2)) -} - // We must strike a balance between cache // Overallocation seems a lot more expensive than resizing so we start reasonable small. pub const _HASHMAP_INIT_SIZE: usize = 512; diff --git a/crates/polars-core/src/hashing/vector_hasher.rs b/crates/polars-core/src/hashing/vector_hasher.rs index 81b141711958..77c747597466 100644 --- a/crates/polars-core/src/hashing/vector_hasher.rs +++ b/crates/polars-core/src/hashing/vector_hasher.rs @@ -1,5 +1,5 @@ use arrow::bitmap::utils::get_bit_unchecked; -use polars_utils::hashing::folded_multiply; +use polars_utils::hashing::{_boost_hash_combine, folded_multiply}; use polars_utils::total_ord::{ToTotalOrd, TotalHash}; use rayon::prelude::*; use xxhash_rust::xxh3::xxh3_64_with_seed; diff --git a/crates/polars-core/src/lib.rs b/crates/polars-core/src/lib.rs index 25377fbfe62e..33e3a4ee1413 100644 --- a/crates/polars-core/src/lib.rs +++ b/crates/polars-core/src/lib.rs @@ -10,7 +10,6 @@ pub mod chunked_array; pub mod config; pub mod datatypes; pub mod error; -pub mod export; pub mod fmt; pub mod frame; pub mod functions; diff --git a/crates/polars-expr/src/expressions/window.rs b/crates/polars-expr/src/expressions/window.rs index aa3350a1741d..1514f2f36e79 100644 --- a/crates/polars-expr/src/expressions/window.rs +++ b/crates/polars-expr/src/expressions/window.rs @@ -1,7 +1,7 @@ use std::fmt::Write; use arrow::array::PrimitiveArray; -use polars_core::export::arrow::bitmap::Bitmap; +use arrow::bitmap::Bitmap; use polars_core::prelude::*; use polars_core::series::IsSorted; use polars_core::utils::_split_offsets; diff --git a/crates/polars-lazy/Cargo.toml b/crates/polars-lazy/Cargo.toml index 9ef1d38194cb..c5f848e66767 100644 --- a/crates/polars-lazy/Cargo.toml +++ b/crates/polars-lazy/Cargo.toml @@ -10,6 +10,7 @@ description = "Lazy query engine for the Polars DataFrame library" [dependencies] arrow = { workspace = true } +chrono = { workspace = true } futures = { workspace = true, optional = true } polars-core = { workspace = true, features = ["lazy", "zip_with", "random"] } polars-expr = { workspace = true } diff --git a/crates/polars-lazy/src/tests/mod.rs b/crates/polars-lazy/src/tests/mod.rs index a30203b24fe6..65fd043377da 100644 --- a/crates/polars-lazy/src/tests/mod.rs +++ b/crates/polars-lazy/src/tests/mod.rs @@ -31,11 +31,11 @@ fn load_df() -> DataFrame { use std::io::Cursor; +#[cfg(feature = "temporal")] +use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; use optimization_checks::*; use polars_core::chunked_array::builder::get_list_builder; use polars_core::df; -#[cfg(feature = "temporal")] -use polars_core::export::chrono::{NaiveDate, NaiveDateTime, NaiveTime}; use polars_core::prelude::*; #[cfg(feature = "parquet")] pub(crate) use polars_core::SINGLE_LOCK; diff --git a/crates/polars-lazy/src/tests/queries.rs b/crates/polars-lazy/src/tests/queries.rs index 0c4e518b5042..da2063453ac6 100644 --- a/crates/polars-lazy/src/tests/queries.rs +++ b/crates/polars-lazy/src/tests/queries.rs @@ -419,7 +419,7 @@ fn test_lazy_query_9() -> PolarsResult<()> { feature = "dtype-duration" ))] fn test_lazy_query_10() { - use polars_core::export::chrono::Duration as ChronoDuration; + use chrono::Duration as ChronoDuration; let date = NaiveDate::from_ymd_opt(2021, 3, 5).unwrap(); let x = DatetimeChunked::from_naive_datetime( "x".into(), diff --git a/crates/polars-ops/Cargo.toml b/crates/polars-ops/Cargo.toml index aca43eec83ad..1034bf0db3f4 100644 --- a/crates/polars-ops/Cargo.toml +++ b/crates/polars-ops/Cargo.toml @@ -30,6 +30,7 @@ hex = { workspace = true, optional = true } indexmap = { workspace = true } memchr = { workspace = true } num-traits = { workspace = true } +once_cell = { workspace = true } rand = { workspace = true, optional = true, features = ["small_rng", "std"] } rand_distr = { workspace = true, optional = true } rayon = { workspace = true } diff --git a/crates/polars-ops/src/chunked_array/array/sum_mean.rs b/crates/polars-ops/src/chunked_array/array/sum_mean.rs index 58bd13648ad2..1dae9aa83d9c 100644 --- a/crates/polars-ops/src/chunked_array/array/sum_mean.rs +++ b/crates/polars-ops/src/chunked_array/array/sum_mean.rs @@ -2,7 +2,7 @@ use arrow::array::{Array, PrimitiveArray}; use arrow::bitmap::Bitmap; use arrow::legacy::utils::CustomIterTools; use arrow::types::NativeType; -use polars_core::export::num::{NumCast, ToPrimitive}; +use num_traits::{NumCast, ToPrimitive}; use polars_core::prelude::*; use crate::chunked_array::sum::sum_slice; diff --git a/crates/polars-ops/src/chunked_array/array/to_struct.rs b/crates/polars-ops/src/chunked_array/array/to_struct.rs index 2342c4909159..d316e82888c0 100644 --- a/crates/polars-ops/src/chunked_array/array/to_struct.rs +++ b/crates/polars-ops/src/chunked_array/array/to_struct.rs @@ -1,7 +1,7 @@ -use polars_core::export::rayon::prelude::*; use polars_core::POOL; use polars_utils::format_pl_smallstr; use polars_utils::pl_str::PlSmallStr; +use rayon::prelude::*; use super::*; diff --git a/crates/polars-ops/src/chunked_array/list/hash.rs b/crates/polars-ops/src/chunked_array/list/hash.rs index 90218d7799dd..7e2099d62288 100644 --- a/crates/polars-ops/src/chunked_array/list/hash.rs +++ b/crates/polars-ops/src/chunked_array/list/hash.rs @@ -1,11 +1,11 @@ use std::hash::Hash; -use polars_core::export::_boost_hash_combine; -use polars_core::export::rayon::prelude::*; use polars_core::series::BitRepr; use polars_core::utils::NoNull; use polars_core::{with_match_physical_float_polars_type, POOL}; +use polars_utils::hashing::_boost_hash_combine; use polars_utils::total_ord::{ToTotalOrd, TotalHash}; +use rayon::prelude::*; use super::*; diff --git a/crates/polars-ops/src/chunked_array/list/namespace.rs b/crates/polars-ops/src/chunked_array/list/namespace.rs index 5c21a7e65ac3..5209cee70f52 100644 --- a/crates/polars-ops/src/chunked_array/list/namespace.rs +++ b/crates/polars-ops/src/chunked_array/list/namespace.rs @@ -1,12 +1,12 @@ use std::fmt::Write; use arrow::array::ValueSize; -use polars_compute::gather::sublist::list::{index_is_oob, sublist_get}; -use polars_core::chunked_array::builder::get_list_builder; #[cfg(feature = "list_gather")] -use polars_core::export::num::ToPrimitive; +use num_traits::ToPrimitive; #[cfg(feature = "list_gather")] -use polars_core::export::num::{NumCast, Signed, Zero}; +use num_traits::{NumCast, Signed, Zero}; +use polars_compute::gather::sublist::list::{index_is_oob, sublist_get}; +use polars_core::chunked_array::builder::get_list_builder; #[cfg(feature = "diff")] use polars_core::series::ops::NullBehavior; use polars_core::utils::try_get_supertype; diff --git a/crates/polars-ops/src/chunked_array/list/sum_mean.rs b/crates/polars-ops/src/chunked_array/list/sum_mean.rs index 9413318f1eac..fb26cb17872e 100644 --- a/crates/polars-ops/src/chunked_array/list/sum_mean.rs +++ b/crates/polars-ops/src/chunked_array/list/sum_mean.rs @@ -4,7 +4,7 @@ use arrow::array::{Array, PrimitiveArray}; use arrow::bitmap::Bitmap; use arrow::compute::utils::combine_validities_and; use arrow::types::NativeType; -use polars_core::export::num::{NumCast, ToPrimitive}; +use num_traits::{NumCast, ToPrimitive}; use super::*; use crate::chunked_array::sum::sum_slice; diff --git a/crates/polars-ops/src/chunked_array/list/to_struct.rs b/crates/polars-ops/src/chunked_array/list/to_struct.rs index fad1bcebb9a1..4b0ccde25a45 100644 --- a/crates/polars-ops/src/chunked_array/list/to_struct.rs +++ b/crates/polars-ops/src/chunked_array/list/to_struct.rs @@ -1,7 +1,7 @@ -use polars_core::export::rayon::prelude::*; use polars_core::POOL; use polars_utils::format_pl_smallstr; use polars_utils::pl_str::PlSmallStr; +use rayon::prelude::*; use super::*; diff --git a/crates/polars-ops/src/chunked_array/strings/extract.rs b/crates/polars-ops/src/chunked_array/strings/extract.rs index e7068e96b614..421b91486b08 100644 --- a/crates/polars-ops/src/chunked_array/strings/extract.rs +++ b/crates/polars-ops/src/chunked_array/strings/extract.rs @@ -3,8 +3,8 @@ use std::iter::zip; #[cfg(feature = "extract_groups")] use arrow::array::{Array, StructArray}; use arrow::array::{MutablePlString, Utf8ViewArray}; -use polars_core::export::regex::Regex; use polars_core::prelude::arity::{try_binary_mut_with_options, try_unary_mut_with_options}; +use regex::Regex; use super::*; diff --git a/crates/polars-ops/src/chunked_array/strings/namespace.rs b/crates/polars-ops/src/chunked_array/strings/namespace.rs index 45f02195e73f..bbcf2a297e84 100644 --- a/crates/polars-ops/src/chunked_array/strings/namespace.rs +++ b/crates/polars-ops/src/chunked_array/strings/namespace.rs @@ -5,11 +5,10 @@ use base64::engine::general_purpose; #[cfg(feature = "string_encoding")] use base64::Engine as _; #[cfg(feature = "string_to_integer")] -use polars_core::export::num::Num; -use polars_core::export::regex::Regex; +use num_traits::Num; use polars_core::prelude::arity::*; use polars_utils::cache::FastFixedCache; -use regex::escape; +use regex::{escape, Regex}; use super::*; #[cfg(feature = "binary_encoding")] diff --git a/crates/polars-ops/src/chunked_array/sum.rs b/crates/polars-ops/src/chunked_array/sum.rs index 03138bd79a5b..f07ce2b4071c 100644 --- a/crates/polars-ops/src/chunked_array/sum.rs +++ b/crates/polars-ops/src/chunked_array/sum.rs @@ -1,5 +1,5 @@ use arrow::types::NativeType; -use polars_core::export::num::{NumCast, ToPrimitive}; +use num_traits::{NumCast, ToPrimitive}; pub(super) fn sum_slice(values: &[T]) -> S where diff --git a/crates/polars-ops/src/frame/join/args.rs b/crates/polars-ops/src/frame/join/args.rs index 903cd6e2e9f2..27d4719ef47d 100644 --- a/crates/polars-ops/src/frame/join/args.rs +++ b/crates/polars-ops/src/frame/join/args.rs @@ -15,7 +15,7 @@ pub type ChunkJoinOptIds = Vec; #[cfg(not(feature = "chunked_ids"))] pub type ChunkJoinIds = Vec; -use polars_core::export::once_cell::sync::Lazy; +use once_cell::sync::Lazy; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use strum_macros::IntoStaticStr; diff --git a/crates/polars-ops/src/frame/mod.rs b/crates/polars-ops/src/frame/mod.rs index d72ff4488251..61712317dfe5 100644 --- a/crates/polars-ops/src/frame/mod.rs +++ b/crates/polars-ops/src/frame/mod.rs @@ -3,13 +3,13 @@ pub mod join; pub mod pivot; pub use join::*; -#[cfg(feature = "to_dummies")] -use polars_core::export::rayon::prelude::*; use polars_core::prelude::*; #[cfg(feature = "to_dummies")] use polars_core::utils::accumulate_dataframes_horizontal; #[cfg(feature = "to_dummies")] use polars_core::POOL; +#[cfg(feature = "to_dummies")] +use rayon::prelude::*; pub trait IntoDf { fn to_df(&self) -> &DataFrame; diff --git a/crates/polars-ops/src/frame/pivot/mod.rs b/crates/polars-ops/src/frame/pivot/mod.rs index f91e665698e0..34d553a65db0 100644 --- a/crates/polars-ops/src/frame/pivot/mod.rs +++ b/crates/polars-ops/src/frame/pivot/mod.rs @@ -3,12 +3,12 @@ mod unpivot; use std::borrow::Cow; -use polars_core::export::rayon::prelude::*; use polars_core::frame::group_by::expr::PhysicalAggExpr; use polars_core::prelude::*; use polars_core::utils::_split_offsets; use polars_core::{downcast_as_macro_arg_physical, POOL}; use polars_utils::format_pl_smallstr; +use rayon::prelude::*; pub use unpivot::UnpivotDF; const HASHMAP_INIT_SIZE: usize = 512; diff --git a/crates/polars-ops/src/prelude.rs b/crates/polars-ops/src/prelude.rs index 2353afaefbc8..f4586f417de9 100644 --- a/crates/polars-ops/src/prelude.rs +++ b/crates/polars-ops/src/prelude.rs @@ -1,5 +1,5 @@ #[allow(unused_imports)] -pub(crate) use {crate::series::*, polars_core::export::rayon::prelude::*}; +pub(crate) use {crate::series::*, rayon::prelude::*}; pub use crate::chunked_array::*; #[cfg(feature = "merge_sorted")] diff --git a/crates/polars-ops/src/series/ops/interpolation/interpolate.rs b/crates/polars-ops/src/series/ops/interpolation/interpolate.rs index 095b38a6b20e..96b6e3205ff9 100644 --- a/crates/polars-ops/src/series/ops/interpolation/interpolate.rs +++ b/crates/polars-ops/src/series/ops/interpolation/interpolate.rs @@ -2,8 +2,8 @@ use std::ops::{Add, Div, Mul, Sub}; use arrow::array::PrimitiveArray; use arrow::bitmap::MutableBitmap; +use num_traits::{NumCast, Zero}; use polars_core::downcast_as_macro_arg_physical; -use polars_core::export::num::{NumCast, Zero}; use polars_core::prelude::*; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; diff --git a/crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs b/crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs index 328d67763cfb..986215664bd2 100644 --- a/crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs +++ b/crates/polars-ops/src/series/ops/interpolation/interpolate_by.rs @@ -3,7 +3,7 @@ use std::ops::{Add, Div, Mul, Sub}; use arrow::array::PrimitiveArray; use arrow::bitmap::MutableBitmap; use bytemuck::allocation::zeroed_vec; -use polars_core::export::num::{NumCast, Zero}; +use num_traits::{NumCast, Zero}; use polars_core::prelude::*; use polars_utils::slice::SliceAble; diff --git a/crates/polars-ops/src/series/ops/rolling.rs b/crates/polars-ops/src/series/ops/rolling.rs index ca5633c4ac07..cc77f457d48d 100644 --- a/crates/polars-ops/src/series/ops/rolling.rs +++ b/crates/polars-ops/src/series/ops/rolling.rs @@ -2,7 +2,7 @@ use polars_core::prelude::*; #[cfg(feature = "moment")] use { crate::series::ops::moment::MomentSeries, - polars_core::export::num::{self, Float, FromPrimitive}, + num_traits::{pow::Pow, Float, FromPrimitive}, polars_core::utils::with_unstable_series, std::ops::SubAssign, }; @@ -18,7 +18,7 @@ fn rolling_skew( where ChunkedArray: IntoSeries, T: PolarsFloatType, - T::Native: Float + SubAssign + num::pow::Pow, + T::Native: Float + SubAssign + Pow, { with_unstable_series(ca.dtype(), |us| { ca.rolling_map_float(window_size, |arr| { diff --git a/crates/polars-pipe/Cargo.toml b/crates/polars-pipe/Cargo.toml index 2d5bbf4ba0e1..d8cd3f379adf 100644 --- a/crates/polars-pipe/Cargo.toml +++ b/crates/polars-pipe/Cargo.toml @@ -11,6 +11,7 @@ description = "Lazy query engine for the Polars DataFrame library" [dependencies] arrow = { workspace = true } futures = { workspace = true, optional = true } +once_cell = { workspace = true } polars-compute = { workspace = true } polars-core = { workspace = true, features = ["lazy", "zip_with", "random", "rows"] } polars-expr = { workspace = true } diff --git a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/mean.rs b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/mean.rs index 0be644ed28ff..7a24dc866e29 100644 --- a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/mean.rs +++ b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/mean.rs @@ -2,9 +2,9 @@ use std::any::Any; use std::ops::Add; use arrow::array::{Array, PrimitiveArray}; +use arrow::datatypes::PrimitiveType; +use num_traits::NumCast; use polars_compute::sum::{wrapping_sum_arr, WrappingSum}; -use polars_core::export::arrow::datatypes::PrimitiveType; -use polars_core::export::num::NumCast; use polars_core::prelude::*; use super::*; diff --git a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/min_max.rs b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/min_max.rs index 8d543a46a7ca..ef97d3ea0017 100644 --- a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/min_max.rs +++ b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/min_max.rs @@ -1,8 +1,8 @@ use std::any::Any; use arrow::array::PrimitiveArray; +use num_traits::NumCast; use polars_compute::min_max::MinMaxKernel; -use polars_core::export::num::NumCast; use polars_core::prelude::*; use polars_utils::min_max::MinMax; diff --git a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/sum.rs b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/sum.rs index a1c42029b332..e29ee29b0ebc 100644 --- a/crates/polars-pipe/src/executors/sinks/group_by/aggregates/sum.rs +++ b/crates/polars-pipe/src/executors/sinks/group_by/aggregates/sum.rs @@ -2,8 +2,8 @@ use std::any::Any; use std::ops::Add; use arrow::array::PrimitiveArray; +use num_traits::NumCast; use polars_compute::sum::{wrapping_sum_arr, WrappingSum}; -use polars_core::export::num::NumCast; use polars_core::prelude::*; use super::*; diff --git a/crates/polars-pipe/src/executors/sinks/group_by/generic/thread_local.rs b/crates/polars-pipe/src/executors/sinks/group_by/generic/thread_local.rs index 32d1239d8491..4c863e069802 100644 --- a/crates/polars-pipe/src/executors/sinks/group_by/generic/thread_local.rs +++ b/crates/polars-pipe/src/executors/sinks/group_by/generic/thread_local.rs @@ -1,6 +1,5 @@ use arrow::array::MutableBinaryArray; use once_cell::sync::Lazy; -use polars_core::export::once_cell; use polars_utils::hashing::hash_to_partition; use super::*; diff --git a/crates/polars-plan/src/dsl/function_expr/pow.rs b/crates/polars-plan/src/dsl/function_expr/pow.rs index eb6eefc73c3e..e30f4538d8dd 100644 --- a/crates/polars-plan/src/dsl/function_expr/pow.rs +++ b/crates/polars-plan/src/dsl/function_expr/pow.rs @@ -1,7 +1,5 @@ -use num::pow::Pow; -use num_traits::{One, Zero}; -use polars_core::export::num; -use polars_core::export::num::{Float, ToPrimitive}; +use num_traits::pow::Pow; +use num_traits::{Float, One, ToPrimitive, Zero}; use polars_core::prelude::arity::{broadcast_binary_elementwise, unary_elementwise_values}; use polars_core::with_match_physical_integer_type; @@ -33,7 +31,7 @@ fn pow_on_chunked_arrays( where T: PolarsNumericType, F: PolarsNumericType, - T::Native: num::pow::Pow + ToPrimitive, + T::Native: Pow + ToPrimitive, { if exponent.len() == 1 { if let Some(e) = exponent.get(0) { @@ -58,7 +56,7 @@ fn pow_on_floats( ) -> PolarsResult> where T: PolarsFloatType, - T::Native: num::pow::Pow + ToPrimitive + Float, + T::Native: Pow + ToPrimitive + Float, ChunkedArray: IntoColumn, { let dtype = T::get_dtype(); @@ -101,7 +99,7 @@ fn pow_to_uint_dtype( where T: PolarsIntegerType, F: PolarsIntegerType, - T::Native: num::pow::Pow + ToPrimitive, + T::Native: Pow + ToPrimitive, ChunkedArray: IntoColumn, { let dtype = T::get_dtype(); @@ -228,7 +226,7 @@ pub(super) fn sqrt(base: &Column) -> PolarsResult { fn sqrt_on_floats(base: &ChunkedArray) -> PolarsResult where T: PolarsFloatType, - T::Native: num::pow::Pow + ToPrimitive + Float, + T::Native: Pow + ToPrimitive + Float, ChunkedArray: IntoColumn, { Ok(base.apply_values(|v| v.sqrt()).into_column()) @@ -255,7 +253,7 @@ pub(super) fn cbrt(base: &Column) -> PolarsResult { fn cbrt_on_floats(base: &ChunkedArray) -> PolarsResult where T: PolarsFloatType, - T::Native: num::pow::Pow + ToPrimitive + Float, + T::Native: Pow + ToPrimitive + Float, ChunkedArray: IntoColumn, { Ok(base.apply_values(|v| v.cbrt()).into_column()) diff --git a/crates/polars-plan/src/dsl/function_expr/sign.rs b/crates/polars-plan/src/dsl/function_expr/sign.rs index 3c0f8cf73d90..3b8b886b0787 100644 --- a/crates/polars-plan/src/dsl/function_expr/sign.rs +++ b/crates/polars-plan/src/dsl/function_expr/sign.rs @@ -1,5 +1,4 @@ -use num::{One, Zero}; -use polars_core::export::num; +use num_traits::{One, Zero}; use polars_core::with_match_physical_numeric_polars_type; use super::*; diff --git a/crates/polars-plan/src/dsl/function_expr/trigonometry.rs b/crates/polars-plan/src/dsl/function_expr/trigonometry.rs index cceed34f9110..42ce312fd2f8 100644 --- a/crates/polars-plan/src/dsl/function_expr/trigonometry.rs +++ b/crates/polars-plan/src/dsl/function_expr/trigonometry.rs @@ -1,6 +1,5 @@ -use num::Float; +use num_traits::Float; use polars_core::chunked_array::ops::arity::broadcast_binary_elementwise; -use polars_core::export::num; use super::*; diff --git a/crates/polars-plan/src/plans/lit.rs b/crates/polars-plan/src/plans/lit.rs index 7ab7bb21003f..f26e8bc318d0 100644 --- a/crates/polars-plan/src/plans/lit.rs +++ b/crates/polars-plan/src/plans/lit.rs @@ -1,7 +1,7 @@ use std::hash::{Hash, Hasher}; #[cfg(feature = "temporal")] -use polars_core::export::chrono::{Duration as ChronoDuration, NaiveDate, NaiveDateTime}; +use chrono::{Duration as ChronoDuration, NaiveDate, NaiveDateTime}; use polars_core::prelude::*; use polars_core::utils::materialize_dyn_int; use polars_utils::hashing::hash_to_partition; diff --git a/crates/polars-plan/src/plans/optimizer/cse/cse_expr.rs b/crates/polars-plan/src/plans/optimizer/cse/cse_expr.rs index ee0b9472ac01..fcfc61b9faed 100644 --- a/crates/polars-plan/src/plans/optimizer/cse/cse_expr.rs +++ b/crates/polars-plan/src/plans/optimizer/cse/cse_expr.rs @@ -8,7 +8,7 @@ use crate::prelude::visitor::AexprNode; const SERIES_LIMIT: usize = 1000; -use polars_core::hashing::_boost_hash_combine; +use polars_utils::hashing::_boost_hash_combine; #[derive(Debug, Clone)] struct ProjectionExprs { diff --git a/crates/polars-plan/src/plans/optimizer/cse/cse_lp.rs b/crates/polars-plan/src/plans/optimizer/cse/cse_lp.rs index f4522ee3a3ca..a982e4b088c7 100644 --- a/crates/polars-plan/src/plans/optimizer/cse/cse_lp.rs +++ b/crates/polars-plan/src/plans/optimizer/cse/cse_lp.rs @@ -4,7 +4,7 @@ use super::*; use crate::prelude::visitor::IRNode; mod identifier_impl { - use polars_core::hashing::_boost_hash_combine; + use polars_utils::hashing::_boost_hash_combine; use super::*; /// Identifier that shows the sub-expression path. diff --git a/crates/polars-python/Cargo.toml b/crates/polars-python/Cargo.toml index 5376bf87388e..475f79a4979b 100644 --- a/crates/polars-python/Cargo.toml +++ b/crates/polars-python/Cargo.toml @@ -9,6 +9,7 @@ repository = { workspace = true } description = "Enable running Polars workloads in Python" [dependencies] +polars-compute = { workspace = true } polars-core = { workspace = true, features = ["python"] } polars-error = { workspace = true } polars-expr = { workspace = true } @@ -27,9 +28,11 @@ polars-utils = { workspace = true } ahash = { workspace = true } arboard = { workspace = true, optional = true } +arrow = { workspace = true } bincode = { workspace = true } bytemuck = { workspace = true } bytes = { workspace = true } +chrono = { workspace = true } chrono-tz = { workspace = true } either = { workspace = true } flate2 = { workspace = true } @@ -40,6 +43,7 @@ num-traits = { workspace = true } numpy = { workspace = true } once_cell = { workspace = true } pyo3 = { workspace = true, features = ["abi3-py39", "chrono", "chrono-tz", "multiple-pymethods"] } +rayon = { workspace = true } recursive = { workspace = true } serde_json = { workspace = true, optional = true } thiserror = { workspace = true } diff --git a/crates/polars-python/src/conversion/any_value.rs b/crates/polars-python/src/conversion/any_value.rs index 18c133eb5a45..54cd8544f669 100644 --- a/crates/polars-python/src/conversion/any_value.rs +++ b/crates/polars-python/src/conversion/any_value.rs @@ -1,16 +1,15 @@ use std::borrow::{Borrow, Cow}; +use chrono::{ + DateTime, Datelike, FixedOffset, NaiveDate, NaiveDateTime, NaiveTime, TimeDelta, Timelike, +}; use chrono_tz::Tz; #[cfg(feature = "object")] use polars::chunked_array::object::PolarsObjectSafe; #[cfg(feature = "object")] use polars::datatypes::OwnedObject; use polars::datatypes::{DataType, Field, PlHashMap, TimeUnit}; -use polars::export::chrono::{DateTime, FixedOffset}; use polars::prelude::{AnyValue, PlSmallStr, Series}; -use polars_core::export::chrono::{ - Datelike, NaiveDate, NaiveDateTime, NaiveTime, TimeDelta, Timelike, -}; use polars_core::utils::any_values_to_supertype_and_n_dtypes; use polars_core::utils::arrow::temporal_conversions::date32_to_date; use pyo3::exceptions::{PyOverflowError, PyTypeError, PyValueError}; diff --git a/crates/polars-python/src/conversion/chunked_array.rs b/crates/polars-python/src/conversion/chunked_array.rs index 8e5e56d61350..3d30aa213b7a 100644 --- a/crates/polars-python/src/conversion/chunked_array.rs +++ b/crates/polars-python/src/conversion/chunked_array.rs @@ -1,4 +1,4 @@ -use polars_core::export::chrono::NaiveTime; +use chrono::NaiveTime; use polars_core::utils::arrow::temporal_conversions::date32_to_date; use pyo3::prelude::*; use pyo3::types::{PyBytes, PyList, PyNone, PyTuple}; diff --git a/crates/polars-python/src/conversion/datetime.rs b/crates/polars-python/src/conversion/datetime.rs index 95273819b126..1d6b36d87e98 100644 --- a/crates/polars-python/src/conversion/datetime.rs +++ b/crates/polars-python/src/conversion/datetime.rs @@ -2,12 +2,10 @@ use std::str::FromStr; +use chrono::{DateTime, FixedOffset, NaiveDateTime, NaiveTime, TimeDelta, TimeZone as _}; use chrono_tz::Tz; use polars::datatypes::TimeUnit; use polars_core::datatypes::TimeZone; -use polars_core::export::chrono::{ - DateTime, FixedOffset, NaiveDateTime, NaiveTime, TimeDelta, TimeZone as _, -}; use pyo3::{Bound, IntoPyObject, PyAny, PyResult, Python}; use crate::error::PyPolarsErr; diff --git a/crates/polars-python/src/dataframe/export.rs b/crates/polars-python/src/dataframe/export.rs index a438644363a0..cddce22ccda8 100644 --- a/crates/polars-python/src/dataframe/export.rs +++ b/crates/polars-python/src/dataframe/export.rs @@ -1,7 +1,7 @@ -use polars::export::arrow::record_batch::RecordBatch; +use arrow::datatypes::IntegerType; +use arrow::record_batch::RecordBatch; use polars::prelude::*; -use polars_core::export::arrow::datatypes::IntegerType; -use polars_core::export::cast::CastOptionsImpl; +use polars_compute::cast::CastOptionsImpl; use pyo3::prelude::*; use pyo3::types::{PyCapsule, PyList, PyTuple}; use pyo3::IntoPyObjectExt; @@ -136,7 +136,7 @@ impl PyDataFrame { for i in &cat_columns { let arr = arrays.get_mut(*i).unwrap(); - let out = polars_core::export::cast::cast( + let out = polars_compute::cast::cast( &**arr, &enum_and_categorical_dtype, CastOptionsImpl::default(), diff --git a/crates/polars-python/src/dataframe/general.rs b/crates/polars-python/src/dataframe/general.rs index af0ff8928bdb..bffd1a9ab855 100644 --- a/crates/polars-python/src/dataframe/general.rs +++ b/crates/polars-python/src/dataframe/general.rs @@ -1,7 +1,7 @@ use std::mem::ManuallyDrop; +use arrow::bitmap::MutableBitmap; use either::Either; -use polars::export::arrow::bitmap::MutableBitmap; use polars::prelude::*; #[cfg(feature = "pivot")] use polars_lazy::frame::pivot::{pivot, pivot_stable}; diff --git a/crates/polars-python/src/functions/io.rs b/crates/polars-python/src/functions/io.rs index 064b31793ede..8aa4e7ce3403 100644 --- a/crates/polars-python/src/functions/io.rs +++ b/crates/polars-python/src/functions/io.rs @@ -1,9 +1,9 @@ use std::io::BufReader; +use arrow::array::Utf8ViewArray; #[cfg(any(feature = "ipc", feature = "parquet"))] use polars::prelude::ArrowSchema; use polars_core::datatypes::create_enum_dtype; -use polars_core::export::arrow::array::Utf8ViewArray; use pyo3::prelude::*; use pyo3::types::PyDict; @@ -15,7 +15,7 @@ use crate::prelude::ArrowDataType; #[cfg(feature = "ipc")] #[pyfunction] pub fn read_ipc_schema(py: Python, py_f: PyObject) -> PyResult> { - use polars_core::export::arrow::io::ipc::read::read_file_metadata; + use arrow::io::ipc::read::read_file_metadata; let metadata = match get_either_file(py_f, false)? { EitherRustPythonFile::Rust(r) => { read_file_metadata(&mut BufReader::new(r)).map_err(PyPolarsErr::from)? diff --git a/crates/polars-python/src/interop/arrow/to_rust.rs b/crates/polars-python/src/interop/arrow/to_rust.rs index 81f005a26ebc..10407cb728ac 100644 --- a/crates/polars-python/src/interop/arrow/to_rust.rs +++ b/crates/polars-python/src/interop/arrow/to_rust.rs @@ -1,4 +1,3 @@ -use polars_core::export::rayon::prelude::*; use polars_core::prelude::*; use polars_core::utils::accumulate_dataframes_vertical_unchecked; use polars_core::utils::arrow::ffi; @@ -6,6 +5,7 @@ use polars_core::POOL; use pyo3::ffi::Py_uintptr_t; use pyo3::prelude::*; use pyo3::types::PyList; +use rayon::prelude::*; use crate::error::PyPolarsErr; diff --git a/crates/polars-python/src/map/lazy.rs b/crates/polars-python/src/map/lazy.rs index 13189b24f0d3..35baada61fcf 100644 --- a/crates/polars-python/src/map/lazy.rs +++ b/crates/polars-python/src/map/lazy.rs @@ -51,7 +51,7 @@ impl ToSeries for PyObject { // Eventually we must use Polars' Series Export as that can deal with // multiple chunks Err(_) => { - use polars::export::arrow::ffi; + use arrow::ffi; let kwargs = PyDict::new(py); kwargs.set_item("in_place", true).unwrap(); py_pyseries diff --git a/crates/polars-python/src/map/mod.rs b/crates/polars-python/src/map/mod.rs index 87ceaa5ab425..e635b3287b91 100644 --- a/crates/polars-python/src/map/mod.rs +++ b/crates/polars-python/src/map/mod.rs @@ -4,16 +4,16 @@ pub mod series; use std::collections::BTreeMap; +use arrow::bitmap::BitmapBuilder; use polars::chunked_array::builder::get_list_builder; -use polars::export::arrow::bitmap::BitmapBuilder; use polars::prelude::*; -use polars_core::export::rayon::prelude::*; use polars_core::utils::CustomIterTools; use polars_core::POOL; use polars_utils::pl_str::PlSmallStr; use pyo3::prelude::*; use pyo3::pybacked::PyBackedStr; use pyo3::types::PyDict; +use rayon::prelude::*; use crate::error::PyPolarsErr; use crate::prelude::ObjectValue; diff --git a/crates/polars-python/src/series/buffers.rs b/crates/polars-python/src/series/buffers.rs index 956e13e578cf..f2d584e639d9 100644 --- a/crates/polars-python/src/series/buffers.rs +++ b/crates/polars-python/src/series/buffers.rs @@ -12,12 +12,11 @@ //! operations on String Series will convert from/to such buffers. This //! conversion requires data to be copied. -use polars::export::arrow; -use polars::export::arrow::array::{Array, BooleanArray, PrimitiveArray, Utf8Array}; -use polars::export::arrow::bitmap::Bitmap; -use polars::export::arrow::buffer::Buffer; -use polars::export::arrow::offset::OffsetsBuffer; -use polars::export::arrow::types::NativeType; +use arrow::array::{Array, BooleanArray, PrimitiveArray, Utf8Array}; +use arrow::bitmap::Bitmap; +use arrow::buffer::Buffer; +use arrow::offset::OffsetsBuffer; +use arrow::types::NativeType; use polars::prelude::*; use polars_core::{with_match_physical_numeric_polars_type, with_match_physical_numeric_type}; use pyo3::exceptions::PyTypeError; @@ -136,7 +135,7 @@ fn get_buffers_from_string(s: &Series) -> PyResult<(PySeries, Option, let arr_binview = ca.downcast_iter().next().unwrap(); // This is not zero-copy - let arr_utf8 = polars_core::export::cast::utf8view_to_utf8(arr_binview); + let arr_utf8 = polars_compute::cast::utf8view_to_utf8(arr_binview); let values = get_string_bytes(&arr_utf8)?; let validity = get_bitmap(&s); diff --git a/crates/polars-python/src/series/c_interface.rs b/crates/polars-python/src/series/c_interface.rs index e978efbf58b7..072f8b324807 100644 --- a/crates/polars-python/src/series/c_interface.rs +++ b/crates/polars-python/src/series/c_interface.rs @@ -1,4 +1,3 @@ -use polars::export::arrow; use polars::prelude::*; use pyo3::ffi::Py_uintptr_t; use pyo3::prelude::*; diff --git a/crates/polars-python/src/series/construction.rs b/crates/polars-python/src/series/construction.rs index 91cc012fec1f..8ef29a44de49 100644 --- a/crates/polars-python/src/series/construction.rs +++ b/crates/polars-python/src/series/construction.rs @@ -1,10 +1,9 @@ use std::borrow::Cow; +use arrow::array::Array; +use arrow::bitmap::BitmapBuilder; +use arrow::types::NativeType; use numpy::{Element, PyArray1, PyArrayMethods}; -use polars::export::arrow; -use polars::export::arrow::array::Array; -use polars::export::arrow::bitmap::BitmapBuilder; -use polars::export::arrow::types::NativeType; use polars_core::prelude::*; use polars_core::utils::CustomIterTools; use pyo3::exceptions::{PyTypeError, PyValueError}; diff --git a/crates/polars-python/src/series/import.rs b/crates/polars-python/src/series/import.rs index 9b2f20aa93ed..ffe88fed1eac 100644 --- a/crates/polars-python/src/series/import.rs +++ b/crates/polars-python/src/series/import.rs @@ -1,9 +1,6 @@ -use polars::export::arrow; -use polars::export::arrow::array::Array; -use polars::export::arrow::ffi; -use polars::export::arrow::ffi::{ - ArrowArray, ArrowArrayStream, ArrowArrayStreamReader, ArrowSchema, -}; +use arrow::array::Array; +use arrow::ffi; +use arrow::ffi::{ArrowArray, ArrowArrayStream, ArrowArrayStreamReader, ArrowSchema}; use polars::prelude::*; use pyo3::exceptions::{PyTypeError, PyValueError}; use pyo3::prelude::*; diff --git a/crates/polars-python/src/series/scatter.rs b/crates/polars-python/src/series/scatter.rs index 798cd189a9b6..8dde909e2dbb 100644 --- a/crates/polars-python/src/series/scatter.rs +++ b/crates/polars-python/src/series/scatter.rs @@ -1,4 +1,4 @@ -use polars::export::arrow::array::Array; +use arrow::array::Array; use polars::prelude::*; use pyo3::prelude::*; diff --git a/crates/polars-sql/Cargo.toml b/crates/polars-sql/Cargo.toml index 3cd2cafabb91..581f169af0f6 100644 --- a/crates/polars-sql/Cargo.toml +++ b/crates/polars-sql/Cargo.toml @@ -19,6 +19,7 @@ polars-utils = { workspace = true } hex = { workspace = true } rand = { workspace = true } +regex = { workspace = true } serde = { workspace = true } sqlparser = { workspace = true } diff --git a/crates/polars-sql/src/context.rs b/crates/polars-sql/src/context.rs index 6a76f290d4dd..8287b94ecd4f 100644 --- a/crates/polars-sql/src/context.rs +++ b/crates/polars-sql/src/context.rs @@ -1,7 +1,6 @@ use std::cell::RefCell; use std::ops::Deref; -use polars_core::export::regex; use polars_core::frame::row::Row; use polars_core::prelude::*; use polars_lazy::prelude::*; diff --git a/crates/polars-sql/src/functions.rs b/crates/polars-sql/src/functions.rs index c3dbf79773b0..939c4ba1702e 100644 --- a/crates/polars-sql/src/functions.rs +++ b/crates/polars-sql/src/functions.rs @@ -1,7 +1,6 @@ use std::ops::Sub; use polars_core::chunked_array::ops::{SortMultipleOptions, SortOptions}; -use polars_core::export::regex; use polars_core::prelude::{ polars_bail, polars_err, DataType, PolarsResult, QuantileMethod, Schema, TimeUnit, }; diff --git a/crates/polars-sql/src/sql_expr.rs b/crates/polars-sql/src/sql_expr.rs index 4ecb2f8f9ad4..137f286fb014 100644 --- a/crates/polars-sql/src/sql_expr.rs +++ b/crates/polars-sql/src/sql_expr.rs @@ -9,7 +9,6 @@ use std::fmt::Display; use std::ops::Div; -use polars_core::export::regex; use polars_core::prelude::*; use polars_lazy::prelude::*; use polars_plan::prelude::typed_lit; diff --git a/crates/polars-sql/src/types.rs b/crates/polars-sql/src/types.rs index 800ead8c233e..d8df0402ab1c 100644 --- a/crates/polars-sql/src/types.rs +++ b/crates/polars-sql/src/types.rs @@ -2,9 +2,9 @@ //! //! It also provides utility functions for working with SQL datatypes. use polars_core::datatypes::{DataType, TimeUnit}; -use polars_core::export::regex::{Regex, RegexBuilder}; use polars_error::{polars_bail, PolarsResult}; use polars_plan::dsl::{lit, Expr}; +use regex::{Regex, RegexBuilder}; use sqlparser::ast::{ ArrayElemTypeDef, DataType as SQLDataType, ExactNumberInfo, Ident, ObjectName, TimezoneInfo, }; diff --git a/crates/polars-time/Cargo.toml b/crates/polars-time/Cargo.toml index 2d86a00f12fc..d144b177174b 100644 --- a/crates/polars-time/Cargo.toml +++ b/crates/polars-time/Cargo.toml @@ -21,7 +21,9 @@ bytemuck = { workspace = true } chrono = { workspace = true } chrono-tz = { workspace = true, optional = true } now = { version = "0.1" } +num-traits = { workspace = true } once_cell = { workspace = true } +rayon = { workspace = true } regex = { workspace = true } serde = { workspace = true, optional = true } strum_macros = { workspace = true } diff --git a/crates/polars-time/src/chunkedarray/date.rs b/crates/polars-time/src/chunkedarray/date.rs index 205382e08d47..944648311528 100644 --- a/crates/polars-time/src/chunkedarray/date.rs +++ b/crates/polars-time/src/chunkedarray/date.rs @@ -1,5 +1,5 @@ use arrow::temporal_conversions::{EPOCH_DAYS_FROM_CE, MILLISECONDS, SECONDS_IN_DAY}; -use polars_core::export::chrono::{Datelike, NaiveDate}; +use chrono::{Datelike, NaiveDate}; use polars_core::utils::CustomIterTools; use super::*; diff --git a/crates/polars-time/src/chunkedarray/rolling_window/rolling_kernels/mod.rs b/crates/polars-time/src/chunkedarray/rolling_window/rolling_kernels/mod.rs index 1106a679e30f..cabc2a24f954 100644 --- a/crates/polars-time/src/chunkedarray/rolling_window/rolling_kernels/mod.rs +++ b/crates/polars-time/src/chunkedarray/rolling_window/rolling_kernels/mod.rs @@ -5,7 +5,7 @@ use std::ops::{AddAssign, Mul, SubAssign}; use arrow::array::{ArrayRef, PrimitiveArray}; use arrow::trusted_len::TrustedLen; use arrow::types::NativeType; -use polars_core::export::num::{Bounded, Float, NumCast}; +use num_traits::{Bounded, Float, NumCast}; use polars_core::prelude::*; use polars_utils::float::IsFloat; diff --git a/crates/polars-time/src/group_by/dynamic.rs b/crates/polars-time/src/group_by/dynamic.rs index 8a60ba753463..61631b5ffae0 100644 --- a/crates/polars-time/src/group_by/dynamic.rs +++ b/crates/polars-time/src/group_by/dynamic.rs @@ -1,6 +1,5 @@ use arrow::legacy::time_zone::Tz; use arrow::legacy::utils::CustomIterTools; -use polars_core::export::rayon::prelude::*; use polars_core::prelude::*; use polars_core::series::IsSorted; use polars_core::utils::flatten::flatten_par; @@ -9,6 +8,7 @@ use polars_ops::series::SeriesMethods; use polars_utils::idx_vec::IdxVec; use polars_utils::pl_str::PlSmallStr; use polars_utils::slice::SortedSlice; +use rayon::prelude::*; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; diff --git a/crates/polars-time/src/windows/duration.rs b/crates/polars-time/src/windows/duration.rs index da78e74afba3..9d162062e295 100644 --- a/crates/polars-time/src/windows/duration.rs +++ b/crates/polars-time/src/windows/duration.rs @@ -6,12 +6,11 @@ use std::ops::{Mul, Neg}; use arrow::legacy::kernels::{Ambiguous, NonExistent}; use arrow::legacy::time_zone::Tz; use arrow::temporal_conversions::{ - timestamp_ms_to_datetime, timestamp_ns_to_datetime, timestamp_us_to_datetime, MILLISECONDS, - NANOSECONDS, + timestamp_ms_to_datetime, timestamp_ns_to_datetime, timestamp_us_to_datetime, MICROSECONDS, + MILLISECONDS, NANOSECONDS, }; use chrono::{Datelike, NaiveDate, NaiveDateTime, NaiveTime, Timelike}; use polars_core::datatypes::DataType; -use polars_core::export::arrow::temporal_conversions::MICROSECONDS; use polars_core::prelude::{ datetime_to_timestamp_ms, datetime_to_timestamp_ns, datetime_to_timestamp_us, polars_bail, PolarsResult, diff --git a/crates/polars-time/src/windows/group_by.rs b/crates/polars-time/src/windows/group_by.rs index c5b75bafc371..9de22c73fca2 100644 --- a/crates/polars-time/src/windows/group_by.rs +++ b/crates/polars-time/src/windows/group_by.rs @@ -1,10 +1,10 @@ use arrow::legacy::time_zone::Tz; use arrow::trusted_len::TrustedLen; -use polars_core::export::rayon::prelude::*; use polars_core::prelude::*; use polars_core::utils::_split_offsets; use polars_core::utils::flatten::flatten_par; use polars_core::POOL; +use rayon::prelude::*; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use strum_macros::IntoStaticStr; diff --git a/crates/polars-utils/src/hashing.rs b/crates/polars-utils/src/hashing.rs index f7b1534f812b..d4d2b0df6707 100644 --- a/crates/polars-utils/src/hashing.rs +++ b/crates/polars-utils/src/hashing.rs @@ -2,6 +2,13 @@ use std::hash::{Hash, Hasher}; use crate::nulls::IsNull; +// Hash combine from c++' boost lib. +#[inline(always)] +pub fn _boost_hash_combine(l: u64, r: u64) -> u64 { + l ^ r.wrapping_add(0x9e3779b9u64.wrapping_add(l << 6).wrapping_add(r >> 2)) +} + +#[inline(always)] pub const fn folded_multiply(a: u64, b: u64) -> u64 { let full = (a as u128).wrapping_mul(b as u128); (full as u64) ^ ((full >> 64) as u64) diff --git a/crates/polars/Cargo.toml b/crates/polars/Cargo.toml index d256582503cf..d623cc890898 100644 --- a/crates/polars/Cargo.toml +++ b/crates/polars/Cargo.toml @@ -28,6 +28,7 @@ ahash = { workspace = true } apache-avro = { version = "0.17", features = ["snappy"] } arrow = { workspace = true } avro-schema = { workspace = true, features = ["async"] } +chrono = { workspace = true } either = { workspace = true } ethnum = "1" futures = { workspace = true } diff --git a/crates/polars/src/export.rs b/crates/polars/src/export.rs deleted file mode 100644 index f52c88238f8c..000000000000 --- a/crates/polars/src/export.rs +++ /dev/null @@ -1,2 +0,0 @@ -/// re-exports for utility -pub use polars_core::export::*; diff --git a/crates/polars/src/lib.rs b/crates/polars/src/lib.rs index 3ac56332cd01..43d5fb75d242 100644 --- a/crates/polars/src/lib.rs +++ b/crates/polars/src/lib.rs @@ -414,8 +414,6 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![allow(ambiguous_glob_reexports)] pub mod docs; -#[doc(hidden)] -pub mod export; pub mod prelude; #[cfg(feature = "sql")] pub mod sql; diff --git a/crates/polars/tests/it/core/pivot.rs b/crates/polars/tests/it/core/pivot.rs index 51367d2b7e42..d22885402472 100644 --- a/crates/polars/tests/it/core/pivot.rs +++ b/crates/polars/tests/it/core/pivot.rs @@ -1,4 +1,4 @@ -use polars::export::chrono::NaiveDate; +use chrono::NaiveDate; use polars::prelude::*; use polars_ops::pivot::{pivot, pivot_stable, PivotAgg}; diff --git a/crates/polars/tests/it/io/csv.rs b/crates/polars/tests/it/io/csv.rs index 80670d8fd45e..09b66688b917 100644 --- a/crates/polars/tests/it/io/csv.rs +++ b/crates/polars/tests/it/io/csv.rs @@ -42,7 +42,7 @@ fn write_csv() { #[test] #[cfg(feature = "timezones")] fn write_dates() { - use polars_core::export::chrono; + use chrono; let s0 = Column::new( "date".into(), diff --git a/crates/polars/tests/it/io/partitioned.rs b/crates/polars/tests/it/io/partitioned.rs index 458ea02b3313..c9a0b9758497 100644 --- a/crates/polars/tests/it/io/partitioned.rs +++ b/crates/polars/tests/it/io/partitioned.rs @@ -5,7 +5,6 @@ use polars::io::ipc::{IpcReader, IpcWriterOption}; use polars::io::prelude::SerReader; use polars::io::PartitionedWriter; use polars_error::PolarsResult; -use tempfile; #[test] #[cfg(feature = "ipc")] diff --git a/crates/polars/tests/it/lazy/expressions/expand.rs b/crates/polars/tests/it/lazy/expressions/expand.rs index 69572ae0a454..32e7a7980b14 100644 --- a/crates/polars/tests/it/lazy/expressions/expand.rs +++ b/crates/polars/tests/it/lazy/expressions/expand.rs @@ -1,4 +1,4 @@ -use polars::export::chrono::NaiveDate; +use chrono::NaiveDate; use super::*; diff --git a/crates/polars/tests/it/lazy/group_by_dynamic.rs b/crates/polars/tests/it/lazy/group_by_dynamic.rs index 4db863551faa..e4c57a4a6ea1 100644 --- a/crates/polars/tests/it/lazy/group_by_dynamic.rs +++ b/crates/polars/tests/it/lazy/group_by_dynamic.rs @@ -1,6 +1,6 @@ // used only if feature="temporal", "dtype-date", "dynamic_group_by" #[allow(unused_imports)] -use polars::export::chrono::prelude::*; +use chrono::prelude::*; // used only if feature="temporal", "dtype-date", "dynamic_group_by" #[allow(unused_imports)] diff --git a/crates/polars/tests/it/time/date_range.rs b/crates/polars/tests/it/time/date_range.rs index f9ab68191a8d..f733c05e2acb 100644 --- a/crates/polars/tests/it/time/date_range.rs +++ b/crates/polars/tests/it/time/date_range.rs @@ -1,4 +1,4 @@ -use polars::export::chrono::NaiveDate; +use chrono::NaiveDate; use polars::prelude::*; #[allow(unused_imports)] use polars::time::date_range;