i need help on parsing strings which are separated by pipe. the first number is the key, and the subsequent string after pipe are values for that key in hundreds
|01|00109394|05|84|08|34353637
this should be broken into keys which are the length=2 number after the first pipe values: after each key
- first_key = 01, values = 00, 10, 93, 94
- second_key = 05, values = 84
- so on...
the script should break the string and explode to rows so that the column "key" will have all the keys, the column "values" will have all the all the values
sample output
KEY Value
01 00
01 10
01 93
01 94
05 84
08 34
08 35
Here is the code i wrote but not working
Select my_key, explode(str_to_map(my_key,'[|]','[|]')) as (Key, Value)
from test_table;
Please suggest how to parse this string