SteveLauC commented on code in PR #9396:
URL: https://github.com/apache/arrow-datafusion/pull/9396#discussion_r1506987789


##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -750,7 +750,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         schema: &DFSchema,
         planner_context: &mut PlannerContext,
     ) -> Result<Expr> {
-        let fun = BuiltinScalarFunction::InStr;
+        let fun = BuiltinScalarFunction::Strpos;

Review Comment:
   Now we use `strpos()` for `position()`



##########
datafusion/core/tests/dataframe/dataframe_functions.rs:
##########
@@ -282,26 +282,6 @@ async fn test_fn_initcap() -> Result<()> {
     Ok(())
 }
 
-#[tokio::test]

Review Comment:
   Removed this test because there is already a test for `strpos()`



##########
docs/source/user-guide/sql/scalar_functions.md:
##########
@@ -1440,15 +1439,16 @@ Additional examples can be found 
[here](https://github.com/apache/arrow-datafusi
 
 ### `position`
 
-Returns the position of substr in orig_str
+Returns the position of `substr` in `origstr` (counting from 1). If `substr` 
does
+not appear in `origstr`, return 0.
 
 ```
 position(substr in origstr)
 ```
 
 #### Arguments
 
-- **substr**: he pattern string.
+- **substr**: The pattern string.

Review Comment:
   Correct a typo



##########
datafusion/physical-expr/src/functions.rs:
##########
@@ -1379,95 +1370,6 @@ mod tests {
             Utf8,
             StringArray
         );
-        test_function!(

Review Comment:
   For the following tests, some are migrated to `strpos()`, and some are 
removed because tests of `strpos()` already have them covered



##########
docs/source/user-guide/sql/scalar_functions.md:
##########
@@ -1440,15 +1439,16 @@ Additional examples can be found 
[here](https://github.com/apache/arrow-datafusi
 
 ### `position`
 
-Returns the position of substr in orig_str
+Returns the position of `substr` in `origstr` (counting from 1). If `substr` 
does

Review Comment:
   Add more doc for `position()`



-- 
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]

Reply via email to