Is there a way to match zz-10%
in find_in_set
?
For example:
select find_in_set('zz-1000','zz-10%,zz-2000,zz-3000');
This should return 1
but Impala doesn't support it.
I am wondering if there is some trick with Regex to workaround? The find_in_set
seems to do only exact match.
Ideally this should return 1
only as I want to avoid hardcoding a bunch of zz-10%
variations.
This is the definition of this function from https://www.cloudera.com/documentation/enterprise/5-14-x/topics/impala_string_functions.html
find_in_set(string str, string strList)
Purpose: Returns the position (starting from 1) of the first occurrence of a specified string within a comma-separated string. Returns NULL if either argument is NULL, 0 if the search string is not found, or 0 if the search string contains a comma. Return type: int
I cannot change zz-1000
(the first param) because it's basically a Column. I could do a bunch of IF / CASE WHEN though if there is a way.
Thanks.
UPDATE 1
I tried this:
select find_in_set('zz-1000','zz-10\d+,zz-2000,zz-3000');
And got this:
+----------------------------------------------------+
| find_in_set('zz-1000', 'zz-10\d+,zz-2000,zz-3000') |
+----------------------------------------------------+
| 0 |
+----------------------------------------------------+
So that doesn't work either.