paleolimbot commented on code in PR #18136:
URL: https://github.com/apache/datafusion/pull/18136#discussion_r2462556032
##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -592,7 +594,14 @@ impl ExprSchemable for Expr {
// _ => Ok((self.get_type(schema)?, self.nullable(schema)?)),
Expr::Cast(Cast { expr, data_type }) => expr
.to_field(schema)
- .map(|(_, f)|
f.as_ref().clone().with_data_type(data_type.clone()))
+ .map(|(_, f)| {
+ f.as_ref()
+ .clone()
+ .with_data_type(data_type.data_type().clone())
+ .with_metadata(f.metadata().clone())
+ // TODO: should nullability be overridden here or derived
from the
+ // input expression?
Review Comment:
Currently this PR does not consider the nullability of the cast field,
because the destination physical expression won't consider it either (and thus
the return fields would be out of sync).
--
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]