Один из способов - сгладить их по отдельности и объединить по их индексам:
with
x as (select '400,500,600,700'as c1,'st1,st2,st2' as c2),
a as (select value::string a1, index from x, lateral flatten(input=>split(x.c1, ','))),
b as (select value::string a2, index from x, lateral flatten(input=>split(x.c2, ',')))
select a1,a2 from a full outer join b on a.index=b.index;
Аналогично, с помощью SPLIT_TO_TABLE ():
with
x as (select '400,500,600,700'as c1,'st1,st2,st2' as c2),
a as (select value::string a1, index from x, lateral split_to_table(x.c1, ',')),
b as (select value::string a2, index from x, lateral split_to_table(x.c2, ','))
select a1,a2 from a full outer join b on a.index=b.index;
Дальнейшее разъяснение @Andrii Солдатенко - Спасибо:
, чтобы объяснить идею, я бы порекомендовал сначала выполнить это:
select * from(select 'st1,st2' as c2) as x2,
lateral flatten(input=>split(c2, ',')) b;
+---------+-----+------+------+-------+-------+----------+
| C2 | SEQ | KEY | PATH | INDEX | VALUE | THIS |
|---------+-----+------+------+-------+-------+----------|
| st1,st2 | 1 | NULL | [0] | 0 | "st1" | [ |
| | | | | | | "st1", |
| | | | | | | "st2" |
| | | | | | | ] |
| st1,st2 | 1 | NULL | [1] | 1 | "st2" | [ |
| | | | | | | "st1", |
| | | | | | | "st2" |
| | | | | | | ] |
+---------+-----+------+------+-------+-------+----------+
2 Row(s) produced. Time Elapsed: 1.357s