diff --git a/Cargo.lock b/Cargo.lock index f51d59a29..2cc13277c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,6 +36,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "464b3811b747f8f7ebc8849c9c728c39f6ac98a055edad93baf9eb330e3f8f9d" dependencies = [ "cfg-if 1.0.0", + "const-random", "getrandom 0.2.7", "once_cell", "version_check", @@ -140,9 +141,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "arrow-format" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df5d25bc6d676271277120c41ef28760fe0a9f070677a58db621c0f983f9c20" +checksum = "07884ea216994cdc32a2d5f8274a8bee979cfe90274b83f86f440866ee3132c7" dependencies = [ "planus", "serde", @@ -150,11 +151,11 @@ dependencies = [ [[package]] name = "arrow2" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6f62e41078c967a4c063fcbdfd3801a2a9632276402c045311c4d73d0845f3" +checksum = "b843531e0a9d8dac44b0aa6adc926b2d970e8a627fe2105cd0498d5f93a6e97f" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.1", "arrow-format", "base64 0.13.0", "bytemuck", @@ -165,6 +166,7 @@ dependencies = [ "fallible-streaming-iterator", "foreign_vec", "futures", + "getrandom 0.2.7", "hash_hasher", "indexmap", "json-deserializer", @@ -173,6 +175,7 @@ dependencies = [ "multiversion", "num-traits", "parquet2", + "rustc_version 0.4.0", "simdutf8", "streaming-iterator", "strength_reduce", @@ -648,6 +651,28 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "const-random" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368a7a772ead6ce7e1de82bfb04c485f3db8ec744f72925af5735e29a22cc18e" +dependencies = [ + "const-random-macro", + "proc-macro-hack", +] + +[[package]] +name = "const-random-macro" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d7d6ab3c3a2282db210df5f02c4dab6e0a7057af0fb7ebd4070f30fe05c0ddb" +dependencies = [ + "getrandom 0.2.7", + "once_cell", + "proc-macro-hack", + "tiny-keccak", +] + [[package]] name = "const_format" version = "0.2.26" @@ -853,6 +878,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-common" version = "0.1.6" @@ -1569,7 +1600,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce69ed202df415a3d4a01e6f3341320ca88b9bd4f0bf37be6fa239cdea06d9bf" dependencies = [ "fxhash", - "hashbrown", + "hashbrown 0.12.3", "serde", ] @@ -1605,6 +1636,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.1", "rayon", ] @@ -1614,7 +1654,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -1787,7 +1827,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "serde", ] @@ -1941,9 +1981,9 @@ dependencies = [ [[package]] name = "json-deserializer" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d784d2d481d0bace3450572391d6076dd6d10c66c0ebc1a0be037b3b420664bd" +checksum = "5f63b421e16eb4100beb677af56f0b4f3a4f08bab74ef2af079ce5bb92c2683f" dependencies = [ "indexmap", ] @@ -2177,7 +2217,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -2531,6 +2571,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "now" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d89e9874397a1f0a52fc1f197a8effd9735223cb2390e9dcc83ac6cd02923d0" +dependencies = [ + "chrono", +] + [[package]] name = "ntapi" version = "0.4.0" @@ -3303,9 +3352,9 @@ dependencies = [ [[package]] name = "parquet2" -version = "0.16.3" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7752b1a7d61b278f36820ba05557a2a8bfcb17f3559254577ef447beda0c4975" +checksum = "aefc53bedbf9bbe0ff8912befafaafe30ced83851fb0aebe86696a9289ebb29e" dependencies = [ "async-stream", "brotli", @@ -3556,25 +3605,26 @@ dependencies = [ [[package]] name = "polars" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b33c016ec5949e414016b24d329a2188051e4f65d59a555986ecd7c7387ae" +checksum = "77dddd763763d977fd17e7d3300425da866be08c7185c94fb3979195fbc8fdc7" dependencies = [ "polars-core", "polars-io", "polars-lazy", "polars-ops", "polars-time", + "version_check", ] [[package]] name = "polars-arrow" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aac9a1d70c683cda8dd4958bd489d8c0206c5ab1435a656a14563c6415f5a64" +checksum = "6d5e894b6908d288ea24b56c8d99c2944f4b94af51ba662d58631c04806511b7" dependencies = [ "arrow2", - "hashbrown", + "hashbrown 0.13.2", "num 0.4.0", "serde", "thiserror", @@ -3582,9 +3632,9 @@ dependencies = [ [[package]] name = "polars-core" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4c06062d5e22036e686762bd2da2cf2fc003728e123a99f9c2df7335afc10" +checksum = "a3ab5c1e10e42a34a44a6e1421869c84ad56fe217c6120cda697c84bc467eb9c" dependencies = [ "ahash 0.8.1", "anyhow", @@ -3592,7 +3642,7 @@ dependencies = [ "bitflags", "chrono", "comfy-table", - "hashbrown", + "hashbrown 0.13.2", "indexmap", "num 0.4.0", "once_cell", @@ -3606,13 +3656,14 @@ dependencies = [ "serde_json", "smartstring", "thiserror", + "xxhash-rust", ] [[package]] name = "polars-io" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "125fd8302050f3b6be46f7a9a92a4ac62dcab738c4e32cd2af7b9be5f4cdf709" +checksum = "882e392cbc3e645bfa7ad582065764e21dc271cfeefee904f43a95ccd1b52cb7" dependencies = [ "ahash 0.8.1", "anyhow", @@ -3632,15 +3683,16 @@ dependencies = [ "rayon", "regex", "serde", + "serde_json", "simd-json", "simdutf8", ] [[package]] name = "polars-lazy" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55376a76c7bd050bb42fd124c290e1908e7ebf8f4c6cce6c4c41e56402f10a33" +checksum = "6cb356861b8967e39ca6205b8bded68b4986f0edd49f259cebbd59ad056e67cc" dependencies = [ "ahash 0.8.1", "bitflags", @@ -3658,37 +3710,40 @@ dependencies = [ [[package]] name = "polars-ops" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd3f6552b3e9539634c35047f372db331b6227f75c36fcbe4670ab58bbcbeb3" +checksum = "771a404f0f84e6801632c534a7b99410a017e227ecc7b9c64bab728c614f05d6" dependencies = [ "arrow2", "polars-arrow", "polars-core", "polars-utils", + "serde", ] [[package]] name = "polars-pipe" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa865a4fc6dcfb9967505c4714c29277898e21dd29ea7633a3f9d1abbe879a7d" +checksum = "d1bb37bd32c44defa19be36fcab9387d5b3ad4c683596479caf414e5a00e82af" dependencies = [ "enum_dispatch", - "hashbrown", + "hashbrown 0.13.2", "num 0.4.0", + "polars-arrow", "polars-core", "polars-io", "polars-plan", "polars-utils", "rayon", + "smartstring", ] [[package]] name = "polars-plan" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673480b0ee55b0abb5be247862bfe1f3b623897f504006a10adbc25c878bf531" +checksum = "f58b4b3daee78b95937930ad3cfc2a454d57802a92a39ee0ce220bb1ae627ef9" dependencies = [ "ahash 0.8.1", "polars-arrow", @@ -3703,23 +3758,25 @@ dependencies = [ [[package]] name = "polars-time" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783e53abda73c226807e850d91de67ab376d91866f378306d3e7f6b9844c17de" +checksum = "93593a1a507004f5ac535210542d730178d4f729ef5da48ff2cd13abf570d65e" dependencies = [ "chrono", "lexical", + "now", "polars-arrow", "polars-core", + "polars-ops", "polars-utils", "serde", ] [[package]] name = "polars-utils" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d5b6ec3c45989c1fbaf0e13a3832f4b5e418e776518d7a24d62672e5366364" +checksum = "d6e4fda3c2781247ef4137221f1013398e3d56aa1899f4f99ecf86fa96f64670" dependencies = [ "rayon", ] @@ -4666,11 +4723,12 @@ dependencies = [ [[package]] name = "simd-json" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd78b840b9de64fa3f7d72909b76343849f68e8c3d32608db8d38e4e5481f84" +checksum = "8e3375b6c3d8c048ba09c8b4b6c3f1d3f35e06b71db07d231c323943a949e1b8" dependencies = [ "halfbrown", + "lexical-core", "serde", "serde_json", "simdutf8", @@ -5110,6 +5168,15 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinytemplate" version = "1.2.1" @@ -5341,7 +5408,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", "regex", ] @@ -5438,9 +5505,9 @@ dependencies = [ [[package]] name = "value-trait" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a635407649b66e125e4d2ffd208153210179f8c7c8b71c030aa2ad3eeb4c8f" +checksum = "995de1aa349a0dc50f4aa40870dce12961a30229027230bad09acd2843edbe9e" dependencies = [ "float-cmp", "halfbrown", @@ -5847,6 +5914,12 @@ version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd" +[[package]] +name = "xxhash-rust" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" + [[package]] name = "yansi" version = "0.5.1" diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml index cd13546ee..21f177ed8 100644 --- a/crates/nu-command/Cargo.toml +++ b/crates/nu-command/Cargo.toml @@ -115,7 +115,7 @@ version = "3.0.0" optional = true [dependencies.polars] -version = "0.25.0" +version = "0.26.1" optional = true features = [ "arg_where", diff --git a/crates/nu-command/src/dataframe/eager/summary.rs b/crates/nu-command/src/dataframe/eager/summary.rs index 98dfe93b0..e79fed7ab 100644 --- a/crates/nu-command/src/dataframe/eager/summary.rs +++ b/crates/nu-command/src/dataframe/eager/summary.rs @@ -185,22 +185,22 @@ fn command( .cast(&DataType::Float64) .ok() .and_then(|ca| match ca.get(0) { - AnyValue::Float64(v) => Some(v), + Ok(AnyValue::Float64(v)) => Some(v), _ => None, }); let mean = match col.mean_as_series().get(0) { - AnyValue::Float64(v) => Some(v), + Ok(AnyValue::Float64(v)) => Some(v), _ => None, }; let median = match col.median_as_series().get(0) { - AnyValue::Float64(v) => Some(v), + Ok(AnyValue::Float64(v)) => Some(v), _ => None, }; let std = match col.std_as_series(0).get(0) { - AnyValue::Float64(v) => Some(v), + Ok(AnyValue::Float64(v)) => Some(v), _ => None, }; @@ -209,7 +209,7 @@ fn command( .cast(&DataType::Float64) .ok() .and_then(|ca| match ca.get(0) { - AnyValue::Float64(v) => Some(v), + Ok(AnyValue::Float64(v)) => Some(v), _ => None, }); @@ -221,7 +221,7 @@ fn command( .ok() .and_then(|ca| ca.cast(&DataType::Float64).ok()) .and_then(|ca| match ca.get(0) { - AnyValue::Float64(v) => Some(v), + Ok(AnyValue::Float64(v)) => Some(v), _ => None, }) }) @@ -232,7 +232,7 @@ fn command( .cast(&DataType::Float64) .ok() .and_then(|ca| match ca.get(0) { - AnyValue::Float64(v) => Some(v), + Ok(AnyValue::Float64(v)) => Some(v), _ => None, }); diff --git a/crates/nu-command/src/dataframe/expressions/quantile.rs b/crates/nu-command/src/dataframe/expressions/quantile.rs index 5dfb48ed8..40cedf9c5 100644 --- a/crates/nu-command/src/dataframe/expressions/quantile.rs +++ b/crates/nu-command/src/dataframe/expressions/quantile.rs @@ -5,7 +5,7 @@ use nu_protocol::{ engine::{Command, EngineState, Stack}, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; -use polars::prelude::QuantileInterpolOptions; +use polars::prelude::{lit, QuantileInterpolOptions}; #[derive(Clone)] pub struct ExprQuantile; @@ -72,7 +72,7 @@ impl Command for ExprQuantile { let expr = NuExpression::try_from_value(value)?; let expr: NuExpression = expr .into_polars() - .quantile(quantile, QuantileInterpolOptions::default()) + .quantile(lit(quantile), QuantileInterpolOptions::default()) .into(); Ok(PipelineData::Value( diff --git a/crates/nu-command/src/dataframe/lazy/quantile.rs b/crates/nu-command/src/dataframe/lazy/quantile.rs index d9d0385c5..10734f225 100644 --- a/crates/nu-command/src/dataframe/lazy/quantile.rs +++ b/crates/nu-command/src/dataframe/lazy/quantile.rs @@ -5,7 +5,7 @@ use nu_protocol::{ engine::{Command, EngineState, Stack}, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; -use polars::prelude::QuantileInterpolOptions; +use polars::prelude::{lit, QuantileInterpolOptions}; #[derive(Clone)] pub struct LazyQuantile; @@ -60,7 +60,7 @@ impl Command for LazyQuantile { let lazy = NuLazyFrame::new( lazy.from_eager, lazy.into_polars() - .quantile(quantile, QuantileInterpolOptions::default()), + .quantile(lit(quantile), QuantileInterpolOptions::default()), ); Ok(PipelineData::Value(lazy.into_value(call.head)?, None)) diff --git a/crates/nu-command/src/dataframe/series/date/as_date.rs b/crates/nu-command/src/dataframe/series/date/as_date.rs index 5d4a80f49..30b803b6f 100644 --- a/crates/nu-command/src/dataframe/series/date/as_date.rs +++ b/crates/nu-command/src/dataframe/series/date/as_date.rs @@ -79,7 +79,7 @@ fn command( let res = if not_exact { casted.as_date_not_exact(Some(format.as_str())) } else { - casted.as_date(Some(format.as_str())) + casted.as_date(Some(format.as_str()), false) }; let mut res = res diff --git a/crates/nu-command/src/dataframe/series/date/as_datetime.rs b/crates/nu-command/src/dataframe/series/date/as_datetime.rs index 70f98f402..75fe7319d 100644 --- a/crates/nu-command/src/dataframe/series/date/as_datetime.rs +++ b/crates/nu-command/src/dataframe/series/date/as_datetime.rs @@ -112,7 +112,7 @@ fn command( let res = if not_exact { casted.as_datetime_not_exact(Some(format.as_str()), TimeUnit::Milliseconds) } else { - casted.as_datetime(Some(format.as_str()), TimeUnit::Milliseconds) + casted.as_datetime(Some(format.as_str()), TimeUnit::Milliseconds, false, false) }; let mut res = res diff --git a/crates/nu-command/src/dataframe/series/date/get_weekday.rs b/crates/nu-command/src/dataframe/series/date/get_weekday.rs index 49ead1bd9..6d4c076d2 100644 --- a/crates/nu-command/src/dataframe/series/date/get_weekday.rs +++ b/crates/nu-command/src/dataframe/series/date/get_weekday.rs @@ -35,7 +35,7 @@ impl Command for GetWeekDay { result: Some( NuDataFrame::try_from_columns(vec![Column::new( "0".to_string(), - vec![Value::test_int(1), Value::test_int(1)], + vec![Value::test_int(2), Value::test_int(2)], )]) .expect("simple df for test should not fail") .into_value(Span::test_data()), diff --git a/crates/nu-command/src/dataframe/values/nu_expression/mod.rs b/crates/nu-command/src/dataframe/values/nu_expression/mod.rs index b3bb8a780..4e62a8f0d 100644 --- a/crates/nu-command/src/dataframe/values/nu_expression/mod.rs +++ b/crates/nu-command/src/dataframe/values/nu_expression/mod.rs @@ -289,10 +289,7 @@ pub fn expr_to_value(expr: &Expr, span: Span) -> Value { interpol, } => { let expr = expr_to_value(expr.as_ref(), span); - let quantile = Value::Float { - val: *quantile, - span, - }; + let quantile = expr_to_value(quantile.as_ref(), span); let interpol = Value::String { val: format!("{:?}", interpol), span,