Upgrading nu_plugin_polars to polars 0.39.1 (#12551)

# Description
Upgrading nu_plugin_polars to polars 0.39.1

Co-authored-by: Jack Wright <jack.wright@disqo.com>
This commit is contained in:
Jack Wright 2024-04-17 04:35:09 -07:00 committed by GitHub
parent b296d6ee3c
commit 410f3c5c8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 541 additions and 106 deletions

594
Cargo.lock generated
View File

@ -2953,12 +2953,12 @@ dependencies = [
"nu-parser", "nu-parser",
"nu-protocol", "nu-protocol",
"num", "num",
"polars", "polars 0.38.3",
"polars-arrow", "polars-arrow 0.38.3",
"polars-io", "polars-io 0.38.3",
"polars-ops", "polars-ops 0.38.3",
"polars-plan", "polars-plan 0.38.3",
"polars-utils", "polars-utils 0.38.3",
"serde", "serde",
"sqlparser 0.45.0", "sqlparser 0.45.0",
] ]
@ -3428,12 +3428,12 @@ dependencies = [
"nu-plugin-test-support", "nu-plugin-test-support",
"nu-protocol", "nu-protocol",
"num", "num",
"polars", "polars 0.39.1",
"polars-arrow", "polars-arrow 0.39.1",
"polars-io", "polars-io 0.39.1",
"polars-ops", "polars-ops 0.39.1",
"polars-plan", "polars-plan 0.39.1",
"polars-utils", "polars-utils 0.39.1",
"serde", "serde",
"sqlparser 0.45.0", "sqlparser 0.45.0",
"tempfile", "tempfile",
@ -4014,16 +4014,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f01006048a264047d6cba081fed8e11adbd69c15956f9e53185a9ac4a541853c" checksum = "f01006048a264047d6cba081fed8e11adbd69c15956f9e53185a9ac4a541853c"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"polars-arrow", "polars-arrow 0.38.3",
"polars-core", "polars-core 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-io", "polars-io 0.38.3",
"polars-lazy", "polars-lazy 0.38.3",
"polars-ops", "polars-ops 0.38.3",
"polars-parquet", "polars-parquet 0.38.3",
"polars-sql", "polars-sql 0.38.3",
"polars-time", "polars-time 0.38.3",
"polars-utils", "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", "version_check",
] ]
@ -4054,8 +4074,46 @@ dependencies = [
"multiversion", "multiversion",
"num-traits", "num-traits",
"polars-arrow-format", "polars-arrow-format",
"polars-error", "polars-error 0.38.3",
"polars-utils", "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", "ryu",
"serde", "serde",
"simdutf8", "simdutf8",
@ -4084,9 +4142,25 @@ dependencies = [
"bytemuck", "bytemuck",
"either", "either",
"num-traits", "num-traits",
"polars-arrow", "polars-arrow 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-utils", "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", "strength_reduce",
"version_check", "version_check",
] ]
@ -4096,6 +4170,39 @@ name = "polars-core"
version = "0.38.3" version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f20d3c227186f74aa3c228c64ef72f5a15617322fed30b4323eaf53b25f8e7b" 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 = [ dependencies = [
"ahash 0.8.11", "ahash 0.8.11",
"bitflags 2.5.0", "bitflags 2.5.0",
@ -4108,11 +4215,11 @@ dependencies = [
"indexmap", "indexmap",
"num-traits", "num-traits",
"once_cell", "once_cell",
"polars-arrow", "polars-arrow 0.39.1",
"polars-compute", "polars-compute 0.39.1",
"polars-error", "polars-error 0.39.1",
"polars-row", "polars-row 0.39.1",
"polars-utils", "polars-utils 0.39.1",
"rand", "rand",
"rand_distr", "rand_distr",
"rayon", "rayon",
@ -4138,6 +4245,19 @@ dependencies = [
"thiserror", "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]] [[package]]
name = "polars-io" name = "polars-io"
version = "0.38.3" version = "0.38.3"
@ -4159,13 +4279,54 @@ dependencies = [
"num-traits", "num-traits",
"once_cell", "once_cell",
"percent-encoding", "percent-encoding",
"polars-arrow", "polars-arrow 0.38.3",
"polars-core", "polars-core 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-json", "polars-json 0.38.3",
"polars-parquet", "polars-parquet 0.38.3",
"polars-time", "polars-time 0.38.3",
"polars-utils", "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", "rayon",
"regex", "regex",
"ryu", "ryu",
@ -4192,9 +4353,30 @@ dependencies = [
"indexmap", "indexmap",
"itoa", "itoa",
"num-traits", "num-traits",
"polars-arrow", "polars-arrow 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-utils", "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", "ryu",
"simd-json", "simd-json",
"streaming-iterator", "streaming-iterator",
@ -4210,15 +4392,39 @@ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"glob", "glob",
"once_cell", "once_cell",
"polars-arrow", "polars-arrow 0.38.3",
"polars-core", "polars-core 0.38.3",
"polars-io", "polars-io 0.38.3",
"polars-json", "polars-json 0.38.3",
"polars-ops", "polars-ops 0.38.3",
"polars-pipe", "polars-pipe 0.38.3",
"polars-plan", "polars-plan 0.38.3",
"polars-time", "polars-time 0.38.3",
"polars-utils", "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", "rayon",
"smartstring", "smartstring",
"version_check", "version_check",
@ -4243,12 +4449,48 @@ dependencies = [
"jsonpath_lib_polars_vendor", "jsonpath_lib_polars_vendor",
"memchr", "memchr",
"num-traits", "num-traits",
"polars-arrow", "polars-arrow 0.38.3",
"polars-compute", "polars-compute 0.38.3",
"polars-core", "polars-core 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-json", "polars-json 0.38.3",
"polars-utils", "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",
"rand_distr", "rand_distr",
"rayon", "rayon",
@ -4276,9 +4518,35 @@ dependencies = [
"lz4", "lz4",
"num-traits", "num-traits",
"parquet-format-safe", "parquet-format-safe",
"polars-arrow", "polars-arrow 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-utils", "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", "seq-macro",
"simdutf8", "simdutf8",
"snap", "snap",
@ -4297,14 +4565,39 @@ dependencies = [
"enum_dispatch", "enum_dispatch",
"hashbrown 0.14.3", "hashbrown 0.14.3",
"num-traits", "num-traits",
"polars-arrow", "polars-arrow 0.38.3",
"polars-compute", "polars-compute 0.38.3",
"polars-core", "polars-core 0.38.3",
"polars-io", "polars-io 0.38.3",
"polars-ops", "polars-ops 0.38.3",
"polars-plan", "polars-plan 0.38.3",
"polars-row", "polars-row 0.38.3",
"polars-utils", "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", "rayon",
"smartstring", "smartstring",
"uuid", "uuid",
@ -4322,14 +4615,14 @@ dependencies = [
"chrono-tz 0.8.6", "chrono-tz 0.8.6",
"once_cell", "once_cell",
"percent-encoding", "percent-encoding",
"polars-arrow", "polars-arrow 0.38.3",
"polars-core", "polars-core 0.38.3",
"polars-io", "polars-io 0.38.3",
"polars-json", "polars-json 0.38.3",
"polars-ops", "polars-ops 0.38.3",
"polars-parquet", "polars-parquet 0.38.3",
"polars-time", "polars-time 0.38.3",
"polars-utils", "polars-utils 0.38.3",
"rayon", "rayon",
"regex", "regex",
"serde", "serde",
@ -4338,6 +4631,35 @@ dependencies = [
"version_check", "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]] [[package]]
name = "polars-row" name = "polars-row"
version = "0.38.3" version = "0.38.3"
@ -4345,9 +4667,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63029da56ff6a720b190490bbc7b6263f9b72d1134311b1f381fc8d306d37770" checksum = "63029da56ff6a720b190490bbc7b6263f9b72d1134311b1f381fc8d306d37770"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"polars-arrow", "polars-arrow 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-utils", "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]] [[package]]
@ -4357,11 +4691,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3652c362959f608d1297196b973d1e3acb508a9562b886ac39bf7606b841052b" checksum = "3652c362959f608d1297196b973d1e3acb508a9562b886ac39bf7606b841052b"
dependencies = [ dependencies = [
"hex", "hex",
"polars-arrow", "polars-arrow 0.38.3",
"polars-core", "polars-core 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-lazy", "polars-lazy 0.38.3",
"polars-plan", "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", "rand",
"serde", "serde",
"serde_json", "serde_json",
@ -4379,11 +4731,32 @@ dependencies = [
"chrono-tz 0.8.6", "chrono-tz 0.8.6",
"now", "now",
"once_cell", "once_cell",
"polars-arrow", "polars-arrow 0.38.3",
"polars-core", "polars-core 0.38.3",
"polars-error", "polars-error 0.38.3",
"polars-ops", "polars-ops 0.38.3",
"polars-utils", "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", "regex",
"serde", "serde",
"smartstring", "smartstring",
@ -4401,7 +4774,7 @@ dependencies = [
"indexmap", "indexmap",
"num-traits", "num-traits",
"once_cell", "once_cell",
"polars-error", "polars-error 0.38.3",
"raw-cpuid", "raw-cpuid",
"rayon", "rayon",
"smartstring", "smartstring",
@ -4409,6 +4782,27 @@ dependencies = [
"version_check", "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]] [[package]]
name = "pori" name = "pori"
version = "0.0.0" version = "0.0.0"
@ -4754,6 +5148,26 @@ dependencies = [
"crossbeam-utils", "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]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.4.1" version = "0.4.1"

View File

@ -29,11 +29,11 @@ indexmap = { version = "2.2" }
num = {version = "0.4"} num = {version = "0.4"}
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
sqlparser = { version = "0.45"} sqlparser = { version = "0.45"}
polars-io = { version = "0.38", features = ["avro"]} polars-io = { version = "0.39", features = ["avro"]}
polars-arrow = { version = "0.38"} polars-arrow = { version = "0.39"}
polars-ops = { version = "0.38"} polars-ops = { version = "0.39"}
polars-plan = { version = "0.38", features = ["regex"]} polars-plan = { version = "0.39", features = ["regex"]}
polars-utils = { version = "0.38"} polars-utils = { version = "0.39"}
typetag = "0.2" typetag = "0.2"
uuid = { version = "1.7", features = ["v4", "serde"] } uuid = { version = "1.7", features = ["v4", "serde"] }
@ -69,7 +69,7 @@ features = [
"to_dummies", "to_dummies",
] ]
optional = false optional = false
version = "0.38" version = "0.39"
[dev-dependencies] [dev-dependencies]
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.92.3" } nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.92.3" }

View File

@ -23,7 +23,7 @@ use polars::prelude::{
LazyFrame, ParquetReader, ScanArgsIpc, ScanArgsParquet, SerReader, LazyFrame, ParquetReader, ScanArgsIpc, ScanArgsParquet, SerReader,
}; };
use polars_io::{avro::AvroReader, prelude::ParallelStrategy}; use polars_io::{avro::AvroReader, prelude::ParallelStrategy, HiveOptions};
#[derive(Clone)] #[derive(Clone)]
pub struct OpenDataFrame; pub struct OpenDataFrame;
@ -174,7 +174,7 @@ fn from_parquet(
low_memory: false, low_memory: false,
cloud_options: None, cloud_options: None,
use_statistics: false, use_statistics: false,
hive_partitioning: false, hive_options: HiveOptions::default(),
}; };
let df: NuLazyFrame = LazyFrame::scan_parquet(file, args) let df: NuLazyFrame = LazyFrame::scan_parquet(file, args)
@ -271,7 +271,8 @@ fn from_ipc(
cache: true, cache: true,
rechunk: false, rechunk: false,
row_index: None, row_index: None,
memmap: true, memory_map: true,
cloud_options: None,
}; };
let df: NuLazyFrame = LazyFrame::scan_ipc(file, args) let df: NuLazyFrame = LazyFrame::scan_ipc(file, args)

View File

@ -9,6 +9,7 @@ use nu_protocol::{
Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Category, Example, LabeledError, PipelineData, ShellError, Signature, Span, SyntaxShape, Type,
Value, Value,
}; };
use polars::chunked_array::ops::SortMultipleOptions;
#[derive(Clone)] #[derive(Clone)]
pub struct LazySortBy; pub struct LazySortBy;
@ -137,12 +138,18 @@ impl PluginCommand for LazySortBy {
None => expressions.iter().map(|_| false).collect::<Vec<bool>>(), None => expressions.iter().map(|_| false).collect::<Vec<bool>>(),
}; };
let sort_options = SortMultipleOptions {
descending: reverse,
nulls_last,
multithreaded: true,
maintain_order,
};
let pipeline_value = input.into_value(call.head); let pipeline_value = input.into_value(call.head);
let lazy = NuLazyFrame::try_from_value_coerce(plugin, &pipeline_value)?; let lazy = NuLazyFrame::try_from_value_coerce(plugin, &pipeline_value)?;
let lazy = NuLazyFrame::new( let lazy = NuLazyFrame::new(
lazy.from_eager, lazy.from_eager,
lazy.to_polars() lazy.to_polars().sort_by_exprs(&expressions, sort_options),
.sort_by_exprs(&expressions, reverse, nulls_last, maintain_order),
); );
lazy.to_pipeline_data(plugin, engine, call.head) lazy.to_pipeline_data(plugin, engine, call.head)
.map_err(LabeledError::from) .map_err(LabeledError::from)

View File

@ -8,7 +8,10 @@ pub use operations::Axis;
use indexmap::map::IndexMap; use indexmap::map::IndexMap;
use nu_protocol::{did_you_mean, PipelineData, Record, ShellError, Span, Value}; 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_plan::prelude::{lit, Expr, Null};
use polars_utils::total_ord::{TotalEq, TotalHash}; use polars_utils::total_ord::{TotalEq, TotalHash};
use std::{ use std::{
@ -436,12 +439,18 @@ impl NuDataFrame {
.expect("already checked that dataframe is different than 0"); .expect("already checked that dataframe is different than 0");
// if unable to sort, then unable to compare // 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, Ok(df) => df,
Err(_) => return None, 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, Ok(df) => df,
Err(_) => return None, Err(_) => return None,
}; };

View File

@ -289,11 +289,15 @@ pub fn expr_to_value(expr: &Expr, span: Span) -> Result<Value, ShellError> {
Expr::SortBy { Expr::SortBy {
expr, expr,
by, by,
descending, sort_options,
} => { } => {
let by: Result<Vec<Value>, ShellError> = let by: Result<Vec<Value>, ShellError> =
by.iter().map(|b| expr_to_value(b, span)).collect(); by.iter().map(|b| expr_to_value(b, span)).collect();
let descending: Vec<Value> = descending.iter().map(|r| Value::bool(*r, span)).collect(); let descending: Vec<Value> = sort_options
.descending
.iter()
.map(|r| Value::bool(*r, span))
.collect();
Ok(Value::record( Ok(Value::record(
record! { record! {