osipovartem commented on code in PR #24971:
URL: https://github.com/apache/datafusion/pull/24971#discussion_r3978708045
##########
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:
Added `plan_insert_skips_cast_for_matching_extension_metadata` in a567c569a.
It inserts from the UUID-extension table into the same UUID-extension target
and asserts that the planned projection contains no field-aware `CAST`.
Verified with `cargo +1.94.0 test -p datafusion-sql --test sql_integration
plan_insert_` (5 passed).
--
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]