mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
Polars 0.38 upgrade (#12506)
# Description Polars 0.38 upgrade for both the dataframe crate and the polars plugin. --------- Co-authored-by: Jack Wright <jack.wright@disqo.com>
This commit is contained in:
@ -25,12 +25,12 @@ indexmap = { workspace = true }
|
||||
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.39.0", optional = true }
|
||||
polars-io = { version = "0.37", features = ["avro"], optional = true }
|
||||
polars-arrow = { version = "0.37", optional = true }
|
||||
polars-ops = { version = "0.37", optional = true }
|
||||
polars-plan = { version = "0.37", features = ["regex"], optional = true }
|
||||
polars-utils = { version = "0.37", optional = true }
|
||||
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 }
|
||||
|
||||
[dependencies.polars]
|
||||
features = [
|
||||
@ -65,7 +65,7 @@ features = [
|
||||
]
|
||||
default-features = false
|
||||
optional = true
|
||||
version = "0.37"
|
||||
version = "0.38"
|
||||
|
||||
[features]
|
||||
dataframe = ["num", "polars", "polars-io", "polars-arrow", "polars-ops", "polars-plan", "polars-utils", "sqlparser"]
|
||||
|
@ -11,9 +11,14 @@ 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_plan::prelude::{lit, Expr, Null};
|
||||
use polars_utils::total_ord::TotalEq;
|
||||
use polars_utils::total_ord::{TotalEq, TotalHash};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{cmp::Ordering, collections::HashSet, fmt::Display, hash::Hasher};
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
collections::HashSet,
|
||||
fmt::Display,
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
|
||||
// DataFrameValue is an encapsulation of Nushell Value that can be used
|
||||
// to define the PolarsObject Trait. The polars object trait allows to
|
||||
@ -31,6 +36,15 @@ impl DataFrameValue {
|
||||
}
|
||||
}
|
||||
|
||||
impl TotalHash for DataFrameValue {
|
||||
fn tot_hash<H>(&self, state: &mut H)
|
||||
where
|
||||
H: Hasher,
|
||||
{
|
||||
(*self).hash(state)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for DataFrameValue {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.0.get_type())
|
||||
@ -50,7 +64,7 @@ impl PartialEq for DataFrameValue {
|
||||
}
|
||||
impl Eq for DataFrameValue {}
|
||||
|
||||
impl std::hash::Hash for DataFrameValue {
|
||||
impl Hash for DataFrameValue {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
match &self.0 {
|
||||
Value::Nothing { .. } => 0.hash(state),
|
||||
|
@ -23,17 +23,17 @@ nu-path = { path = "../nu-path", version = "0.92.3" }
|
||||
|
||||
# Potential dependencies for extras
|
||||
chrono = { workspace = true, features = ["std", "unstable-locales"], default-features = false }
|
||||
chrono-tz = "0.8"
|
||||
chrono-tz = "0.9"
|
||||
fancy-regex = { workspace = true }
|
||||
indexmap = { version = "2.2" }
|
||||
num = {version = "0.4"}
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
sqlparser = { version = "0.43"}
|
||||
polars-io = { version = "0.37", features = ["avro"]}
|
||||
polars-arrow = { version = "0.37"}
|
||||
polars-ops = { version = "0.37"}
|
||||
polars-plan = { version = "0.37", features = ["regex"]}
|
||||
polars-utils = { version = "0.37"}
|
||||
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"}
|
||||
typetag = "0.2"
|
||||
uuid = { version = "1.7", features = ["v4", "serde"] }
|
||||
|
||||
@ -69,7 +69,7 @@ features = [
|
||||
"to_dummies",
|
||||
]
|
||||
optional = false
|
||||
version = "0.37"
|
||||
version = "0.38"
|
||||
|
||||
[dev-dependencies]
|
||||
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.92.3" }
|
||||
|
@ -10,8 +10,14 @@ 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_plan::prelude::{lit, Expr, Null};
|
||||
use polars_utils::total_ord::TotalEq;
|
||||
use std::{cmp::Ordering, collections::HashSet, fmt::Display, hash::Hasher, sync::Arc};
|
||||
use polars_utils::total_ord::{TotalEq, TotalHash};
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
collections::HashSet,
|
||||
fmt::Display,
|
||||
hash::{Hash, Hasher},
|
||||
sync::Arc,
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{Cacheable, PolarsPlugin};
|
||||
@ -39,6 +45,15 @@ impl DataFrameValue {
|
||||
}
|
||||
}
|
||||
|
||||
impl TotalHash for DataFrameValue {
|
||||
fn tot_hash<H>(&self, state: &mut H)
|
||||
where
|
||||
H: Hasher,
|
||||
{
|
||||
(*self).hash(state)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for DataFrameValue {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.0.get_type())
|
||||
@ -58,7 +73,7 @@ impl PartialEq for DataFrameValue {
|
||||
}
|
||||
impl Eq for DataFrameValue {}
|
||||
|
||||
impl std::hash::Hash for DataFrameValue {
|
||||
impl Hash for DataFrameValue {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
match &self.0 {
|
||||
Value::Nothing { .. } => 0.hash(state),
|
||||
|
Reference in New Issue
Block a user