Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[b/330547397] Adjust negative index handling for SPLIT (#48)
If we receive a request like `SPLIT("a-b-c", "-", -2)`, we should return `b` since that is the second to last element of the resulting split ([a, b, c]). We can do this in BigQuery by reversing the array (using ARRAY_REVERSE) and then multiplying the index by -1. Previously, we correctly reversed the array, but we continued using the original negative index instead of its additive inverse. This change corrects that.
- Loading branch information