Upgrading nu-cmd-dataframe to polars 0.39 (#12554)

#Description
Upgrading nu-cmd-dataframe to polars 0.39

---------

Co-authored-by: Jack Wright <jack.wright@disqo.com>
This commit is contained in:
Jack Wright 2024-04-17 10:50:17 -07:00 committed by GitHub
parent 13160b3ec3
commit 57b0c722c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 127 additions and 497 deletions

571
Cargo.lock generated
View file

@ -2953,12 +2953,12 @@ dependencies = [
"nu-parser",
"nu-protocol",
"num",
"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",
"polars",
"polars-arrow",
"polars-io",
"polars-ops",
"polars-plan",
"polars-utils",
"serde",
"sqlparser 0.45.0",
]
@ -3428,12 +3428,12 @@ dependencies = [
"nu-plugin-test-support",
"nu-protocol",
"num",
"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",
"polars",
"polars-arrow",
"polars-io",
"polars-ops",
"polars-plan",
"polars-utils",
"serde",
"sqlparser 0.45.0",
"tempfile",
@ -4007,26 +4007,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "polars"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f01006048a264047d6cba081fed8e11adbd69c15956f9e53185a9ac4a541853c"
dependencies = [
"getrandom",
"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"
@ -4034,57 +4014,19 @@ 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",
"polars-arrow",
"polars-core",
"polars-error",
"polars-io",
"polars-lazy",
"polars-ops",
"polars-parquet",
"polars-sql",
"polars-time",
"polars-utils",
"version_check",
]
[[package]]
name = "polars-arrow"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25197f40d71f82b2f79bb394f03e555d3cc1ce4db1dd052c28318721c71e96ad"
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.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"
@ -4112,8 +4054,8 @@ dependencies = [
"multiversion",
"num-traits",
"polars-arrow-format",
"polars-error 0.39.1",
"polars-utils 0.39.1",
"polars-error",
"polars-utils",
"ryu",
"serde",
"simdutf8",
@ -4133,22 +4075,6 @@ dependencies = [
"serde",
]
[[package]]
name = "polars-compute"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c354515f73cdbbad03c2bf723fcd68e6825943b3ec503055abc8a8cb08ce46bb"
dependencies = [
"bytemuck",
"either",
"num-traits",
"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"
@ -4158,46 +4084,13 @@ dependencies = [
"bytemuck",
"either",
"num-traits",
"polars-arrow 0.39.1",
"polars-error 0.39.1",
"polars-utils 0.39.1",
"polars-arrow",
"polars-error",
"polars-utils",
"strength_reduce",
"version_check",
]
[[package]]
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"
@ -4215,11 +4108,11 @@ dependencies = [
"indexmap",
"num-traits",
"once_cell",
"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",
"polars-arrow",
"polars-compute",
"polars-error",
"polars-row",
"polars-utils",
"rand",
"rand_distr",
"rayon",
@ -4232,19 +4125,6 @@ dependencies = [
"xxhash-rust",
]
[[package]]
name = "polars-error"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dd0ce51f8bd620eb8bd376502fe68a2b1a446d5433ecd2e75270b0755ce76"
dependencies = [
"avro-schema",
"polars-arrow-format",
"regex",
"simdutf8",
"thiserror",
]
[[package]]
name = "polars-error"
version = "0.39.1"
@ -4258,47 +4138,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "polars-io"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b40bef2edcdc58394792c4d779465144283a09ff1836324e7b72df7978a6e992"
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.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"
@ -4320,13 +4159,13 @@ dependencies = [
"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",
"polars-arrow",
"polars-core",
"polars-error",
"polars-json",
"polars-parquet",
"polars-time",
"polars-utils",
"rayon",
"regex",
"ryu",
@ -4340,27 +4179,6 @@ dependencies = [
"zstd",
]
[[package]]
name = "polars-json"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef86aca08f10ddc939fe95aabb44e1d2582dcb08b55d4dadb93353ce42adc248"
dependencies = [
"ahash 0.8.11",
"chrono",
"fallible-streaming-iterator",
"hashbrown 0.14.3",
"indexmap",
"itoa",
"num-traits",
"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"
@ -4374,38 +4192,14 @@ dependencies = [
"indexmap",
"itoa",
"num-traits",
"polars-arrow 0.39.1",
"polars-error 0.39.1",
"polars-utils 0.39.1",
"polars-arrow",
"polars-error",
"polars-utils",
"ryu",
"simd-json",
"streaming-iterator",
]
[[package]]
name = "polars-lazy"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c27df26a19d3092298d31d47614ad84dc330c106e38aa8cd53727cd91c07cf56"
dependencies = [
"ahash 0.8.11",
"bitflags 2.5.0",
"glob",
"once_cell",
"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"
@ -4416,56 +4210,20 @@ dependencies = [
"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",
"polars-arrow",
"polars-core",
"polars-io",
"polars-json",
"polars-ops",
"polars-pipe",
"polars-plan",
"polars-time",
"polars-utils",
"rayon",
"smartstring",
"version_check",
]
[[package]]
name = "polars-ops"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f8a51c3bdc9e7c34196ff6f5c3cb17da134e5aafb1756aaf24b76c7118e63dc"
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.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"
@ -4485,12 +4243,12 @@ dependencies = [
"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",
"polars-arrow",
"polars-compute",
"polars-core",
"polars-error",
"polars-json",
"polars-utils",
"rand",
"rand_distr",
"rayon",
@ -4502,32 +4260,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "polars-parquet"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8824ee00fbbe83d69553f2711014c50361238d210ed81a7a297695b7db97d42"
dependencies = [
"ahash 0.8.11",
"async-stream",
"base64 0.21.7",
"brotli",
"ethnum",
"flate2",
"futures",
"lz4",
"num-traits",
"parquet-format-safe",
"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"
@ -4544,9 +4276,9 @@ dependencies = [
"lz4",
"num-traits",
"parquet-format-safe",
"polars-arrow 0.39.1",
"polars-error 0.39.1",
"polars-utils 0.39.1",
"polars-arrow",
"polars-error",
"polars-utils",
"seq-macro",
"simdutf8",
"snap",
@ -4554,31 +4286,6 @@ dependencies = [
"zstd",
]
[[package]]
name = "polars-pipe"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c5e2c1f14e81d60cfa9afe4e611a9bad9631a2cb7cd19b7c0094d0dc32f0231"
dependencies = [
"crossbeam-channel",
"crossbeam-queue",
"enum_dispatch",
"hashbrown 0.14.3",
"num-traits",
"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"
@ -4590,47 +4297,20 @@ dependencies = [
"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",
"polars-arrow",
"polars-compute",
"polars-core",
"polars-io",
"polars-ops",
"polars-plan",
"polars-row",
"polars-utils",
"rayon",
"smartstring",
"uuid",
"version_check",
]
[[package]]
name = "polars-plan"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff48362bd1b078bbbec7e7ba9ec01fea58fee2887db22a8e3deaf78f322fa3c4"
dependencies = [
"ahash 0.8.11",
"bytemuck",
"chrono-tz 0.8.6",
"once_cell",
"percent-encoding",
"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",
"smartstring",
"strum_macros 0.25.3",
"version_check",
]
[[package]]
name = "polars-plan"
version = "0.39.1"
@ -4643,14 +4323,14 @@ dependencies = [
"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",
"polars-arrow",
"polars-core",
"polars-io",
"polars-json",
"polars-ops",
"polars-parquet",
"polars-time",
"polars-utils",
"rayon",
"recursive",
"regex",
@ -4660,18 +4340,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "polars-row"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63029da56ff6a720b190490bbc7b6263f9b72d1134311b1f381fc8d306d37770"
dependencies = [
"bytemuck",
"polars-arrow 0.38.3",
"polars-error 0.38.3",
"polars-utils 0.38.3",
]
[[package]]
name = "polars-row"
version = "0.39.1"
@ -4679,27 +4347,9 @@ 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]]
name = "polars-sql"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3652c362959f608d1297196b973d1e3acb508a9562b886ac39bf7606b841052b"
dependencies = [
"hex",
"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",
"polars-arrow",
"polars-error",
"polars-utils",
]
[[package]]
@ -4709,38 +4359,17 @@ 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",
"polars-arrow",
"polars-core",
"polars-error",
"polars-lazy",
"polars-plan",
"rand",
"serde",
"serde_json",
"sqlparser 0.39.0",
]
[[package]]
name = "polars-time"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86eb74ea6ddfe675aa5c3f33c00dadbe2b85f0e8e3887b85db1fd5a3397267fd"
dependencies = [
"atoi",
"chrono",
"chrono-tz 0.8.6",
"now",
"once_cell",
"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"
@ -4752,36 +4381,16 @@ dependencies = [
"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",
"polars-arrow",
"polars-core",
"polars-error",
"polars-ops",
"polars-utils",
"regex",
"serde",
"smartstring",
]
[[package]]
name = "polars-utils"
version = "0.38.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "694656a7d2b0cd8f07660dbc8d0fb7a81066ff57a452264907531d805c1e58c4"
dependencies = [
"ahash 0.8.11",
"bytemuck",
"hashbrown 0.14.3",
"indexmap",
"num-traits",
"once_cell",
"polars-error 0.38.3",
"raw-cpuid",
"rayon",
"smartstring",
"sysinfo",
"version_check",
]
[[package]]
name = "polars-utils"
version = "0.39.1"
@ -4794,7 +4403,7 @@ dependencies = [
"indexmap",
"num-traits",
"once_cell",
"polars-error 0.39.1",
"polars-error",
"raw-cpuid",
"rayon",
"smartstring",

View file

@ -26,11 +26,11 @@ num = { version = "0.4", optional = true }
serde = { workspace = true, features = ["derive"] }
# keep sqlparser at 0.39.0 until we can update polars
sqlparser = { version = "0.45", optional = true }
polars-io = { version = "0.38", features = ["avro"], optional = true }
polars-arrow = { version = "0.38", optional = true }
polars-ops = { version = "0.38", optional = true }
polars-plan = { version = "0.38", features = ["regex"], optional = true }
polars-utils = { version = "0.38", optional = true }
polars-io = { version = "0.39", features = ["avro"], optional = true }
polars-arrow = { version = "0.39", optional = true }
polars-ops = { version = "0.39", optional = true }
polars-plan = { version = "0.39", features = ["regex"], optional = true }
polars-utils = { version = "0.39", optional = true }
[dependencies.polars]
features = [
@ -65,7 +65,7 @@ features = [
]
default-features = false
optional = true
version = "0.38"
version = "0.39"
[features]
dataframe = ["num", "polars", "polars-io", "polars-arrow", "polars-ops", "polars-plan", "polars-utils", "sqlparser"]

View file

@ -5,7 +5,7 @@ use polars::prelude::{
CsvEncoding, CsvReader, IpcReader, JsonFormat, JsonReader, LazyCsvReader, LazyFileListReader,
LazyFrame, ParallelStrategy, ParquetReader, ScanArgsIpc, ScanArgsParquet, SerReader,
};
use polars_io::avro::AvroReader;
use polars_io::{avro::AvroReader, HiveOptions};
use std::{fs::File, io::BufReader, path::PathBuf};
#[derive(Clone)]
@ -151,7 +151,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)
@ -246,7 +246,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)

View file

@ -1,5 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use nu_engine::command_prelude::*;
use polars::chunked_array::ops::SortMultipleOptions;
#[derive(Clone)]
pub struct LazySortBy;
@ -126,11 +127,17 @@ impl Command for LazySortBy {
None => expressions.iter().map(|_| false).collect::<Vec<bool>>(),
};
let sort_options = SortMultipleOptions {
descending: reverse,
nulls_last,
multithreaded: true,
maintain_order,
};
let lazy = NuLazyFrame::try_from_pipeline(input, call.head)?;
let lazy = NuLazyFrame::new(
lazy.from_eager,
lazy.into_polars()
.sort_by_exprs(&expressions, reverse, nulls_last, maintain_order),
lazy.into_polars().sort_by_exprs(&expressions, sort_options),
);
Ok(PipelineData::Value(

View file

@ -9,7 +9,10 @@ pub use operations::Axis;
use super::{nu_schema::NuSchema, utils::DEFAULT_ROWS, NuLazyFrame};
use indexmap::IndexMap;
use nu_protocol::{did_you_mean, PipelineData, Record, ShellError, Span, Value};
use polars::prelude::{DataFrame, DataType, IntoLazy, LazyFrame, PolarsObject, Series};
use polars::{
chunked_array::ops::SortMultipleOptions,
prelude::{DataFrame, DataType, IntoLazy, LazyFrame, PolarsObject, Series},
};
use polars_plan::prelude::{lit, Expr, Null};
use polars_utils::total_ord::{TotalEq, TotalHash};
use serde::{Deserialize, Serialize};
@ -488,12 +491,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,
};

View file

@ -313,11 +313,15 @@ pub fn expr_to_value(expr: &Expr, span: Span) -> Result<Value, ShellError> {
Expr::SortBy {
expr,
by,
descending,
sort_options,
} => {
let by: Result<Vec<Value>, ShellError> =
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(
record! {