james-willis commented on code in PR #24865:
URL: https://github.com/apache/datafusion/pull/24865#discussion_r4392518698
##########
datafusion/functions/src/core/coalesce.rs:
##########
@@ -146,3 +154,113 @@ impl ScalarUDFImpl for CoalesceFunc {
self.doc()
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::collections::HashMap;
+ use std::sync::Arc;
+
+ const EXTENSION_KEY: &str = "ARROW:extension:name";
+
+ fn field(name: &str, dt: DataType, nullable: bool) -> FieldRef {
+ Arc::new(Field::new(name, dt, nullable))
+ }
+
+ fn ext_field(name: &str, dt: DataType, extension_name: &str) -> FieldRef {
+ Arc::new(Field::new(name, dt, true).with_metadata(HashMap::from([(
+ EXTENSION_KEY.to_string(),
+ extension_name.to_string(),
+ )])))
+ }
+
+ fn return_field(arg_fields: &[FieldRef]) -> FieldRef {
+ let scalars = vec![None; arg_fields.len()];
+ CoalesceFunc::new()
+ .return_field_from_args(ReturnFieldArgs {
+ arg_fields,
+ scalar_arguments: &scalars,
+ })
+ .unwrap()
+ }
Review Comment:
PR should be consistent now.
--
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]