Jefffrey commented on code in PR #19984:
URL: https://github.com/apache/datafusion/pull/19984#discussion_r2725387672
##########
datafusion/spark/src/function/string/concat.rs:
##########
@@ -89,10 +93,21 @@ impl ScalarUDFImpl for SparkConcat {
)
}
fn return_field_from_args(&self, args: ReturnFieldArgs<'_>) ->
Result<FieldRef> {
+ use DataType::*;
+
// Spark semantics: concat returns NULL if ANY input is NULL
let nullable = args.arg_fields.iter().any(|f| f.is_nullable());
- Ok(Arc::new(Field::new("concat", DataType::Utf8, nullable)))
+ // Determine return type: Utf8View > LargeUtf8 > Utf8
+ let mut dt = &Utf8;
+ for field in args.arg_fields {
Review Comment:
We might need to double check this; I believe `Variadic` coerces the
arguments to a common type for us, see:
https://github.com/apache/datafusion/blob/d590824ede5effc7de5debb2271630f7d19b294b/datafusion/expr-common/src/signature.rs#L159-L167
##########
datafusion/spark/src/function/string/concat.rs:
##########
@@ -53,9 +53,13 @@ impl Default for SparkConcat {
impl SparkConcat {
pub fn new() -> Self {
+ use DataType::*;
Self {
signature: Signature::one_of(
- vec![TypeSignature::UserDefined, TypeSignature::Nullary],
Review Comment:
If we're removing UserDefined we should also remove the coerce_types
implementation
--
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]