From 4a3da4d8cc51ac45db2e65d399b1dccd85e1abb7 Mon Sep 17 00:00:00 2001 From: bwrob Date: Thu, 26 Sep 2024 15:30:52 +0200 Subject: [PATCH] update --- .gitignore | 1 + Cargo.lock | 144 ++++++++++++++++++++++++++++++--------------------- Cargo.toml | 4 +- src/impls.rs | 10 ++-- 4 files changed, 94 insertions(+), 65 deletions(-) diff --git a/.gitignore b/.gitignore index b51361c..d91fb2c 100644 --- a/.gitignore +++ b/.gitignore @@ -175,3 +175,4 @@ README_files/ # Dependency graph dependency_graph_files/ dependency_graph +Cargo.lock diff --git a/Cargo.lock b/Cargo.lock index fb9c546..795a051 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -131,6 +131,15 @@ version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +[[package]] +name = "castaway" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.1.21" @@ -194,6 +203,21 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "compact_str" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "serde", + "static_assertions", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -396,6 +420,7 @@ checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown", + "serde", ] [[package]] @@ -464,18 +489,18 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lz4" -version = "1.27.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a231296ca742e418c43660cb68e082486ff2538e8db432bc818580f3965025ed" +checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" dependencies = [ "lz4-sys", ] [[package]] name = "lz4-sys" -version = "1.11.0" +version = "1.11.1+lz4-1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb44a01837a858d47e5a630d2ccf304c8efcc4b83b8f9f75b7a9ee4fcc6e57d" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" dependencies = [ "cc", "libc", @@ -670,9 +695,9 @@ dependencies = [ [[package]] name = "polars" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad002eb9c541b4f7e0c7c759cefe884a0350e15d241231ac4be31c5568c15070" +checksum = "0e248cf2f0069277f8fe80d413cfb9240c7dd1cfa382b5674c1b4afa57222747" dependencies = [ "getrandom", "polars-arrow", @@ -690,9 +715,9 @@ dependencies = [ [[package]] name = "polars-arrow" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d19c6db79cb6a3c55af3b5a3976276edaab64cbf7f69b392617c2af30d7742" +checksum = "2981d5b2f34c84069a39fceca0d36dffeb97db8cadba101e7ea6605c8d42294d" dependencies = [ "ahash", "atoi", @@ -714,6 +739,7 @@ dependencies = [ "parking_lot", "polars-arrow-format", "polars-error", + "polars-schema", "polars-utils", "ryu", "simdutf8", @@ -735,9 +761,9 @@ dependencies = [ [[package]] name = "polars-compute" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30194a5ff325f61d6fcb62dc215c9210f308fc4fc85a493ef777dbcd938cba24" +checksum = "5a97b2a5c9b880ab7e52553c40a336fdb6e3244bf896b4d4917700defe8085d5" dependencies = [ "bytemuck", "either", @@ -751,9 +777,9 @@ dependencies = [ [[package]] name = "polars-core" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba2a3b736d55b92a12889672d0197dc25ad321ab23eba4168a3b6316a6b6349" +checksum = "d5bc2cadcca904a9dc4d2c2b437c346712806e9a678bf17c7e94ebf622faae76" dependencies = [ "ahash", "bitflags", @@ -770,12 +796,12 @@ dependencies = [ "polars-compute", "polars-error", "polars-row", + "polars-schema", "polars-utils", "rand", "rand_distr", "rayon", "regex", - "smartstring", "thiserror", "version_check", "xxhash-rust", @@ -783,9 +809,9 @@ dependencies = [ [[package]] name = "polars-error" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07101d1803ca2046cdb3a8adb1523ddcc879229860f0ac56a853034269dec1e1" +checksum = "56b0a8eb9b1e56a4640de6887d613cb4de73c4e09d491f3b779855d4c3bcb9ba" dependencies = [ "polars-arrow-format", "regex", @@ -795,14 +821,15 @@ dependencies = [ [[package]] name = "polars-expr" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5c69634ddbb0f44186cd1c42d166963fc756f9cc994438e941bc2703ddbbab" +checksum = "34e9c0e8c7ba93aac64051b92dc68eac5a0e9543cf44ca784467db2c035821fe" dependencies = [ "ahash", "bitflags", "once_cell", "polars-arrow", + "polars-compute", "polars-core", "polars-io", "polars-ops", @@ -810,14 +837,13 @@ dependencies = [ "polars-time", "polars-utils", "rayon", - "smartstring", ] [[package]] name = "polars-io" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a48ddf416ae185336c3d7880d2e05b7e55686e3e0da1014e5e7325eff9c7d722" +checksum = "454ebbebe1cb8cb4768adca44b8fc9431abc3c91d5927f6824e73f916bced911" dependencies = [ "ahash", "atoi_simd", @@ -825,6 +851,7 @@ dependencies = [ "chrono", "fast-float", "glob", + "hashbrown", "home", "itoa", "memchr", @@ -835,20 +862,20 @@ dependencies = [ "polars-arrow", "polars-core", "polars-error", + "polars-schema", "polars-time", "polars-utils", "rayon", "regex", "ryu", "simdutf8", - "smartstring", ] [[package]] name = "polars-lazy" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a514a85df9e7d501c71c96f094861d0608b05a3f533447b1c0ea9cf714162fcb" +checksum = "7e61c062e833d2376de0a4cf745504449215cbf499cea293cb592e674ffb39ca" dependencies = [ "ahash", "bitflags", @@ -865,15 +892,14 @@ dependencies = [ "polars-time", "polars-utils", "rayon", - "smartstring", "version_check", ] [[package]] name = "polars-mem-engine" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d057df81b17b4f0ea0e4424ee34f755e6b9ccfba432ecb2fe57dc4da6da2713" +checksum = "c0643812829cc990e1533a5bf48c21a1b3eaa46aabf2967b0f53f99097cbc74c" dependencies = [ "memmap2", "polars-arrow", @@ -890,9 +916,9 @@ dependencies = [ [[package]] name = "polars-ops" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ba44233249b7937491b5d2bdbf14e4ad534c0a65d06548c3bc418fc3e60791" +checksum = "5ac14a136d87bea798f3db51d5987556deb2293da34bfc8b105ebffa05f6e810" dependencies = [ "ahash", "argminmax", @@ -910,24 +936,25 @@ dependencies = [ "polars-compute", "polars-core", "polars-error", + "polars-schema", "polars-utils", "rayon", "regex", - "smartstring", "unicode-reverse", "version_check", ] [[package]] name = "polars-parquet" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2993265079ffa07dd16277189444424f8d787b00b01c6f6e001f58bab543ce" +checksum = "491f5af321169259d5b1294c9fe8ed89faaeac34b4dec4abcedc0d1b3d11013a" dependencies = [ "ahash", "base64", "bytemuck", "ethnum", + "hashbrown", "num-traits", "parquet-format-safe", "polars-arrow", @@ -940,9 +967,9 @@ dependencies = [ [[package]] name = "polars-pipe" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ccba94c4fa9fded0f41730f7649574c72d6d938a840731c7e4eea4e7ed5cecf" +checksum = "29215c31f599295cc0f803c42fc812cc518db6d5ed4d6c7cc03daf3976a0add5" dependencies = [ "crossbeam-channel", "crossbeam-queue", @@ -959,20 +986,20 @@ dependencies = [ "polars-row", "polars-utils", "rayon", - "smartstring", "uuid", "version_check", ] [[package]] name = "polars-plan" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6b29cc53d6c086c09b11050b01c25c28f6a91339036ba1fb1250fcf0d89e74" +checksum = "e3f728df4bc643492a2057a0a125c7e550cbcfe35b391444653ad294be9ab190" dependencies = [ "ahash", "bitflags", "bytemuck", + "bytes", "chrono", "chrono-tz", "either", @@ -989,16 +1016,15 @@ dependencies = [ "rayon", "recursive", "regex", - "smartstring", "strum_macros", "version_check", ] [[package]] name = "polars-row" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11f43f48466c4b1caa6dc61c381dc10c2d67b87fcb74bc996e21c4f7b0a311" +checksum = "4eb931f0929ca7498b3ed5056357d2d364cad42cce95383a7e3983dbceb4bed1" dependencies = [ "bytemuck", "polars-arrow", @@ -1006,11 +1032,23 @@ dependencies = [ "polars-utils", ] +[[package]] +name = "polars-schema" +version = "0.43.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c7e1234b942d3244024ecbac9c7f5a48a52a815f8ca4b9d075fbba16afb1a39" +dependencies = [ + "indexmap", + "polars-error", + "polars-utils", + "version_check", +] + [[package]] name = "polars-sql" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e9338806e7254618eb819cc632c34b75b71d462222a913f9c1035ed81911ddc" +checksum = "ce52bfd2ef1e2e18ac26d7d7ea3f9132b199cff06d975156703fa5badcfae187" dependencies = [ "hex", "once_cell", @@ -1021,6 +1059,7 @@ dependencies = [ "polars-ops", "polars-plan", "polars-time", + "polars-utils", "rand", "serde", "serde_json", @@ -1029,9 +1068,9 @@ dependencies = [ [[package]] name = "polars-time" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a601ab9a62e733b8b560b37642321cb1933faa194864739f6a59d6dfc4d686" +checksum = "9925ab75e1d859ae2283ca09d7683198b0b9ff5afecd03f2c9180f3e36e35056" dependencies = [ "atoi", "bytemuck", @@ -1045,27 +1084,27 @@ dependencies = [ "polars-ops", "polars-utils", "regex", - "smartstring", ] [[package]] name = "polars-utils" -version = "0.42.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19dd73207bd15efb0ae5c9c3ece3227927ed6a16ad63578acec342378e6bdcb4" +checksum = "b44846e1fc6ae1dfdc7f65a37af7d270d0a6a17a58fff76716561f5b887a8ad7" dependencies = [ "ahash", "bytemuck", "bytes", + "compact_str", "hashbrown", "indexmap", + "libc", "memmap2", "num-traits", "once_cell", "polars-error", "raw-cpuid", "rayon", - "smartstring", "stacker", "sysinfo", "version_check", @@ -1377,17 +1416,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "smartstring" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" -dependencies = [ - "autocfg", - "static_assertions", - "version_check", -] - [[package]] name = "sqlparser" version = "0.49.0" diff --git a/Cargo.toml b/Cargo.toml index d746167..b206de6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,8 @@ name = "options_dataframes" crate-type = ["cdylib"] [dependencies] -polars-arrow = { version = "0.42"} -polars = { version = "0.42"} +polars-arrow = { version = "0.43.1"} +polars = { version = "0.43.1"} pyo3 = { version = "0.22.3" } diff --git a/src/impls.rs b/src/impls.rs index 8074155..827ecc2 100644 --- a/src/impls.rs +++ b/src/impls.rs @@ -24,7 +24,7 @@ fn array_to_rust(arrow_array: &Bound) -> PyResult { unsafe { let field = ffi::import_field_from_c(schema.as_ref()).unwrap(); - let array = ffi::import_array_from_c(*array, field.data_type).unwrap(); + let array = ffi::import_array_from_c(*array, field.dtype).unwrap(); Ok(array) } } @@ -36,8 +36,8 @@ pub(crate) fn to_py_array( array: ArrayRef, ) -> PyResult { let schema = Box::new(ffi::export_field_to_c(&ArrowField::new( - "", - array.data_type().clone(), + "".into(), + array.dtype().clone(), true, ))); let array = Box::new(ffi::export_array_to_c(array)); @@ -57,7 +57,7 @@ pub fn py_series_to_rust_series(series: &Bound) -> PyResult { // rechunk series so that they have a single arrow array let series = series.call_method0("rechunk")?; - let name = series.getattr("name")?.extract::()?; + let name: PlSmallStr = series.getattr("name")?.extract::()?.into(); // retrieve pyarrow array let array = series.call_method0("to_arrow")?; @@ -65,7 +65,7 @@ pub fn py_series_to_rust_series(series: &Bound) -> PyResult { // retrieve rust arrow array let array = array_to_rust(&array)?; - Series::try_from((name.as_str(), array)) + Series::try_from((name, array)) .map_err(|e| PyValueError::new_err(format!("{}", e))) }