pub(crate) struct FeatureDoc {
pub(crate) phrases: &'static [&'static [&'static str]],
pub(crate) name: &'static str,
pub(crate) syntax: &'static str,
pub(crate) status: &'static str,
pub(crate) coverage: &'static str,
pub(crate) notes: Option<&'static str>,
pub(crate) docs_url: &'static str,
}
pub(crate) struct FunctionDoc {
pub(crate) name: &'static str,
pub(crate) category: &'static str,
pub(crate) signature: &'static str,
pub(crate) returns: &'static str,
pub(crate) summary: &'static str,
pub(crate) status: &'static str,
pub(crate) parenless: bool,
pub(crate) docs_url: &'static str,
}
#[rustfmt::skip]
pub(crate) const FEATURES: &[FeatureDoc] = &[
FeatureDoc {
phrases: &[&["SELECT"]],
name: "SELECT",
syntax: "SELECT [DISTINCT|ALL] <items> ...",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference/sql/select",
},
FeatureDoc {
phrases: &[&["TOP"]],
name: "TOP",
syntax: "SELECT TOP <n> ...",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["VALUES"]],
name: "VALUES",
syntax: "VALUES (..), (..)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["FROM"]],
name: "FROM",
syntax: "FROM <table_ref> [, ...]",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["WHERE"]],
name: "WHERE",
syntax: "WHERE <expr>",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["GROUP", "BY"]],
name: "GROUP BY",
syntax: "GROUP BY <expr>[, ...] | ALL",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CUBE"], &["ROLLUP"], &["GROUPING", "SETS"]],
name: "GROUP BY CUBE/ROLLUP/GROUPING SETS",
syntax: "GROUP BY CUBE|ROLLUP|GROUPING SETS (...)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["HAVING"]],
name: "HAVING",
syntax: "HAVING <expr>",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["QUALIFY"]],
name: "QUALIFY",
syntax: "QUALIFY <expr>",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["ORDER", "BY"]],
name: "ORDER BY",
syntax: "ORDER BY <expr> [ASC|DESC] [NULLS FIRST|LAST]",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["LIMIT"]],
name: "LIMIT",
syntax: "LIMIT <n>",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["OFFSET"]],
name: "OFFSET",
syntax: "OFFSET <n>",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["FETCH"]],
name: "FETCH",
syntax: "FETCH [FIRST|NEXT] <n> ROWS",
status: "GA",
coverage: "todo",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["WINDOW"]],
name: "WINDOW",
syntax: "WINDOW w AS (...)",
status: "GA",
coverage: "partial",
notes: Some("inline OVER(...) is parsed; named WINDOW clause remains tracked separately"),
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["JOIN"], &["INNER", "JOIN"]],
name: "INNER JOIN",
syntax: "[INNER] JOIN t ON|USING",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["LEFT", "JOIN"], &["RIGHT", "JOIN"], &["FULL", "JOIN"], &["LEFT", "OUTER", "JOIN"], &["RIGHT", "OUTER", "JOIN"], &["FULL", "OUTER", "JOIN"]],
name: "OUTER JOIN",
syntax: "LEFT|RIGHT|FULL [OUTER] JOIN t ON|USING",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CROSS", "JOIN"]],
name: "CROSS JOIN",
syntax: "CROSS JOIN t",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["NATURAL", "JOIN"]],
name: "NATURAL JOIN",
syntax: "NATURAL [type] JOIN t",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["LATERAL"]],
name: "LATERAL",
syntax: "FROM t, LATERAL (...)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["ASOF", "JOIN"]],
name: "ASOF JOIN",
syntax: "ASOF JOIN t MATCH_CONDITION (...)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["UNION"]],
name: "UNION",
syntax: "q UNION [ALL] q",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["EXCEPT"]],
name: "EXCEPT",
syntax: "q EXCEPT q",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["INTERSECT"]],
name: "INTERSECT",
syntax: "q INTERSECT q",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["MINUS"]],
name: "MINUS",
syntax: "q MINUS q",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["WITH"]],
name: "WITH",
syntax: "WITH [RECURSIVE] name [(cols)] AS (q) [, ...]",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["EXISTS"]],
name: "EXISTS",
syntax: "[NOT] EXISTS (q)",
status: "GA",
coverage: "parse",
notes: Some("EXISTS parsed; NOT EXISTS via prefix NOT"),
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["IS", "NULL"]],
name: "IS NULL",
syntax: "x IS [NOT] NULL",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["IN"]],
name: "IN",
syntax: "x [NOT] IN (list|q)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["BETWEEN"]],
name: "BETWEEN",
syntax: "x [NOT] BETWEEN a AND b",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["LIKE"], &["ILIKE"]],
name: "LIKE/ILIKE",
syntax: "x [NOT] LIKE|ILIKE p",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["RLIKE"], &["REGEXP"]],
name: "RLIKE/REGEXP",
syntax: "x RLIKE|REGEXP p",
status: "GA",
coverage: "todo",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["IS", "DISTINCT", "FROM"]],
name: "IS DISTINCT FROM",
syntax: "x IS [NOT] DISTINCT FROM y",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["OVER"]],
name: "OVER",
syntax: "f(...) OVER (PARTITION BY .. ORDER BY .. <frame>)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CAST"], &["TRY_CAST"]],
name: "CAST/TRY_CAST",
syntax: "CAST(x AS t) / TRY_CAST(x AS t)",
status: "GA",
coverage: "parse",
notes: Some("both ::cast and CAST(..) function form parsed"),
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CASE"]],
name: "CASE",
syntax: "CASE [x] WHEN .. THEN .. ELSE .. END",
status: "GA",
coverage: "parse",
notes: Some("searched + simple forms"),
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["PIVOT"], &["UNPIVOT"]],
name: "PIVOT/UNPIVOT",
syntax: "FROM t PIVOT(..) | UNPIVOT(..)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["MATCH_RECOGNIZE"]],
name: "MATCH_RECOGNIZE",
syntax: "FROM t MATCH_RECOGNIZE (..)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["SAMPLE"], &["TABLESAMPLE"]],
name: "SAMPLE/TABLESAMPLE",
syntax: "FROM t SAMPLE (n ROWS|PERCENT)",
status: "GA",
coverage: "parse",
notes: Some("balanced body retained conservatively"),
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["FLATTEN"]],
name: "FLATTEN",
syntax: "TABLE(FLATTEN(input => ..))",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CONNECT", "BY"]],
name: "CONNECT BY",
syntax: "START WITH .. CONNECT BY ..",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["AT"], &["BEFORE"]],
name: "AT/BEFORE",
syntax: "FROM t AT(TIMESTAMP => ..) | BEFORE(STATEMENT => ..)",
status: "GA",
coverage: "parse",
notes: Some("balanced body retained conservatively"),
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CHANGES"]],
name: "CHANGES",
syntax: "FROM t CHANGES(INFORMATION => ..)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["INSERT"]],
name: "INSERT",
syntax: "INSERT INTO t [(cols)] VALUES|SELECT",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["INSERT", "ALL"], &["INSERT", "FIRST"]],
name: "INSERT ALL/FIRST",
syntax: "INSERT ALL|FIRST WHEN .. INTO ..",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["UPDATE"]],
name: "UPDATE",
syntax: "UPDATE t SET .. WHERE ..",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["DELETE"]],
name: "DELETE",
syntax: "DELETE FROM t WHERE ..",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["MERGE"]],
name: "MERGE",
syntax: "MERGE INTO t USING s ON .. WHEN MATCHED ..",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["COPY", "INTO"]],
name: "COPY INTO",
syntax: "COPY INTO t FROM @stage FILE_FORMAT=(..)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CREATE", "TABLE"]],
name: "CREATE TABLE",
syntax: "CREATE [OR REPLACE] TABLE .. (cols) | AS SELECT | CLONE",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CREATE", "VIEW"]],
name: "CREATE VIEW",
syntax: "CREATE [OR REPLACE] [MATERIALIZED] VIEW .. AS q",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CREATE", "STREAM"]],
name: "CREATE STREAM",
syntax: "CREATE STREAM .. ON TABLE ..",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CREATE", "TASK"]],
name: "CREATE TASK",
syntax: "CREATE TASK .. SCHEDULE=.. AS ..",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CREATE", "DYNAMIC", "TABLE"]],
name: "CREATE DYNAMIC TABLE",
syntax: "CREATE DYNAMIC TABLE .. AS q",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CREATE", "SEMANTIC", "VIEW"]],
name: "CREATE SEMANTIC VIEW",
syntax: "CREATE SEMANTIC VIEW .. TABLES(..) RELATIONSHIPS(..) FACTS(..) DIMENSIONS(..) METRICS(..)",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CREATE", "STAGE"], &["CREATE", "FILE", "FORMAT"], &["CREATE", "SEQUENCE"]],
name: "CREATE STAGE / FILE FORMAT / SEQUENCE",
syntax: "CREATE STAGE|FILE FORMAT|SEQUENCE ..",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["CREATE", "FUNCTION"], &["CREATE", "PROCEDURE"]],
name: "CREATE FUNCTION/PROCEDURE",
syntax: "CREATE FUNCTION|PROCEDURE .. LANGUAGE .. AS $$..$$|'..'",
status: "GA",
coverage: "parse",
notes: None,
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
FeatureDoc {
phrases: &[&["ALTER"], &["DROP"], &["UNDROP"], &["SHOW"], &["DESCRIBE"]],
name: "ALTER/DROP/UNDROP/SHOW/DESCRIBE",
syntax: "ALTER|DROP|UNDROP|SHOW|DESCRIBE ..",
status: "GA",
coverage: "partial",
notes: Some("common forms parse; ALTER remains intentionally lenient"),
docs_url: "https://docs.snowflake.com/en/sql-reference",
},
];
#[rustfmt::skip]
pub(crate) const FUNCTIONS: &[FunctionDoc] = &[
FunctionDoc {
name: "COUNT",
category: "aggregate",
signature: "COUNT( [DISTINCT] <expr> | * )",
returns: "NUMBER",
summary: "Counts rows (*) or non-NULL values; also usable as a window function with OVER.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/count",
},
FunctionDoc {
name: "COUNT_IF",
category: "aggregate",
signature: "COUNT_IF( <condition> )",
returns: "NUMBER",
summary: "Counts the rows where the boolean condition is TRUE.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/count_if",
},
FunctionDoc {
name: "SUM",
category: "aggregate",
signature: "SUM( [DISTINCT] <expr> )",
returns: "NUMBER | FLOAT",
summary: "Adds the non-NULL input values; returns NULL for an empty or all-NULL group.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/sum",
},
FunctionDoc {
name: "AVG",
category: "aggregate",
signature: "AVG( [DISTINCT] <expr> )",
returns: "NUMBER | FLOAT",
summary: "Arithmetic mean of the non-NULL input values.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/avg",
},
FunctionDoc {
name: "MIN",
category: "aggregate",
signature: "MIN( <expr> )",
returns: "same as input",
summary: "Smallest non-NULL value in the group; NULLs are ignored.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/min",
},
FunctionDoc {
name: "MAX",
category: "aggregate",
signature: "MAX( <expr> )",
returns: "same as input",
summary: "Largest non-NULL value in the group; NULLs are ignored.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/max",
},
FunctionDoc {
name: "MEDIAN",
category: "aggregate",
signature: "MEDIAN( <expr> )",
returns: "NUMBER | FLOAT",
summary: "Median of the non-NULL values; interpolates between the two middle values.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/median",
},
FunctionDoc {
name: "ANY_VALUE",
category: "aggregate",
signature: "ANY_VALUE( <expr> )",
returns: "same as input",
summary: "Returns an arbitrary value from the group; cheap way to carry a column through GROUP BY.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/any_value",
},
FunctionDoc {
name: "LISTAGG",
category: "aggregate",
signature: "LISTAGG( [DISTINCT] <expr> [, <delimiter>] ) [ WITHIN GROUP ( ORDER BY ... ) ]",
returns: "VARCHAR",
summary: "Concatenates non-NULL values into one string, optionally ordered and delimited.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/listagg",
},
FunctionDoc {
name: "ARRAY_AGG",
category: "aggregate",
signature: "ARRAY_AGG( [DISTINCT] <expr> ) [ WITHIN GROUP ( ORDER BY ... ) ]",
returns: "ARRAY",
summary: "Collects the non-NULL input values into an ARRAY, optionally ordered.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/array_agg",
},
FunctionDoc {
name: "OBJECT_AGG",
category: "aggregate",
signature: "OBJECT_AGG( <key>, <value> )",
returns: "OBJECT",
summary: "Builds one OBJECT per group from key/value pairs; keys must be unique and non-NULL.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/object_agg",
},
FunctionDoc {
name: "APPROX_COUNT_DISTINCT",
category: "aggregate",
signature: "APPROX_COUNT_DISTINCT( <expr> [, ...] )",
returns: "NUMBER",
summary: "HyperLogLog estimate of the number of distinct values (alias HLL); much cheaper than COUNT(DISTINCT ...).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/approx_count_distinct",
},
FunctionDoc {
name: "PERCENTILE_CONT",
category: "aggregate",
signature: "PERCENTILE_CONT( <fraction> ) WITHIN GROUP ( ORDER BY <expr> )",
returns: "FLOAT",
summary: "Continuous percentile: interpolates the value at the given fraction of the ordered group.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/percentile_cont",
},
FunctionDoc {
name: "STDDEV",
category: "aggregate",
signature: "STDDEV( [DISTINCT] <expr> )",
returns: "FLOAT",
summary: "Sample standard deviation (alias STDDEV_SAMP); use STDDEV_POP for the population form.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/stddev",
},
FunctionDoc {
name: "ROW_NUMBER",
category: "window",
signature: "ROW_NUMBER() OVER ( [PARTITION BY ...] ORDER BY ... )",
returns: "NUMBER",
summary: "Unique 1-based row number within each partition in ORDER BY order.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/row_number",
},
FunctionDoc {
name: "RANK",
category: "window",
signature: "RANK() OVER ( [PARTITION BY ...] ORDER BY ... )",
returns: "NUMBER",
summary: "Rank with gaps: ties share a rank and the next rank skips ahead.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/rank",
},
FunctionDoc {
name: "DENSE_RANK",
category: "window",
signature: "DENSE_RANK() OVER ( [PARTITION BY ...] ORDER BY ... )",
returns: "NUMBER",
summary: "Rank without gaps: ties share a rank and the next distinct value gets the next rank.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/dense_rank",
},
FunctionDoc {
name: "NTILE",
category: "window",
signature: "NTILE( <n> ) OVER ( [PARTITION BY ...] ORDER BY ... )",
returns: "NUMBER",
summary: "Splits each partition into <n> ordered buckets and returns the bucket number.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/ntile",
},
FunctionDoc {
name: "LAG",
category: "window",
signature: "LAG( <expr> [, <offset> [, <default>]] ) OVER ( [PARTITION BY ...] ORDER BY ... )",
returns: "same as input",
summary: "Value from a preceding row in the partition; <default> replaces the out-of-window NULL.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/lag",
},
FunctionDoc {
name: "LEAD",
category: "window",
signature: "LEAD( <expr> [, <offset> [, <default>]] ) OVER ( [PARTITION BY ...] ORDER BY ... )",
returns: "same as input",
summary: "Value from a following row in the partition; <default> replaces the out-of-window NULL.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/lead",
},
FunctionDoc {
name: "FIRST_VALUE",
category: "window",
signature: "FIRST_VALUE( <expr> ) [ IGNORE NULLS ] OVER ( [PARTITION BY ...] ORDER BY ... )",
returns: "same as input",
summary: "First value of the ordered window frame; IGNORE NULLS skips leading NULLs.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/first_value",
},
FunctionDoc {
name: "LAST_VALUE",
category: "window",
signature: "LAST_VALUE( <expr> ) [ IGNORE NULLS ] OVER ( [PARTITION BY ...] ORDER BY ... )",
returns: "same as input",
summary: "Last value of the ordered window frame; mind the default frame end of CURRENT ROW.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/last_value",
},
FunctionDoc {
name: "RATIO_TO_REPORT",
category: "window",
signature: "RATIO_TO_REPORT( <expr> ) OVER ( [PARTITION BY ...] )",
returns: "FLOAT",
summary: "Each row's share of the partition total: value / SUM(value) OVER (...).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/ratio_to_report",
},
FunctionDoc {
name: "CONCAT",
category: "string",
signature: "CONCAT( <expr1>, <expr2> [, ...] )",
returns: "VARCHAR",
summary: "Concatenates strings; equivalent to the || operator, and NULL if any input is NULL.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/concat",
},
FunctionDoc {
name: "CONCAT_WS",
category: "string",
signature: "CONCAT_WS( <separator>, <expr1> [, ...] )",
returns: "VARCHAR",
summary: "Concatenates with a separator between the inputs; NULL if any input is NULL.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/concat_ws",
},
FunctionDoc {
name: "SUBSTR",
category: "string",
signature: "SUBSTR( <string>, <start> [, <length>] )",
returns: "VARCHAR",
summary: "Substring from 1-based <start> (alias SUBSTRING); a negative start counts from the end.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/substr",
},
FunctionDoc {
name: "SPLIT",
category: "string",
signature: "SPLIT( <string>, <separator> )",
returns: "ARRAY",
summary: "Splits a string on the literal separator into an ARRAY of strings.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/split",
},
FunctionDoc {
name: "SPLIT_PART",
category: "string",
signature: "SPLIT_PART( <string>, <delimiter>, <part_number> )",
returns: "VARCHAR",
summary: "Returns the 1-based Nth piece after splitting; a negative index counts from the end.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/split_part",
},
FunctionDoc {
name: "TRIM",
category: "string",
signature: "TRIM( <expr> [, <characters>] )",
returns: "VARCHAR",
summary: "Removes leading and trailing whitespace, or any of the given characters.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/trim",
},
FunctionDoc {
name: "LPAD",
category: "string",
signature: "LPAD( <base>, <length> [, <pad>] )",
returns: "VARCHAR | BINARY",
summary: "Pads (or truncates) the string on the left to <length> using <pad>, default blanks.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/lpad",
},
FunctionDoc {
name: "RPAD",
category: "string",
signature: "RPAD( <base>, <length> [, <pad>] )",
returns: "VARCHAR | BINARY",
summary: "Pads (or truncates) the string on the right to <length> using <pad>, default blanks.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/rpad",
},
FunctionDoc {
name: "UPPER",
category: "string",
signature: "UPPER( <expr> )",
returns: "VARCHAR",
summary: "Uppercases the string.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/upper",
},
FunctionDoc {
name: "LOWER",
category: "string",
signature: "LOWER( <expr> )",
returns: "VARCHAR",
summary: "Lowercases the string.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/lower",
},
FunctionDoc {
name: "INITCAP",
category: "string",
signature: "INITCAP( <expr> [, <delimiters>] )",
returns: "VARCHAR",
summary: "Capitalizes the first letter of each word; <delimiters> overrides the word separators.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/initcap",
},
FunctionDoc {
name: "LENGTH",
category: "string",
signature: "LENGTH( <expr> )",
returns: "NUMBER",
summary: "Length in characters for strings (alias LEN); bytes for BINARY.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/length",
},
FunctionDoc {
name: "REPLACE",
category: "string",
signature: "REPLACE( <subject>, <pattern> [, <replacement>] )",
returns: "VARCHAR",
summary: "Replaces every occurrence of the literal pattern; omitting <replacement> deletes it.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/replace",
},
FunctionDoc {
name: "POSITION",
category: "string",
signature: "POSITION( <needle>, <haystack> [, <start>] ) | POSITION( <needle> IN <haystack> )",
returns: "NUMBER",
summary: "1-based position of the first occurrence, or 0 when not found (alias CHARINDEX with swapped args).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/position",
},
FunctionDoc {
name: "STARTSWITH",
category: "string",
signature: "STARTSWITH( <string>, <prefix> )",
returns: "BOOLEAN",
summary: "TRUE when the string starts with the prefix (case-sensitive).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/startswith",
},
FunctionDoc {
name: "ENDSWITH",
category: "string",
signature: "ENDSWITH( <string>, <suffix> )",
returns: "BOOLEAN",
summary: "TRUE when the string ends with the suffix (case-sensitive).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/endswith",
},
FunctionDoc {
name: "CONTAINS",
category: "string",
signature: "CONTAINS( <haystack>, <needle> )",
returns: "BOOLEAN",
summary: "TRUE when the first argument contains the second (case-sensitive).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/contains",
},
FunctionDoc {
name: "REGEXP_REPLACE",
category: "string",
signature: "REGEXP_REPLACE( <subject>, <pattern> [, <replacement>, <position>, <occurrence>, <parameters>] )",
returns: "VARCHAR",
summary: "Regex replace; the default empty <replacement> deletes matches, and backslashes must be doubled in string literals.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/regexp_replace",
},
FunctionDoc {
name: "REGEXP_SUBSTR",
category: "string",
signature: "REGEXP_SUBSTR( <subject>, <pattern> [, <position>, <occurrence>, <parameters>, <group_num>] )",
returns: "VARCHAR",
summary: "Returns the matching substring (or capture group) for the Nth regex match, or NULL.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/regexp_substr",
},
FunctionDoc {
name: "COALESCE",
category: "conditional",
signature: "COALESCE( <expr1>, <expr2> [, ...] )",
returns: "first non-NULL argument",
summary: "First non-NULL argument, evaluated left to right.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/coalesce",
},
FunctionDoc {
name: "NULLIF",
category: "conditional",
signature: "NULLIF( <expr1>, <expr2> )",
returns: "same as first input",
summary: "NULL when both arguments are equal, otherwise the first argument.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/nullif",
},
FunctionDoc {
name: "IFF",
category: "conditional",
signature: "IFF( <condition>, <true_result>, <false_result> )",
returns: "result type",
summary: "Single-branch if/then/else; NULL conditions fall through to <false_result>.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/iff",
},
FunctionDoc {
name: "IFNULL",
category: "conditional",
signature: "IFNULL( <expr1>, <expr2> )",
returns: "result type",
summary: "Second argument when the first is NULL (alias NVL).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/ifnull",
},
FunctionDoc {
name: "NVL",
category: "conditional",
signature: "NVL( <expr1>, <expr2> )",
returns: "result type",
summary: "Second argument when the first is NULL (alias of IFNULL).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/nvl",
},
FunctionDoc {
name: "NVL2",
category: "conditional",
signature: "NVL2( <expr1>, <not_null_result>, <null_result> )",
returns: "result type",
summary: "Returns the second argument when the first is not NULL, otherwise the third.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/nvl2",
},
FunctionDoc {
name: "ZEROIFNULL",
category: "conditional",
signature: "ZEROIFNULL( <expr> )",
returns: "NUMBER",
summary: "0 when the input is NULL, otherwise the input.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/zeroifnull",
},
FunctionDoc {
name: "DECODE",
category: "conditional",
signature: "DECODE( <expr>, <search1>, <result1> [, <search2>, <result2>, ...] [, <default>] )",
returns: "result type",
summary: "Compares against each search value (NULL matches NULL) and returns the paired result.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/decode",
},
FunctionDoc {
name: "GREATEST",
category: "conditional",
signature: "GREATEST( <expr1> [, ...] )",
returns: "largest argument",
summary: "Largest argument; NULL if any argument is NULL (see GREATEST_IGNORE_NULLS).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/greatest",
},
FunctionDoc {
name: "LEAST",
category: "conditional",
signature: "LEAST( <expr1> [, ...] )",
returns: "smallest argument",
summary: "Smallest argument; NULL if any argument is NULL (see LEAST_IGNORE_NULLS).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/least",
},
FunctionDoc {
name: "EQUAL_NULL",
category: "conditional",
signature: "EQUAL_NULL( <expr1>, <expr2> )",
returns: "BOOLEAN",
summary: "NULL-safe equality: TRUE when both are equal or both are NULL.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/equal_null",
},
FunctionDoc {
name: "ABS",
category: "numeric",
signature: "ABS( <expr> )",
returns: "same as input",
summary: "Absolute value.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/abs",
},
FunctionDoc {
name: "CEIL",
category: "numeric",
signature: "CEIL( <expr> [, <scale>] )",
returns: "NUMBER | FLOAT",
summary: "Rounds up (toward positive infinity) to the given scale, default 0 digits.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/ceil",
},
FunctionDoc {
name: "FLOOR",
category: "numeric",
signature: "FLOOR( <expr> [, <scale>] )",
returns: "NUMBER | FLOAT",
summary: "Rounds down (toward negative infinity) to the given scale, default 0 digits.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/floor",
},
FunctionDoc {
name: "ROUND",
category: "numeric",
signature: "ROUND( <expr> [, <scale>] [, <rounding_mode>] )",
returns: "NUMBER | FLOAT",
summary: "Rounds half away from zero by default; HALF_TO_EVEN is available as the rounding mode.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/round",
},
FunctionDoc {
name: "TRUNC",
category: "numeric",
signature: "TRUNC( <expr> [, <scale>] ) | TRUNC( <date_or_time_expr>, <date_part> )",
returns: "NUMBER | DATE/TIMESTAMP",
summary: "Truncates toward zero at the given scale; the two-argument date form works like DATE_TRUNC.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/trunc",
},
FunctionDoc {
name: "MOD",
category: "numeric",
signature: "MOD( <dividend>, <divisor> )",
returns: "NUMBER",
summary: "Remainder with the sign of the dividend; also available as the % operator.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/mod",
},
FunctionDoc {
name: "POWER",
category: "numeric",
signature: "POWER( <base>, <exponent> )",
returns: "FLOAT",
summary: "Raises the base to the exponent (alias POW).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/power",
},
FunctionDoc {
name: "SQRT",
category: "numeric",
signature: "SQRT( <expr> )",
returns: "FLOAT",
summary: "Square root; errors on negative input.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/sqrt",
},
FunctionDoc {
name: "RANDOM",
category: "numeric",
signature: "RANDOM( [<seed>] )",
returns: "NUMBER",
summary: "Pseudo-random 64-bit integer per row; a seed makes the sequence repeatable within a query.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/random",
},
FunctionDoc {
name: "UNIFORM",
category: "numeric",
signature: "UNIFORM( <min>, <max>, <gen> )",
returns: "NUMBER | FLOAT",
summary: "Uniformly distributed value in [min, max]; pass RANDOM() as the generator.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/uniform",
},
FunctionDoc {
name: "CURRENT_DATE",
category: "context",
signature: "CURRENT_DATE[()]",
returns: "DATE",
summary: "Current date in the session time zone.",
status: "GA",
parenless: true,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/current_date",
},
FunctionDoc {
name: "CURRENT_TIMESTAMP",
category: "context",
signature: "CURRENT_TIMESTAMP[( [<fract_sec_precision>] )]",
returns: "TIMESTAMP_LTZ",
summary: "Current timestamp in the session time zone.",
status: "GA",
parenless: true,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/current_timestamp",
},
FunctionDoc {
name: "SYSDATE",
category: "context",
signature: "SYSDATE()",
returns: "TIMESTAMP_NTZ",
summary: "Current timestamp in UTC, independent of the session time zone.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/sysdate",
},
FunctionDoc {
name: "CURRENT_USER",
category: "context",
signature: "CURRENT_USER[()]",
returns: "VARCHAR",
summary: "Name of the user who is running the session.",
status: "GA",
parenless: true,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/current_user",
},
FunctionDoc {
name: "CURRENT_ROLE",
category: "context",
signature: "CURRENT_ROLE[()]",
returns: "VARCHAR",
summary: "Primary role active in the session, or NULL when only secondary roles are active.",
status: "GA",
parenless: true,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/current_role",
},
FunctionDoc {
name: "CURRENT_WAREHOUSE",
category: "context",
signature: "CURRENT_WAREHOUSE()",
returns: "VARCHAR",
summary: "Name of the warehouse in use for the session.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/current_warehouse",
},
FunctionDoc {
name: "CURRENT_DATABASE",
category: "context",
signature: "CURRENT_DATABASE()",
returns: "VARCHAR",
summary: "Database in use for the session, or NULL when none is selected.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/current_database",
},
FunctionDoc {
name: "CURRENT_SCHEMA",
category: "context",
signature: "CURRENT_SCHEMA()",
returns: "VARCHAR",
summary: "Schema in use for the session, or NULL when none is selected.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/current_schema",
},
FunctionDoc {
name: "DATEADD",
category: "datetime",
signature: "DATEADD( <date_or_time_part>, <value>, <date_or_time_expr> )",
returns: "DATE | TIME | TIMESTAMP",
summary: "Adds the signed value of the given part (day, month, hour, ...) to a date/time.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/dateadd",
},
FunctionDoc {
name: "DATEDIFF",
category: "datetime",
signature: "DATEDIFF( <date_or_time_part>, <start>, <end> )",
returns: "NUMBER",
summary: "Counts part boundaries crossed between start and end (not elapsed time): end minus start.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/datediff",
},
FunctionDoc {
name: "DATE_TRUNC",
category: "datetime",
signature: "DATE_TRUNC( <date_or_time_part>, <expr> )",
returns: "same as input",
summary: "Truncates a date/time down to the start of the given part (year, month, day, hour, ...).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/date_trunc",
},
FunctionDoc {
name: "DATE_PART",
category: "datetime",
signature: "DATE_PART( <date_or_time_part>, <expr> )",
returns: "NUMBER",
summary: "Extracts the numeric value of the given part; EXTRACT(<part> FROM <expr>) is equivalent.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/date_part",
},
FunctionDoc {
name: "EXTRACT",
category: "datetime",
signature: "EXTRACT( <date_or_time_part> FROM <expr> )",
returns: "NUMBER",
summary: "SQL-standard spelling of DATE_PART.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/extract",
},
FunctionDoc {
name: "LAST_DAY",
category: "datetime",
signature: "LAST_DAY( <date_or_time_expr> [, <date_part>] )",
returns: "DATE",
summary: "Last day of the month (default) or of the given part, e.g. year or quarter.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/last_day",
},
FunctionDoc {
name: "CONVERT_TIMEZONE",
category: "datetime",
signature: "CONVERT_TIMEZONE( [<source_tz>,] <target_tz>, <timestamp> )",
returns: "TIMESTAMP_NTZ | TIMESTAMP_TZ",
summary: "Converts between IANA time zones; the two-argument form treats the input as TIMESTAMP_LTZ.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/convert_timezone",
},
FunctionDoc {
name: "TO_VARCHAR",
category: "conversion",
signature: "TO_VARCHAR( <expr> [, <format>] )",
returns: "VARCHAR",
summary: "Converts to text, optionally with a number or date/time format model (alias TO_CHAR).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/to_varchar",
},
FunctionDoc {
name: "TO_NUMBER",
category: "conversion",
signature: "TO_NUMBER( <expr> [, <format>] [, <precision>, <scale>] )",
returns: "NUMBER",
summary: "Converts to a fixed-point number (alias TO_DECIMAL); errors on invalid input, see TRY_TO_NUMBER.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/to_number",
},
FunctionDoc {
name: "TO_DATE",
category: "conversion",
signature: "TO_DATE( <expr> [, <format>] )",
returns: "DATE",
summary: "Converts strings, timestamps, or epoch numbers to DATE; errors on invalid input, see TRY_TO_DATE.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/to_date",
},
FunctionDoc {
name: "TO_TIMESTAMP",
category: "conversion",
signature: "TO_TIMESTAMP( <expr> [, <format> | <scale>] )",
returns: "TIMESTAMP_NTZ",
summary: "Converts to a timestamp; _NTZ/_LTZ/_TZ variants pick the time zone flavor explicitly.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/to_timestamp",
},
FunctionDoc {
name: "TRY_TO_NUMBER",
category: "conversion",
signature: "TRY_TO_NUMBER( <string> [, <format>] [, <precision>, <scale>] )",
returns: "NUMBER",
summary: "Like TO_NUMBER but returns NULL instead of erroring on unparsable input.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/try_to_number",
},
FunctionDoc {
name: "TRY_TO_DATE",
category: "conversion",
signature: "TRY_TO_DATE( <string> [, <format>] )",
returns: "DATE",
summary: "Like TO_DATE but returns NULL instead of erroring on unparsable input.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/try_to_date",
},
FunctionDoc {
name: "TRY_TO_TIMESTAMP",
category: "conversion",
signature: "TRY_TO_TIMESTAMP( <string> [, <format>] )",
returns: "TIMESTAMP_NTZ",
summary: "Like TO_TIMESTAMP but returns NULL instead of erroring on unparsable input.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/try_to_timestamp",
},
FunctionDoc {
name: "TO_JSON",
category: "conversion",
signature: "TO_JSON( <variant_expr> )",
returns: "VARCHAR",
summary: "Serializes a VARIANT value to a JSON string; inverse of PARSE_JSON.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/to_json",
},
FunctionDoc {
name: "PARSE_JSON",
category: "conversion",
signature: "PARSE_JSON( <string> )",
returns: "VARIANT",
summary: "Parses JSON text into a VARIANT; errors on invalid JSON, see TRY_PARSE_JSON.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/parse_json",
},
FunctionDoc {
name: "TRY_PARSE_JSON",
category: "conversion",
signature: "TRY_PARSE_JSON( <string> )",
returns: "VARIANT",
summary: "Like PARSE_JSON but returns NULL instead of erroring on invalid JSON.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/try_parse_json",
},
FunctionDoc {
name: "FLATTEN",
category: "table",
signature: "FLATTEN( [INPUT =>] <expr> [, PATH => <path>] [, OUTER => TRUE|FALSE] [, RECURSIVE => TRUE|FALSE] [, MODE => 'OBJECT'|'ARRAY'|'BOTH'] )",
returns: "rows: SEQ, KEY, PATH, INDEX, VALUE, THIS",
summary: "Table function that explodes an ARRAY/OBJECT into rows; use with LATERAL or TABLE(...).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/flatten",
},
FunctionDoc {
name: "GENERATOR",
category: "table",
signature: "GENERATOR( ROWCOUNT => <n> [, TIMELIMIT => <seconds>] )",
returns: "rows with no columns",
summary: "Table function producing synthetic rows; pair with SEQ4()/RANDOM() inside TABLE(...).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/generator",
},
FunctionDoc {
name: "SEQ4",
category: "table",
signature: "SEQ4( [0|1] )",
returns: "NUMBER",
summary: "Sequence of 4-byte integers for generated rowsets (also SEQ1/SEQ2/SEQ8); may contain gaps — use ROW_NUMBER for gap-free numbering.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/seq4",
},
FunctionDoc {
name: "GET",
category: "semistructured",
signature: "GET( <object_or_array>, <key_or_index> )",
returns: "VARIANT",
summary: "Element by object key or 0-based array index; NULL when absent. Bracket/colon syntax compiles to this.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/get",
},
FunctionDoc {
name: "GET_PATH",
category: "semistructured",
signature: "GET_PATH( <variant>, <path_string> )",
returns: "VARIANT",
summary: "Extracts a nested element by path such as 'a.b[0].c'; the : path operator is shorthand for this.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/get_path",
},
FunctionDoc {
name: "OBJECT_CONSTRUCT",
category: "semistructured",
signature: "OBJECT_CONSTRUCT( [<key1>, <value1> [, ...]] | * )",
returns: "OBJECT",
summary: "Builds an OBJECT from key/value pairs or all columns (*); pairs with NULL key or value are dropped (see OBJECT_CONSTRUCT_KEEP_NULL).",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/object_construct",
},
FunctionDoc {
name: "OBJECT_KEYS",
category: "semistructured",
signature: "OBJECT_KEYS( <object> )",
returns: "ARRAY",
summary: "Top-level keys of an OBJECT (or object-typed VARIANT) as an array of strings.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/object_keys",
},
FunctionDoc {
name: "ARRAY_CONSTRUCT",
category: "semistructured",
signature: "ARRAY_CONSTRUCT( [<expr> [, ...]] )",
returns: "ARRAY",
summary: "Builds an ARRAY from the arguments; [a, b, c] literal syntax is equivalent.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/array_construct",
},
FunctionDoc {
name: "ARRAY_SIZE",
category: "semistructured",
signature: "ARRAY_SIZE( <array> )",
returns: "NUMBER",
summary: "Number of elements in an ARRAY (or array-typed VARIANT); NULL for non-arrays.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/array_size",
},
FunctionDoc {
name: "ARRAY_CONTAINS",
category: "semistructured",
signature: "ARRAY_CONTAINS( <value>, <array> )",
returns: "BOOLEAN",
summary: "TRUE when the array contains the value; note the value comes first.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/array_contains",
},
FunctionDoc {
name: "ARRAY_TO_STRING",
category: "semistructured",
signature: "ARRAY_TO_STRING( <array>, <separator> )",
returns: "VARCHAR",
summary: "Joins array elements into one string with the separator; NULL elements become empty strings.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/array_to_string",
},
FunctionDoc {
name: "TYPEOF",
category: "semistructured",
signature: "TYPEOF( <variant_expr> )",
returns: "VARCHAR",
summary: "Type of the value stored in a VARIANT, e.g. 'VARCHAR', 'INTEGER', 'OBJECT', 'ARRAY', 'NULL_VALUE'.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/typeof",
},
FunctionDoc {
name: "HASH",
category: "misc",
signature: "HASH( <expr> [, ...] )",
returns: "NUMBER",
summary: "Stable (non-cryptographic) 64-bit signed hash of the arguments; do not use for security.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/hash",
},
FunctionDoc {
name: "MD5",
category: "misc",
signature: "MD5( <message> )",
returns: "VARCHAR(32)",
summary: "MD5 digest as 32 hex characters.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/md5",
},
FunctionDoc {
name: "SHA2",
category: "misc",
signature: "SHA2( <message> [, <digest_size>] )",
returns: "VARCHAR",
summary: "SHA-2 digest as hex; digest size 224, 256 (default), 384, or 512.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/sha2",
},
FunctionDoc {
name: "UUID_STRING",
category: "misc",
signature: "UUID_STRING( [<uuid_namespace>, <name>] )",
returns: "VARCHAR",
summary: "Random version-4 UUID, or a deterministic version-5 UUID from a namespace and name.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/uuid_string",
},
FunctionDoc {
name: "SYSTEM$STREAM_HAS_DATA",
category: "misc",
signature: "SYSTEM$STREAM_HAS_DATA( '<stream_name>' )",
returns: "BOOLEAN",
summary: "TRUE when a stream has change records to consume; the usual guard in a task WHEN clause.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/system_stream_has_data",
},
FunctionDoc {
name: "AI_COMPLETE",
category: "ai",
signature: "AI_COMPLETE( <model>, <prompt> [, <model_parameters>, <response_format>, <show_details>] )",
returns: "VARCHAR | VARIANT",
summary: "Generates an LLM completion for the prompt; the AISQL successor to SNOWFLAKE.CORTEX.COMPLETE.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/ai_complete",
},
FunctionDoc {
name: "SNOWFLAKE.CORTEX.COMPLETE",
category: "ai",
signature: "SNOWFLAKE.CORTEX.COMPLETE( <model>, <prompt_or_history> [, <options>] )",
returns: "VARCHAR | VARIANT",
summary: "LLM completion with a chosen model; newer workloads should prefer AI_COMPLETE.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/complete-snowflake-cortex",
},
FunctionDoc {
name: "SNOWFLAKE.CORTEX.SENTIMENT",
category: "ai",
signature: "SNOWFLAKE.CORTEX.SENTIMENT( <text> )",
returns: "FLOAT",
summary: "Sentiment score from -1 (negative) to 1 (positive) for English text.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/sentiment-snowflake-cortex",
},
FunctionDoc {
name: "SNOWFLAKE.CORTEX.TRANSLATE",
category: "ai",
signature: "SNOWFLAKE.CORTEX.TRANSLATE( <text>, <source_language>, <target_language> )",
returns: "VARCHAR",
summary: "Translates text between supported languages; '' as source language enables auto-detection.",
status: "GA",
parenless: false,
docs_url: "https://docs.snowflake.com/en/sql-reference/functions/translate-snowflake-cortex",
},
];