GlareDB / glaredb

GlareDB: An analytics DBMS for distributed data
https://glaredb.com
GNU Affero General Public License v3.0
535 stars 35 forks source link

additional string `split` functions #2926

Open universalmind303 opened 3 weeks ago

universalmind303 commented 3 weeks ago

Description

Add a few additional functions for splitting strings into arrays.

create table strings (v text);
insert into strings values ("foo bar"), ("foo_bar") ("foo bar baz");

Note: this is the current string_to_array function, but i think split is much more intuitive.

select split(v, ' ') from values;
----
["foo", "bar"]
["foo_bar"]
["foo", "bar", "baz"]
select splitn(v, ' ', 2) from values;
----
["foo", "bar"]
["foo_bar"]
["foo", "bar baz"]