Split_part not working as expected

Hello,

According to Dremio documentation in https://docs.dremio.com/sql-reference/sql-functions/functions/SPLIT_PART/?parent=all-functions , if part_number is negative, the parts are counted backwards from the end of the string. However, if I run split_part(A.A.A,’.’,-1)

I get the following error:

GandivaException: Index in split_part must be positive, value provided was -1.

Am I missing something?

Thank you,
Marcos

Sounds like a bug in the documentation? Guessing by the source history at dremio-oss/StringFunctions.java at master · dremio/dremio-oss · GitHub, the check for the negative integers was present since v1.0.8

A workaround could be to use REVERSE(); so something like

SELECT REVERSE(SPLIT_PART(REVERSE('ab.cd.de'),'.',1));

Thanks for letting us know. The documentation will be corrected shortly.