Class SplitToTable

java.lang.Object
dev.frostlake.functions.TableFunction
dev.frostlake.functions.table.SplitToTable

public class SplitToTable extends TableFunction
SPLIT_TO_TABLE — splits a string into one row per part, as SEQ, INDEX and VALUE.

Positional only. Snowflake documents the two parameters as STRING and DELIMITER but does not accept them by name: SPLIT_TO_TABLE(STRING => 'a,b', DELIMITER => ',') is refused with unexpected argument [STRING] at position 1. Both arguments are required — there is no default delimiter. Those refusals are raised at compile time before this runs.

The measured row rules:

  • SEQ numbers the INPUT RECORD, not the part: every row of one call carries the same SEQ, and it starts at 1. INDEX is the 1-based position of the part.
  • A NULL string or a NULL delimiter yields NO rows.
  • An EMPTY delimiter does not split at all — the whole string comes back as one row.
  • An empty string yields one row whose VALUE is empty, and empty parts between consecutive delimiters are kept, leading and trailing ones included.
  • Constructor Details

    • SplitToTable

      public SplitToTable()
  • Method Details

    • execute

      public ResultSet execute(List<Object> positionalArgs)
      The positional form SPLIT_TO_TABLE(string, delimiter) — the only one Snowflake takes.
      Overrides:
      execute in class TableFunction
    • execute

      public ResultSet execute(Map<String,Object> namedArgs)
      The named-argument entry point of the TableFunction contract. SQL never reaches it — a named call is refused while the statement is compiled — so it serves callers inside the engine, which pass the two parameters under their documented names.
      Specified by:
      execute in class TableFunction
    • validateArgs

      public void validateArgs(Map<String,Object> namedArgs)
      Description copied from class: TableFunction
      Validate the arguments passed to the function
      Specified by:
      validateArgs in class TableFunction