Zachgille commented on code in PR #27862:
URL: https://github.com/apache/datafusion/pull/27862#discussion_r4740589476


##########
datafusion/physical-expr/src/expressions/cast.rs:
##########
@@ -857,9 +857,9 @@ pub fn cast_with_target_field(
     // Otherwise we need the CastExpr to strip extension metadata from the 
source.
     if expr_type == *cast_type && is_type_only {
         let source_field = expr.return_field(input_schema)?;
-        let has_extension_metadata = source_field
-            .metadata()
-            .contains_key(EXTENSION_TYPE_NAME_KEY);
+        let metadata = source_field.metadata();

Review Comment:
   Done. I added `datafusion_common::metadata::has_extension_type_metadata` and 
used it in all four cast paths (`cast`, `try_cast`, `arrow_cast`, and 
`arrow_try_cast`).
   
   Four other places remove both keys by hand: the logical `cast_output_field`, 
`CastExpr`/`TryCastExpr::return_field`, and binary type coercion. Would you 
like a matching helper for those here, or in a follow-up PR? Happy to do either.



-- 
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]

Reply via email to