EeshanBembi commented on code in PR #18137:
URL: https://github.com/apache/datafusion/pull/18137#discussion_r2658921027
##########
datafusion/functions/src/string/concat.rs:
##########
@@ -65,13 +71,64 @@ impl Default for ConcatFunc {
impl ConcatFunc {
pub fn new() -> Self {
- use DataType::*;
Self {
- signature: Signature::variadic(
- vec![Utf8View, Utf8, LargeUtf8],
- Volatility::Immutable,
- ),
+ signature: Signature::user_defined(Volatility::Immutable),
+ }
+ }
+
+ /// Get the string type with highest precedence: Utf8View > LargeUtf8 >
Utf8
+ fn get_string_type_precedence(&self, arg_types: &[DataType]) -> DataType {
+ use DataType::*;
+
+ for data_type in arg_types {
+ if data_type == &Utf8View {
+ return Utf8View;
+ }
+ }
+
+ for data_type in arg_types {
+ if data_type == &LargeUtf8 {
+ return LargeUtf8;
+ }
+ }
+
+ Utf8
+ }
+
+ /// Concatenate array arguments
+ fn concat_arrays(&self, args: &[ColumnarValue]) -> Result<ColumnarValue> {
+ if args.is_empty() {
+ return plan_err!("concat requires at least one argument");
}
+
+ // Convert ColumnarValue arguments to ArrayRef
+ let arrays: Result<Vec<Arc<dyn Array>>> = args
Review Comment:
Changed from:
`let arrays: Result<Vec<Arc<dyn Array>>> = args.iter().map(|arg| match arg
{...`
to simply:
` let arrays = ColumnarValue::values_to_arrays(args)?;`
--
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]