record_id labels
001 ['first_record','transfer']
002 ['withdraw', 'holiday']
003 ['direct','change_password','transfer']
004 ['change_password']
......
Labels column is of string type.
Tried to unnest labels column
select record_id, new_labels from transactions, UNNEST(labels ) as t(new_labels ) order by record_id, new_labels
but got following error
INVALID_FUNCTION_ARGUMENT: Cannot unnest type: varchar
Then tried to cast string to array then to the unnest
select record_id, cast(json_parse(labels) as array(varchar)) as labels from transactions
but got following error:
INVALID_CAST_ARGUMENT: Cannot cast to array(varchar). ['withdraw', 'holiday']
Then simply tried
select cast(['first_record','transfer']) as array(varchar)
it returned
mismatched input '['. Expecting:
0 comments:
Post a Comment
Thanks