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:
Jack Wright
2024-04-13 11:00:04 -07:00
committed by GitHub
parent 211d9c685c
commit b9dd47ebb7
5 changed files with 150 additions and 67 deletions

View File

@ -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" }

View File

@ -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),