Skip to content

Commit

Permalink
make fix less bandaid-ey
Browse files Browse the repository at this point in the history
  • Loading branch information
Wainberg committed Jan 19, 2024
1 parent a15ba8f commit de2db73
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions crates/polars-plan/src/logical_plan/aexpr/schema.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use super::*;

fn float_type(field: &mut Field) {
if field.dtype.is_numeric() && !matches!(&field.dtype, DataType::Float32) {
if (field.dtype.is_numeric() || field.dtype == DataType::Boolean)
&& field.dtype != DataType::Float32
{
field.coerce(DataType::Float64)
}
}
Expand Down Expand Up @@ -127,11 +129,7 @@ impl AExpr {
Mean(expr) => {
let mut field =
arena.get(*expr).to_field(schema, Context::Default, arena)?;
if matches!(&field.dtype, DataType::Boolean) {
field.coerce(DataType::Float64);
} else {
float_type(&mut field);
}
float_type(&mut field);
Ok(field)
},
Implode(expr) => {
Expand Down

0 comments on commit de2db73

Please sign in to comment.