The following code on Google BigQuery throws an index out of bounds error.
SELECT
SPLIT(CONCEPT_CKI, "!")[OFFSET(0)] AS Standard_Name
,SPLIT(CONCEPT_CKI, "!")[OFFSET(1)] AS Standard_Code
FROM
(
SELECT "MULTUM!123" AS CONCEPT_CKI
UNION ALL
SELECT "MULTUM234" AS CONCEPT_CKI
)
We would like the split to work on fields it can work on - and simply yield a NULL value for the second field when it cannot. (i.e. somewhat similar to how the SAFE_CAST command gives a NULL if it cannot do the cast.)
How do we do a "safe" SPLIT on fields in Google BigQuery?