Weijun-H commented on code in PR #8988:
URL: https://github.com/apache/arrow-datafusion/pull/8988#discussion_r1467175041
##########
datafusion/physical-expr/src/functions.rs:
##########
@@ -938,6 +938,23 @@ pub fn create_physical_fun(
"Unsupported data type {other:?} for function overlay",
))),
}),
+ BuiltinScalarFunction::Position => Arc::new(|args| match
args[0].data_type() {
+ DataType::Utf8 => {
+ make_scalar_function_inner(string_expressions::instr::<i32>)(&[
+ args[1].clone(),
+ args[0].clone(),
+ ])
+ }
+ DataType::LargeUtf8 => {
+ make_scalar_function_inner(string_expressions::instr::<i64>)(&[
+ args[1].clone(),
+ args[0].clone(),
+ ])
+ }
+ other => Err(DataFusionError::Internal(format!(
+ "Unsupported data type {other:?} for function position"
+ ))),
Review Comment:
```suggestion
other => {
internal_err!("Unsupported data type {other:?} for function
overlay")
}
```
##########
datafusion/expr/src/built_in_function.rs:
##########
@@ -735,6 +738,9 @@ impl BuiltinScalarFunction {
utf8_to_int_type(&input_expr_types[0], "octet_length")
}
BuiltinScalarFunction::Pi => Ok(Float64),
+ BuiltinScalarFunction::Position => {
+ utf8_to_int_type(&input_expr_types[0], "position")
Review Comment:
```suggestion
Ok(UInt64)
```
--
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]