martin-g commented on code in PR #18740:
URL: https://github.com/apache/datafusion/pull/18740#discussion_r2531939146
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1472,13 +1472,24 @@ impl LogicalPlan {
Ok(transformed_expr.update_data(|expr|
original_name.restore(expr)))
}
})?
- // always recompute the schema to ensure the changed in the
schema's field should be
- // poplulated to the plan's parent
- .map_data(|plan| plan.recompute_schema())
+ .map_data(|plan| plan.update_schema_data_type())
})
.map(|res| res.data)
}
+ /// Recompute schema fields' data type after replacing params, ensuring
fields data type can be
+ /// updated according to the new parameters.
Review Comment:
nit: I think the docstring could be more explicit why this method is needed.
E.g. something like:
```
/// Recomputes schema fields' data type after replacing params, ensuring
fields' data type can be
/// updated according to the new parameters. Unlike `recompute_schema()`,
this method rebuilds
/// VALUES plans entirely to properly infer types from literal values after
placeholder substitution.
```
This way the "FIXME" below could be removed.
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1472,13 +1472,24 @@ impl LogicalPlan {
Ok(transformed_expr.update_data(|expr|
original_name.restore(expr)))
}
})?
- // always recompute the schema to ensure the changed in the
schema's field should be
- // poplulated to the plan's parent
- .map_data(|plan| plan.recompute_schema())
+ .map_data(|plan| plan.update_schema_data_type())
})
.map(|res| res.data)
}
+ /// Recompute schema fields' data type after replacing params, ensuring
fields data type can be
+ /// updated according to the new parameters.
Review Comment:
Or the idea of the "FIXME" is to move this logic to `recompute_schema()` one
day ?! If YES then better file an issue for that
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]