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

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