alamb commented on code in PR #11968:
URL: https://github.com/apache/datafusion/pull/11968#discussion_r1717575831
##########
datafusion/functions/src/string/overlay.rs:
##########
@@ -76,54 +80,107 @@ impl ScalarUDFImpl for OverlayFunc {
fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue> {
match args[0].data_type() {
- DataType::Utf8 => make_scalar_function(overlay::<i32>,
vec![])(args),
+ DataType::Utf8View | DataType::Utf8 => {
+ make_scalar_function(overlay::<i32>, vec![])(args)
+ }
DataType::LargeUtf8 => make_scalar_function(overlay::<i64>,
vec![])(args),
other => exec_err!("Unsupported data type {other:?} for function
overlay"),
}
}
}
+macro_rules! process_overlay {
Review Comment:
I was just behind -- it seems that @Omega359 did exactly this in
`StringArrayType` https://github.com/apache/datafusion/pull/11941
https://github.com/apache/datafusion/blob/94034bef9357b166d5593de90b00a35563eec3f8/datafusion/functions/src/unicode/lpad.rs#L251-L263
Maybe we can start to pull that trait into its own module and start reusing
it across the string functions 🤔
Also, there is the `ArrayAccessor` pattern used elegantly by @devanbenz in
https://github.com/apache/datafusion/pull/11967 🤔
--
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]