james-willis commented on code in PR #24865:
URL: https://github.com/apache/datafusion/pull/24865#discussion_r4392421544
##########
datafusion/common/src/metadata.rs:
##########
@@ -117,6 +117,36 @@ pub fn check_metadata_with_storage_equal(
Ok(())
}
+/// Compute the field metadata to propagate for an expression whose result
+/// may come from any one of several inputs coerced to a common type, such as
+/// `COALESCE`, `NVL2`, or `CASE WHEN`.
+///
+/// Returns the first non-empty metadata among the fields whose data type is
+/// not `Null` (an untyped NULL literal carries no metadata and cannot
+/// contribute a typed value), or empty metadata if there is none.
+///
+/// The inputs are deliberately not required to agree on their metadata:
+/// byte-wise comparison is too strict for extension types whose parameters
+/// are JSON-encoded, and unrelated metadata that arrived with the data (e.g.
+/// from an Arrow file or an embedded Arrow schema in a Parquet file) must not
+/// cause an extension type to be silently dropped from the result. Engines
+/// that want stricter behavior (e.g. rejecting conflicting extension types)
+/// can enforce it with an analyzer or optimizer rule, which can only observe
+/// the conflict if planning preserves the metadata in the first place.
+pub fn coerced_fields_metadata<'a>(
+ mut fields: impl Iterator<Item = &'a Field>,
Review Comment:
done
--
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]