/vertica_strsplit

This is a Vertica User Defined Functions (UDF) for split string to multple rows.

Primary LanguageC++

<title>Split string to multiple rows</title>

Split string to multiple rows for Vertica

This is a Vertica User Defined Functions (UDF) for split string to multple rows.

Syntax:

STRSPLIT ( string [using parameters seperator=':separator'] ) over(...)

Parameters:

  • string: input string.
  • separator: separator character for spliting, default value is ','.
  • (return): concat string of input express on window.

Examples:

select word  from strsplitTEST;
word
---------------- SingleWord Break,On,Comma Break:On:Colon (3 rows)
select strsplit(word) over () from strsplittest;
word
---------------- SingleWord Break On Comma Break:On:Colon (5 rows)
select strsplit(word using parameters separator=':') over () from strsplittest;
word
---------------- SingleWord Break,On,Comma Break On Colon (5 rows)

Install, test and uninstall:

Befoe build and install, g++ should be available(yum -y groupinstall "Development tools" && yum -y groupinstall "Additional Development" can help on this).

  • Build: make
  • Install: make install
  • Test: make run
  • Uninstall make uninstall