jayzhan211 commented on code in PR #14865: URL: https://github.com/apache/datafusion/pull/14865#discussion_r1971048076
########## datafusion/functions/src/string/btrim.rs: ########## @@ -19,20 +19,28 @@ use crate::string::common::*; use crate::utils::{make_scalar_function, utf8_to_str_type}; use arrow::array::{ArrayRef, OffsetSizeTrait}; use arrow::datatypes::DataType; +use datafusion_common::types::logical_string; use datafusion_common::{exec_err, Result}; use datafusion_expr::function::Hint; use datafusion_expr::{ - ColumnarValue, Documentation, ScalarFunctionArgs, ScalarUDFImpl, Signature, - TypeSignature, Volatility, + Coercion, ColumnarValue, Documentation, ScalarFunctionArgs, ScalarUDFImpl, Signature, + TypeSignature, TypeSignatureClass, Volatility, }; use datafusion_macros::user_doc; use std::any::Any; +use std::sync::Arc; /// Returns the longest string with leading and trailing characters removed. If the characters are not specified, whitespace is removed. /// btrim('xyxtrimyyx', 'xyz') = 'trim' fn btrim<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> { let use_string_view = args[0].data_type() == &DataType::Utf8View; - general_trim::<T>(args, TrimType::Both, use_string_view) + let args = if args.len() > 1 { Review Comment: casting logic should be in `invoke_with_args` to keep this kernel function easy to be reuse -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org