You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/01/24 13:19:27 UTC

[GitHub] [arrow-datafusion] ovr commented on a change in pull request #1660: fix: substr - correct behaivour with negative start pos

ovr commented on a change in pull request #1660:
URL: https://github.com/apache/arrow-datafusion/pull/1660#discussion_r790733421



##########
File path: datafusion/src/physical_plan/functions.rs
##########
@@ -3680,6 +3704,60 @@ mod tests {
             StringArray
         );
         #[cfg(feature = "unicode_expressions")]
+        test_function!(

Review comment:
       You are right, i did another iteration and looks like I found a way how to get similar behaviour
   
   PG:
   
   
   ```
   select substr('alphabet', 0, 5) as s1, substr('alphabet', -5, 10) as s2, substr('alphabet', -5, 4) as s3;
   
   [
     {
       "s1": "alph",
       "s2": "alph",
       "s3": ""
     }
   ]
   ```
   
   DF:
   
   ```
   ❯ select substr('alphabet', 0, 5) as s1, substr('alphabet', -5, 10) as s2, substr('alphabet', -5, 4) as s3;
   +------+------+----+
   | s1   | s2   | s3 |
   +------+------+----+
   | alph | alph |    |
   +------+------+----+
   1 row in set. Query took 0.016 seconds.
   
   ```




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org