polars 0.49 upgrade (#16031)

# Description
Polars 0.49 upgrade

Co-authored-by: Jack Wright <jack.wright@nike.com>
This commit is contained in:
Jack Wright
2025-06-23 14:17:39 -07:00
committed by GitHub
parent a234e6ff51
commit e88a6bff60
4 changed files with 73 additions and 112 deletions

View File

@ -33,11 +33,11 @@ indexmap = { version = "2.9" }
num = { version = "0.4" }
serde = { version = "1.0", features = ["derive"] }
sqlparser = { version = "0.53" }
polars-io = { version = "0.48", features = ["avro", "cloud", "aws"] }
polars-arrow = { version = "0.48" }
polars-ops = { version = "0.48", features = ["pivot", "cutqcut"] }
polars-plan = { version = "0.48", features = ["regex"] }
polars-utils = { version = "0.48" }
polars-io = { version = "0.49", features = ["avro", "cloud", "aws"] }
polars-arrow = { version = "0.49" }
polars-ops = { version = "0.49", features = ["pivot", "cutqcut"] }
polars-plan = { version = "0.49", features = ["regex"] }
polars-utils = { version = "0.49" }
typetag = "0.2"
env_logger = "0.11.3"
log.workspace = true
@ -93,14 +93,13 @@ features = [
"sign",
"strings",
"string_to_integer",
"streaming",
"timezones",
"temporal",
"to_dummies",
"trigonometry",
]
optional = false
version = "0.48"
version = "0.49"
[dev-dependencies]
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.105.2" }

View File

@ -202,7 +202,8 @@ fn get_col_name(expr: &Expr) -> Option<String> {
| Expr::SubPlan(_, _)
| Expr::IndexColumn(_)
| Expr::Selector(_)
| Expr::Field(_) => None,
| Expr::Field(_)
| Expr::Eval { .. } => None,
}
}

View File

@ -365,10 +365,9 @@ pub fn expr_to_value(expr: &Expr, span: Span) -> Result<Value, ShellError> {
span,
))
}
Expr::RenameAlias { expr, function } => Ok(Value::record(
Expr::RenameAlias { expr, .. } => Ok(Value::record(
record! {
"expr" => expr_to_value(expr.as_ref(), span)?,
"function" => Value::string(format!("{function:?}"), span),
},
span,
)),
@ -377,6 +376,7 @@ pub fn expr_to_value(expr: &Expr, span: Span) -> Result<Value, ShellError> {
function,
output_type,
options,
fmt_str,
} => {
let input: Result<Vec<Value>, ShellError> =
input.iter().map(|e| expr_to_value(e, span)).collect();
@ -386,22 +386,18 @@ pub fn expr_to_value(expr: &Expr, span: Span) -> Result<Value, ShellError> {
"function" => Value::string(format!("{function:?}"), span),
"output_type" => Value::string(format!("{output_type:?}"), span),
"options" => Value::string(format!("{options:?}"), span),
"fmt_str" => Value::string(format!("{fmt_str:?}"), span),
},
span,
))
}
Expr::Function {
input,
function,
options,
} => {
Expr::Function { input, function } => {
let input: Result<Vec<Value>, ShellError> =
input.iter().map(|e| expr_to_value(e, span)).collect();
Ok(Value::record(
record! {
"input" => Value::list(input?, span),
"function" => Value::string(format!("{function:?}"), span),
"options" => Value::string(format!("{options:?}"), span),
},
span,
))
@ -452,13 +448,19 @@ pub fn expr_to_value(expr: &Expr, span: Span) -> Result<Value, ShellError> {
// the parameter polars_plan::dsl::selector::Selector is not publicly exposed.
// I am not sure what we can meaningfully do with this at this time.
Expr::Selector(_) => Err(ShellError::UnsupportedInput {
msg: "Expressions of type Selector to Nu Values is not yet supported".to_string(),
msg: "Expressions of type Selector to Nu Value is not yet supported".to_string(),
input: format!("Expression is {expr:?}"),
msg_span: span,
input_span: Span::unknown(),
}),
Expr::IndexColumn(_) => Err(ShellError::UnsupportedInput {
msg: "Expressions of type IndexColumn to Nu Values is not yet supported".to_string(),
msg: "Expressions of type IndexColumn to Nu Value is not yet supported".to_string(),
input: format!("Expression is {expr:?}"),
msg_span: span,
input_span: Span::unknown(),
}),
Expr::Eval { .. } => Err(ShellError::UnsupportedInput {
msg: "Expressions of type Eval to Nu Value is not yet supported".to_string(),
input: format!("Expression is {expr:?}"),
msg_span: span,
input_span: Span::unknown(),