kosiew commented on code in PR #24971:
URL: https://github.com/apache/datafusion/pull/24971#discussion_r3978623877
##########
datafusion/sql/src/statement.rs:
##########
@@ -2953,6 +2953,25 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
})
.cast_to(target_field.data_type(),
&DFSchema::empty())?,
};
+ let (_, expr_field) = expr.to_field(source.schema())?;
+ // A storage-type cast alone does not apply extension metadata
from the
+ // table schema when the source and target storage types are
identical.
+ let expr = if target_field.extension_type_name().is_none()
+ || expr_field.metadata() == target_field.metadata()
Review Comment:
Could we add one INSERT planner test where the source and target already
have identical extension metadata, for example inserting from a UUID-extension
source into the UUID-extension target? The existing tests cover mismatched
extension metadata and ordinary target metadata, but not the equality no-op
path. It would be good to assert that we do not plan a redundant field-aware
cast in that case. This is just a coverage suggestion, not a blocker.
--
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]