Trino 实现了类似 regexp_split_to_table() 的功能?
Trino implement a function like regexp_split_to_table()?
各位,
我是 Trino 的新手,我发现 Trino 没有像 GreenPlum 或 PostgreSQL 中的 regexp_split_to_table()
那样的功能。我该如何处理?
select regexp_split_to_table( sensor_type, E',+' ) as type from hydrology.device_info;
有regexp_split(string, pattern) function, returns array, you can unnest个。
演示:
select s.str as original_str, u.str as exploded_value
from
(select 'one,two,,,three' as str)s
cross join unnest(regexp_split(s.str,',+')) as u(str)
结果:
original_str exploded_value
one,two,,,three one
one,two,,,three two
one,two,,,three three
各位,
我是 Trino 的新手,我发现 Trino 没有像 GreenPlum 或 PostgreSQL 中的 regexp_split_to_table()
那样的功能。我该如何处理?
select regexp_split_to_table( sensor_type, E',+' ) as type from hydrology.device_info;
有regexp_split(string, pattern) function, returns array, you can unnest个。
演示:
select s.str as original_str, u.str as exploded_value
from
(select 'one,two,,,three' as str)s
cross join unnest(regexp_split(s.str,',+')) as u(str)
结果:
original_str exploded_value
one,two,,,three one
one,two,,,three two
one,two,,,three three