diff --git a/Cargo.lock b/Cargo.lock index 4fd023df3d..a78343e369 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2953,12 +2953,12 @@ dependencies = [ "nu-parser", "nu-protocol", "num", - "polars", - "polars-arrow", - "polars-io", - "polars-ops", - "polars-plan", - "polars-utils", + "polars 0.38.3", + "polars-arrow 0.38.3", + "polars-io 0.38.3", + "polars-ops 0.38.3", + "polars-plan 0.38.3", + "polars-utils 0.38.3", "serde", "sqlparser 0.45.0", ] @@ -3428,12 +3428,12 @@ dependencies = [ "nu-plugin-test-support", "nu-protocol", "num", - "polars", - "polars-arrow", - "polars-io", - "polars-ops", - "polars-plan", - "polars-utils", + "polars 0.39.1", + "polars-arrow 0.39.1", + "polars-io 0.39.1", + "polars-ops 0.39.1", + "polars-plan 0.39.1", + "polars-utils 0.39.1", "serde", "sqlparser 0.45.0", "tempfile", @@ -4014,16 +4014,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f01006048a264047d6cba081fed8e11adbd69c15956f9e53185a9ac4a541853c" dependencies = [ "getrandom", - "polars-arrow", - "polars-core", - "polars-error", - "polars-io", - "polars-lazy", - "polars-ops", - "polars-parquet", - "polars-sql", - "polars-time", - "polars-utils", + "polars-arrow 0.38.3", + "polars-core 0.38.3", + "polars-error 0.38.3", + "polars-io 0.38.3", + "polars-lazy 0.38.3", + "polars-ops 0.38.3", + "polars-parquet 0.38.3", + "polars-sql 0.38.3", + "polars-time 0.38.3", + "polars-utils 0.38.3", + "version_check", +] + +[[package]] +name = "polars" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c352aaa0399c0863eecd879f2cbe585c9026c5cafe432f029025e4bec3adf43" +dependencies = [ + "getrandom", + "polars-arrow 0.39.1", + "polars-core 0.39.1", + "polars-error 0.39.1", + "polars-io 0.39.1", + "polars-lazy 0.39.1", + "polars-ops 0.39.1", + "polars-parquet 0.39.1", + "polars-sql 0.39.1", + "polars-time 0.39.1", + "polars-utils 0.39.1", "version_check", ] @@ -4054,8 +4074,46 @@ dependencies = [ "multiversion", "num-traits", "polars-arrow-format", - "polars-error", - "polars-utils", + "polars-error 0.38.3", + "polars-utils 0.38.3", + "ryu", + "serde", + "simdutf8", + "streaming-iterator", + "strength_reduce", + "version_check", + "zstd", +] + +[[package]] +name = "polars-arrow" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f88d3cfc6b500f106f03a5f4d37f700deef38c5b58a2e843edb3ec31f5a0ec19" +dependencies = [ + "ahash 0.8.11", + "atoi", + "atoi_simd", + "avro-schema", + "bytemuck", + "chrono", + "chrono-tz 0.8.6", + "dyn-clone", + "either", + "ethnum", + "fast-float", + "foreign_vec", + "futures", + "getrandom", + "hashbrown 0.14.3", + "itoa", + "itoap", + "lz4", + "multiversion", + "num-traits", + "polars-arrow-format", + "polars-error 0.39.1", + "polars-utils 0.39.1", "ryu", "serde", "simdutf8", @@ -4084,9 +4142,25 @@ dependencies = [ "bytemuck", "either", "num-traits", - "polars-arrow", - "polars-error", - "polars-utils", + "polars-arrow 0.38.3", + "polars-error 0.38.3", + "polars-utils 0.38.3", + "strength_reduce", + "version_check", +] + +[[package]] +name = "polars-compute" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf264bfb632aaeba859fe19a87fa051d850e72542c36177ccea71fd9cae84079" +dependencies = [ + "bytemuck", + "either", + "num-traits", + "polars-arrow 0.39.1", + "polars-error 0.39.1", + "polars-utils 0.39.1", "strength_reduce", "version_check", ] @@ -4096,6 +4170,39 @@ name = "polars-core" version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f20d3c227186f74aa3c228c64ef72f5a15617322fed30b4323eaf53b25f8e7b" +dependencies = [ + "ahash 0.8.11", + "bitflags 2.5.0", + "bytemuck", + "chrono", + "chrono-tz 0.8.6", + "either", + "hashbrown 0.14.3", + "indexmap", + "num-traits", + "once_cell", + "polars-arrow 0.38.3", + "polars-compute 0.38.3", + "polars-error 0.38.3", + "polars-row 0.38.3", + "polars-utils 0.38.3", + "rand", + "rand_distr", + "rayon", + "regex", + "serde", + "serde_json", + "smartstring", + "thiserror", + "version_check", + "xxhash-rust", +] + +[[package]] +name = "polars-core" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cb72917958e82f29d604429ab55851f561c7cd336f7744a7360f9e50b9ac88" dependencies = [ "ahash 0.8.11", "bitflags 2.5.0", @@ -4108,11 +4215,11 @@ dependencies = [ "indexmap", "num-traits", "once_cell", - "polars-arrow", - "polars-compute", - "polars-error", - "polars-row", - "polars-utils", + "polars-arrow 0.39.1", + "polars-compute 0.39.1", + "polars-error 0.39.1", + "polars-row 0.39.1", + "polars-utils 0.39.1", "rand", "rand_distr", "rayon", @@ -4138,6 +4245,19 @@ dependencies = [ "thiserror", ] +[[package]] +name = "polars-error" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c18ef81979a6d9e9fdbd25ad3bf1591cbd5c474489f785af44604cf591cd636d" +dependencies = [ + "avro-schema", + "polars-arrow-format", + "regex", + "simdutf8", + "thiserror", +] + [[package]] name = "polars-io" version = "0.38.3" @@ -4159,13 +4279,54 @@ dependencies = [ "num-traits", "once_cell", "percent-encoding", - "polars-arrow", - "polars-core", - "polars-error", - "polars-json", - "polars-parquet", - "polars-time", - "polars-utils", + "polars-arrow 0.38.3", + "polars-core 0.38.3", + "polars-error 0.38.3", + "polars-json 0.38.3", + "polars-parquet 0.38.3", + "polars-time 0.38.3", + "polars-utils 0.38.3", + "rayon", + "regex", + "ryu", + "serde", + "serde_json", + "simd-json", + "simdutf8", + "smartstring", + "tokio", + "tokio-util", + "zstd", +] + +[[package]] +name = "polars-io" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d47f2cdd8e2a2bfc71b0d30444d4c378ddc0d6f80826746fc3c731c06251b42" +dependencies = [ + "ahash 0.8.11", + "async-trait", + "atoi_simd", + "bytes", + "chrono", + "fast-float", + "flate2", + "futures", + "home", + "itoa", + "memchr", + "memmap2", + "num-traits", + "once_cell", + "percent-encoding", + "polars-arrow 0.39.1", + "polars-core 0.39.1", + "polars-error 0.39.1", + "polars-json 0.39.1", + "polars-parquet 0.39.1", + "polars-time 0.39.1", + "polars-utils 0.39.1", "rayon", "regex", "ryu", @@ -4192,9 +4353,30 @@ dependencies = [ "indexmap", "itoa", "num-traits", - "polars-arrow", - "polars-error", - "polars-utils", + "polars-arrow 0.38.3", + "polars-error 0.38.3", + "polars-utils 0.38.3", + "ryu", + "simd-json", + "streaming-iterator", +] + +[[package]] +name = "polars-json" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af22dcdf6f94894bbedb0b0b11fbffbb1905cc6e2a43bdb3e15355f3d4cf874a" +dependencies = [ + "ahash 0.8.11", + "chrono", + "fallible-streaming-iterator", + "hashbrown 0.14.3", + "indexmap", + "itoa", + "num-traits", + "polars-arrow 0.39.1", + "polars-error 0.39.1", + "polars-utils 0.39.1", "ryu", "simd-json", "streaming-iterator", @@ -4210,15 +4392,39 @@ dependencies = [ "bitflags 2.5.0", "glob", "once_cell", - "polars-arrow", - "polars-core", - "polars-io", - "polars-json", - "polars-ops", - "polars-pipe", - "polars-plan", - "polars-time", - "polars-utils", + "polars-arrow 0.38.3", + "polars-core 0.38.3", + "polars-io 0.38.3", + "polars-json 0.38.3", + "polars-ops 0.38.3", + "polars-pipe 0.38.3", + "polars-plan 0.38.3", + "polars-time 0.38.3", + "polars-utils 0.38.3", + "rayon", + "smartstring", + "version_check", +] + +[[package]] +name = "polars-lazy" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee5683b551f5e2bb004468edec0f87fd585f436c2e5f89b292c2bfee1b6f5d4f" +dependencies = [ + "ahash 0.8.11", + "bitflags 2.5.0", + "glob", + "once_cell", + "polars-arrow 0.39.1", + "polars-core 0.39.1", + "polars-io 0.39.1", + "polars-json 0.39.1", + "polars-ops 0.39.1", + "polars-pipe 0.39.1", + "polars-plan 0.39.1", + "polars-time 0.39.1", + "polars-utils 0.39.1", "rayon", "smartstring", "version_check", @@ -4243,12 +4449,48 @@ dependencies = [ "jsonpath_lib_polars_vendor", "memchr", "num-traits", - "polars-arrow", - "polars-compute", - "polars-core", - "polars-error", - "polars-json", - "polars-utils", + "polars-arrow 0.38.3", + "polars-compute 0.38.3", + "polars-core 0.38.3", + "polars-error 0.38.3", + "polars-json 0.38.3", + "polars-utils 0.38.3", + "rand", + "rand_distr", + "rayon", + "regex", + "serde", + "serde_json", + "smartstring", + "unicode-reverse", + "version_check", +] + +[[package]] +name = "polars-ops" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f311543e0e110d385867df25f47c1c740ee0cc854feead54262a24b0246383bb" +dependencies = [ + "ahash 0.8.11", + "argminmax", + "base64 0.21.7", + "bytemuck", + "chrono", + "chrono-tz 0.8.6", + "either", + "hashbrown 0.14.3", + "hex", + "indexmap", + "jsonpath_lib_polars_vendor", + "memchr", + "num-traits", + "polars-arrow 0.39.1", + "polars-compute 0.39.1", + "polars-core 0.39.1", + "polars-error 0.39.1", + "polars-json 0.39.1", + "polars-utils 0.39.1", "rand", "rand_distr", "rayon", @@ -4276,9 +4518,35 @@ dependencies = [ "lz4", "num-traits", "parquet-format-safe", - "polars-arrow", - "polars-error", - "polars-utils", + "polars-arrow 0.38.3", + "polars-error 0.38.3", + "polars-utils 0.38.3", + "seq-macro", + "simdutf8", + "snap", + "streaming-decompression", + "zstd", +] + +[[package]] +name = "polars-parquet" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41cd1f445fea8377350dfa2bd216785839ce97c826299c7e0e9557c1dbe887f" +dependencies = [ + "ahash 0.8.11", + "async-stream", + "base64 0.21.7", + "brotli", + "ethnum", + "flate2", + "futures", + "lz4", + "num-traits", + "parquet-format-safe", + "polars-arrow 0.39.1", + "polars-error 0.39.1", + "polars-utils 0.39.1", "seq-macro", "simdutf8", "snap", @@ -4297,14 +4565,39 @@ dependencies = [ "enum_dispatch", "hashbrown 0.14.3", "num-traits", - "polars-arrow", - "polars-compute", - "polars-core", - "polars-io", - "polars-ops", - "polars-plan", - "polars-row", - "polars-utils", + "polars-arrow 0.38.3", + "polars-compute 0.38.3", + "polars-core 0.38.3", + "polars-io 0.38.3", + "polars-ops 0.38.3", + "polars-plan 0.38.3", + "polars-row 0.38.3", + "polars-utils 0.38.3", + "rayon", + "smartstring", + "uuid", + "version_check", +] + +[[package]] +name = "polars-pipe" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f57de92c0ca9851e89cf9374cd88029f9bb2197937c34d571ec2a7ac45cca3" +dependencies = [ + "crossbeam-channel", + "crossbeam-queue", + "enum_dispatch", + "hashbrown 0.14.3", + "num-traits", + "polars-arrow 0.39.1", + "polars-compute 0.39.1", + "polars-core 0.39.1", + "polars-io 0.39.1", + "polars-ops 0.39.1", + "polars-plan 0.39.1", + "polars-row 0.39.1", + "polars-utils 0.39.1", "rayon", "smartstring", "uuid", @@ -4322,14 +4615,14 @@ dependencies = [ "chrono-tz 0.8.6", "once_cell", "percent-encoding", - "polars-arrow", - "polars-core", - "polars-io", - "polars-json", - "polars-ops", - "polars-parquet", - "polars-time", - "polars-utils", + "polars-arrow 0.38.3", + "polars-core 0.38.3", + "polars-io 0.38.3", + "polars-json 0.38.3", + "polars-ops 0.38.3", + "polars-parquet 0.38.3", + "polars-time 0.38.3", + "polars-utils 0.38.3", "rayon", "regex", "serde", @@ -4338,6 +4631,35 @@ dependencies = [ "version_check", ] +[[package]] +name = "polars-plan" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c509bc273c402a8b1fbfa63df2b2e90ca10d30decab698c7739003817de67e1" +dependencies = [ + "ahash 0.8.11", + "bytemuck", + "chrono-tz 0.8.6", + "hashbrown 0.14.3", + "once_cell", + "percent-encoding", + "polars-arrow 0.39.1", + "polars-core 0.39.1", + "polars-io 0.39.1", + "polars-json 0.39.1", + "polars-ops 0.39.1", + "polars-parquet 0.39.1", + "polars-time 0.39.1", + "polars-utils 0.39.1", + "rayon", + "recursive", + "regex", + "serde", + "smartstring", + "strum_macros 0.25.3", + "version_check", +] + [[package]] name = "polars-row" version = "0.38.3" @@ -4345,9 +4667,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63029da56ff6a720b190490bbc7b6263f9b72d1134311b1f381fc8d306d37770" dependencies = [ "bytemuck", - "polars-arrow", - "polars-error", - "polars-utils", + "polars-arrow 0.38.3", + "polars-error 0.38.3", + "polars-utils 0.38.3", +] + +[[package]] +name = "polars-row" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695a9954f5aa273e44c497c19f806177f787ccf87cd4b3044c96a5057266a861" +dependencies = [ + "bytemuck", + "polars-arrow 0.39.1", + "polars-error 0.39.1", + "polars-utils 0.39.1", ] [[package]] @@ -4357,11 +4691,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3652c362959f608d1297196b973d1e3acb508a9562b886ac39bf7606b841052b" dependencies = [ "hex", - "polars-arrow", - "polars-core", - "polars-error", - "polars-lazy", - "polars-plan", + "polars-arrow 0.38.3", + "polars-core 0.38.3", + "polars-error 0.38.3", + "polars-lazy 0.38.3", + "polars-plan 0.38.3", + "rand", + "serde", + "serde_json", + "sqlparser 0.39.0", +] + +[[package]] +name = "polars-sql" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7cdf3b41bda70004ed3ec78652eb690aec3db5d99dfac03fbf9995fe76a7e26" +dependencies = [ + "hex", + "polars-arrow 0.39.1", + "polars-core 0.39.1", + "polars-error 0.39.1", + "polars-lazy 0.39.1", + "polars-plan 0.39.1", "rand", "serde", "serde_json", @@ -4379,11 +4731,32 @@ dependencies = [ "chrono-tz 0.8.6", "now", "once_cell", - "polars-arrow", - "polars-core", - "polars-error", - "polars-ops", - "polars-utils", + "polars-arrow 0.38.3", + "polars-core 0.38.3", + "polars-error 0.38.3", + "polars-ops 0.38.3", + "polars-utils 0.38.3", + "regex", + "serde", + "smartstring", +] + +[[package]] +name = "polars-time" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bdc956b63e99a5ad1dabd9d397ce9ce50f703e503a5039c972968683a953d0c" +dependencies = [ + "atoi", + "chrono", + "chrono-tz 0.8.6", + "now", + "once_cell", + "polars-arrow 0.39.1", + "polars-core 0.39.1", + "polars-error 0.39.1", + "polars-ops 0.39.1", + "polars-utils 0.39.1", "regex", "serde", "smartstring", @@ -4401,7 +4774,7 @@ dependencies = [ "indexmap", "num-traits", "once_cell", - "polars-error", + "polars-error 0.38.3", "raw-cpuid", "rayon", "smartstring", @@ -4409,6 +4782,27 @@ dependencies = [ "version_check", ] +[[package]] +name = "polars-utils" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "355b126757b4a87da5248ae6eb644e99b5583a11ffc2d42e13b2b856d43e84be" +dependencies = [ + "ahash 0.8.11", + "bytemuck", + "hashbrown 0.14.3", + "indexmap", + "num-traits", + "once_cell", + "polars-error 0.39.1", + "raw-cpuid", + "rayon", + "smartstring", + "stacker", + "sysinfo", + "version_check", +] + [[package]] name = "pori" version = "0.0.0" @@ -4754,6 +5148,26 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "recursive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0786a43debb760f491b1bc0269fe5e84155353c67482b9e60d0cfb596054b43e" +dependencies = [ + "recursive-proc-macro-impl", + "stacker", +] + +[[package]] +name = "recursive-proc-macro-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76009fbe0614077fc1a2ce255e3a1881a2e3a3527097d5dc6d8212c585e7e38b" +dependencies = [ + "quote", + "syn 2.0.58", +] + [[package]] name = "redox_syscall" version = "0.4.1" diff --git a/crates/nu_plugin_polars/Cargo.toml b/crates/nu_plugin_polars/Cargo.toml index e60668da8a..abeb59fadf 100644 --- a/crates/nu_plugin_polars/Cargo.toml +++ b/crates/nu_plugin_polars/Cargo.toml @@ -29,11 +29,11 @@ indexmap = { version = "2.2" } num = {version = "0.4"} serde = { version = "1.0", features = ["derive"] } sqlparser = { version = "0.45"} -polars-io = { version = "0.38", features = ["avro"]} -polars-arrow = { version = "0.38"} -polars-ops = { version = "0.38"} -polars-plan = { version = "0.38", features = ["regex"]} -polars-utils = { version = "0.38"} +polars-io = { version = "0.39", features = ["avro"]} +polars-arrow = { version = "0.39"} +polars-ops = { version = "0.39"} +polars-plan = { version = "0.39", features = ["regex"]} +polars-utils = { version = "0.39"} typetag = "0.2" uuid = { version = "1.7", features = ["v4", "serde"] } @@ -69,7 +69,7 @@ features = [ "to_dummies", ] optional = false -version = "0.38" +version = "0.39" [dev-dependencies] nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.92.3" } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/open.rs b/crates/nu_plugin_polars/src/dataframe/eager/open.rs index a9563b5c04..da9352b2d3 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/open.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/open.rs @@ -23,7 +23,7 @@ use polars::prelude::{ LazyFrame, ParquetReader, ScanArgsIpc, ScanArgsParquet, SerReader, }; -use polars_io::{avro::AvroReader, prelude::ParallelStrategy}; +use polars_io::{avro::AvroReader, prelude::ParallelStrategy, HiveOptions}; #[derive(Clone)] pub struct OpenDataFrame; @@ -174,7 +174,7 @@ fn from_parquet( low_memory: false, cloud_options: None, use_statistics: false, - hive_partitioning: false, + hive_options: HiveOptions::default(), }; let df: NuLazyFrame = LazyFrame::scan_parquet(file, args) @@ -271,7 +271,8 @@ fn from_ipc( cache: true, rechunk: false, row_index: None, - memmap: true, + memory_map: true, + cloud_options: None, }; let df: NuLazyFrame = LazyFrame::scan_ipc(file, args) diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/sort_by_expr.rs b/crates/nu_plugin_polars/src/dataframe/lazy/sort_by_expr.rs index 96f2b3df4a..655e23e089 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/sort_by_expr.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/sort_by_expr.rs @@ -9,6 +9,7 @@ use nu_protocol::{ Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; +use polars::chunked_array::ops::SortMultipleOptions; #[derive(Clone)] pub struct LazySortBy; @@ -137,12 +138,18 @@ impl PluginCommand for LazySortBy { None => expressions.iter().map(|_| false).collect::>(), }; + let sort_options = SortMultipleOptions { + descending: reverse, + nulls_last, + multithreaded: true, + maintain_order, + }; + let pipeline_value = input.into_value(call.head); let lazy = NuLazyFrame::try_from_value_coerce(plugin, &pipeline_value)?; let lazy = NuLazyFrame::new( lazy.from_eager, - lazy.to_polars() - .sort_by_exprs(&expressions, reverse, nulls_last, maintain_order), + lazy.to_polars().sort_by_exprs(&expressions, sort_options), ); lazy.to_pipeline_data(plugin, engine, call.head) .map_err(LabeledError::from) diff --git a/crates/nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs b/crates/nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs index 8bc3ae56dd..5c08b67bbb 100644 --- a/crates/nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs +++ b/crates/nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs @@ -8,7 +8,10 @@ pub use operations::Axis; use indexmap::map::IndexMap; use nu_protocol::{did_you_mean, PipelineData, Record, ShellError, Span, Value}; -use polars::prelude::{DataFrame, DataType, IntoLazy, PolarsObject, Series}; +use polars::{ + chunked_array::ops::SortMultipleOptions, + prelude::{DataFrame, DataType, IntoLazy, PolarsObject, Series}, +}; use polars_plan::prelude::{lit, Expr, Null}; use polars_utils::total_ord::{TotalEq, TotalHash}; use std::{ @@ -436,12 +439,18 @@ impl NuDataFrame { .expect("already checked that dataframe is different than 0"); // if unable to sort, then unable to compare - let lhs = match self.as_ref().sort(vec![*first_col], false, false) { + let lhs = match self + .as_ref() + .sort(vec![*first_col], SortMultipleOptions::default()) + { Ok(df) => df, Err(_) => return None, }; - let rhs = match other.as_ref().sort(vec![*first_col], false, false) { + let rhs = match other + .as_ref() + .sort(vec![*first_col], SortMultipleOptions::default()) + { Ok(df) => df, Err(_) => return None, }; diff --git a/crates/nu_plugin_polars/src/dataframe/values/nu_expression/mod.rs b/crates/nu_plugin_polars/src/dataframe/values/nu_expression/mod.rs index a6e26efc8d..34f655a608 100644 --- a/crates/nu_plugin_polars/src/dataframe/values/nu_expression/mod.rs +++ b/crates/nu_plugin_polars/src/dataframe/values/nu_expression/mod.rs @@ -289,11 +289,15 @@ pub fn expr_to_value(expr: &Expr, span: Span) -> Result { Expr::SortBy { expr, by, - descending, + sort_options, } => { let by: Result, ShellError> = by.iter().map(|b| expr_to_value(b, span)).collect(); - let descending: Vec = descending.iter().map(|r| Value::bool(*r, span)).collect(); + let descending: Vec = sort_options + .descending + .iter() + .map(|r| Value::bool(*r, span)) + .collect(); Ok(Value::record( record! {