Description
Current datafusion version of substr
and substring
is compatible with PostgreSQL. The main difference is treatment of negative numbers in second argument. For example:
SELECT substr('mystring', -1, 3);
-> result m
in PostgreSQL and datafusion
SELECT substr('mystring', -1, 3);
- > result g
in Snowflake.
We should create our own version of substr
which follow this documentation:
https://docs.snowflake.com/en/sql-reference/functions/substr .
To complete this task we need:
- Follow guidelines in crates/embucket-functions/docs/function_implementation_guide.md
- Use the datafusion substr implementation as reference
- Create snapshot tests in embucket-functions/src/tests/string_binary folder.