Skip to content

Commit a4d5360

Browse files
committed
revert type coercion
1 parent 78d36f3 commit a4d5360

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

datafusion/optimizer/src/analyzer/type_coercion.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use datafusion_expr::utils::from_plan;
4343
use datafusion_expr::{
4444
is_false, is_not_false, is_not_true, is_not_unknown, is_true, is_unknown,
4545
type_coercion, AggregateFunction, BuiltinScalarFunction, Expr, LogicalPlan, Operator,
46-
WindowFrame, WindowFrameBound, WindowFrameUnits,
46+
Projection, WindowFrame, WindowFrameBound, WindowFrameUnits,
4747
};
4848
use datafusion_expr::{ExprSchemable, Signature};
4949

@@ -109,7 +109,14 @@ fn analyze_internal(
109109
})
110110
.collect::<Result<Vec<_>>>()?;
111111

112-
from_plan(plan, &new_expr, &new_inputs)
112+
// TODO: from_plan can't change the schema, so we need to do this here
113+
match &plan {
114+
LogicalPlan::Projection(_) => Ok(LogicalPlan::Projection(Projection::try_new(
115+
new_expr,
116+
Arc::new(new_inputs[0].clone()),
117+
)?)),
118+
_ => from_plan(plan, &new_expr, &new_inputs),
119+
}
113120
}
114121

115122
pub(crate) struct TypeCoercionRewriter {

0 commit comments

Comments
 (0)