split_string

SPLIT_STRING

Splits a buffer (string or expression) into multiple columns or rows.

  • Parameters:

    • p_string (str) – The input string of characters or an expression.

    • p_expression (bool) – Set to True if p_string is an expression (e.g., a function call).

    • p_chunk_str (str) – Delimiter character or regex-like pattern (e.g., '[; ]').

    • p_chunk_size (int) – Fixed column size for splitting at specific intervals.

    • p_skip_elements (int) – Number of initial elements (e.g., header rows) to skip.

    • p_emits (bool) – If True, performs an Unpivot (returns rows instead of columns).

    • p_remove_empty_elements (bool) – If True, empty strings will be filtered out.

    • p_strict_col_count (bool) – If True, the number of emitted columns must match the result exactly. If False, results are truncated or filled with NULL.

  • returns: emits – Multiple strings as columns or rows depending on p_emits.

  • raises RequestException: In case of an evaluation or processing error.

Examples

Splitting with multiple delimiters (Regex-style)

1select split_string('a;b c', false, '[; ]', null, null, false, false, false)
2emits (a varchar(2), b varchar(2), c varchar(2));

Fixed size splitting

1select split_string('a;b;c', false, null, 2, null, false, false, true)
2emits (a varchar(2), b varchar(2), c varchar(2));

Unpivot (Emits as rows)

1select split_string('a;b;c', false, null, 2, null, true, false, true)
2emits (val varchar(2));

Splitting data from a URL expression

1select split_string('get_url_data(url="https://example.com/data.csv")', true, chr(10), 0, null, true, false, true)
2emits (data_rows varchar(200000));

split_string.split_string(text_string: str | list[str], is_expression: bool = False, chunk_str: str | None = None, chunk_size: int = 2000000, skip_elements: int = 0, remove_empty_elements: bool = False) → list[str]

Teilt einen Unicode-String in Blöcke von einer bestimmten Byte-Größe.

  • Parameters:

    • text_string (str)|list(str)) – Der zu splittende Unicode-String.

    • is_expression (bool) – Wenn wahr text string wird noch evaluiert.

    • chunk_str (str) – Separator String

    • chunk_size (int) – Die maximale Größe jedes Blocks in Bytes.

    • skip_elements (int) – skip elements

    • remove_empty_elements (bool) – skip elements

  • Returns: list – Eine Liste von Strings