sql-dialect-master 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- backend/__init__.py +1 -0
- backend/api/__init__.py +1 -0
- backend/api/main.py +732 -0
- backend/api/middleware.py +274 -0
- backend/api/rate_limit_store.py +105 -0
- backend/api/readiness.py +178 -0
- backend/core/__init__.py +57 -0
- backend/core/cache.py +261 -0
- backend/core/column_hint_validation.py +22 -0
- backend/core/config.py +546 -0
- backend/core/constants.py +84 -0
- backend/core/exceptions.py +124 -0
- backend/core/function_call_scanner.py +64 -0
- backend/core/function_semantics.py +148 -0
- backend/core/functions_db.json +601 -0
- backend/core/functions_lookup.py +332 -0
- backend/core/metadata.py +71 -0
- backend/core/nl2sql.py +85 -0
- backend/core/nl2sql_components/__init__.py +72 -0
- backend/core/nl2sql_components/aggregations.py +35 -0
- backend/core/nl2sql_components/boolean_conditions.py +279 -0
- backend/core/nl2sql_components/core_extract.py +106 -0
- backend/core/nl2sql_components/evidence.py +122 -0
- backend/core/nl2sql_components/mappings.py +185 -0
- backend/core/nl2sql_components/relations.py +180 -0
- backend/core/nl2sql_components/templates.py +130 -0
- backend/core/nl2sql_components/tokenizer.py +187 -0
- backend/core/nl2sql_legacy.py +22 -0
- backend/core/nl2sql_pipeline/__init__.py +13 -0
- backend/core/nl2sql_pipeline/aggregations.py +26 -0
- backend/core/nl2sql_pipeline/clause_extract.py +97 -0
- backend/core/nl2sql_pipeline/dialect.py +139 -0
- backend/core/nl2sql_pipeline/intent.py +85 -0
- backend/core/nl2sql_pipeline/ir.py +70 -0
- backend/core/nl2sql_pipeline/models.py +30 -0
- backend/core/nl2sql_pipeline/orchestrator.py +576 -0
- backend/core/nl2sql_pipeline/predicates.py +182 -0
- backend/core/nl2sql_pipeline/renderer.py +248 -0
- backend/core/nl2sql_pipeline/resolution.py +69 -0
- backend/core/nl2sql_pipeline/suggestions.py +30 -0
- backend/core/nl2sql_pipeline/templates.py +371 -0
- backend/core/nl2sql_pipeline/validation.py +28 -0
- backend/core/p1_sql_scanner.py +196 -0
- backend/core/p2_data_validation.py +72 -0
- backend/core/parser.py +280 -0
- backend/core/post_processor.py +129 -0
- backend/core/rules.py +808 -0
- backend/core/semantic_diff.py +385 -0
- backend/core/transpiler.py +791 -0
- backend/core/type_mapping.json +593 -0
- backend/core/type_mapping.py +765 -0
- backend/utils/__init__.py +2 -0
- backend/utils/validators.py +407 -0
- frontend/__init__.py +10 -0
- frontend/app_context_v2.py +201 -0
- frontend/core/__init__.py +33 -0
- frontend/core/design_tokens.py +127 -0
- frontend/core/escaping.py +13 -0
- frontend/core/navigation.py +135 -0
- frontend/core/state.py +612 -0
- frontend/core/styles.py +523 -0
- frontend/core/themes.py +69 -0
- frontend/core/viewmodels.py +499 -0
- frontend/pages/__init__.py +0 -0
- frontend/pages/convert.py +283 -0
- frontend/pages/diff.py +157 -0
- frontend/pages/functions.py +100 -0
- frontend/pages/history.py +144 -0
- frontend/pages/lineage.py +168 -0
- frontend/pages/nl2sql.py +305 -0
- frontend/pages/query_analysis.py +120 -0
- frontend/pages/runtime.py +66 -0
- frontend/pages/settings.py +60 -0
- frontend/pages/templates.py +67 -0
- frontend/pages/types.py +110 -0
- frontend/templates_v2.py +53 -0
- frontend/ui/__init__.py +0 -0
- frontend/ui/command_palette.py +153 -0
- frontend/ui/diff.py +275 -0
- frontend/ui/editor.py +102 -0
- frontend/ui/status.py +255 -0
- sql_dialect_master-1.1.1.dist-info/METADATA +360 -0
- sql_dialect_master-1.1.1.dist-info/RECORD +86 -0
- sql_dialect_master-1.1.1.dist-info/WHEEL +5 -0
- sql_dialect_master-1.1.1.dist-info/licenses/LICENSE +21 -0
- sql_dialect_master-1.1.1.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
{
|
|
2
|
+
"categories": ["date", "string", "json", "array", "aggregate", "window"],
|
|
3
|
+
"functions": [
|
|
4
|
+
{"name": "DATE_ADD", "category": "date", "description": "Add days to date",
|
|
5
|
+
"dialects": {"hive": "DATE_ADD(date, n)", "mysql": "DATE_ADD(date, INTERVAL n DAY)", "oracle": "date + n", "tsql": "DATEADD(day, n, date)", "postgres": "date + INTERVAL 'n days'", "spark": "DATE_ADD(date, n)", "trino": "DATE_ADD('day', n, date)", "snowflake": "DATEADD(day, n, date)", "redshift": "DATEADD(day, n, date)", "clickhouse": "addDays(date, n)", "duckdb": "date + INTERVAL n DAY", "databricks": "DATE_ADD(date, n)"}},
|
|
6
|
+
{"name": "DATE_SUB", "category": "date", "description": "Subtract days from date",
|
|
7
|
+
"dialects": {"hive": "DATE_SUB(date, n)", "mysql": "DATE_SUB(date, INTERVAL n DAY)", "oracle": "date - n", "tsql": "DATEADD(day, -n, date)", "postgres": "date - INTERVAL 'n days'", "spark": "DATE_SUB(date, n)", "trino": "DATE_ADD('day', -n, date)", "snowflake": "DATEADD(day, -n, date)", "redshift": "DATEADD(day, -n, date)", "clickhouse": "subtractDays(date, n)", "duckdb": "date - INTERVAL n DAY", "databricks": "DATE_SUB(date, n)"}},
|
|
8
|
+
{"name": "CONCAT", "category": "string", "description": "Concatenate strings",
|
|
9
|
+
"dialects": {"hive": "CONCAT(s1, s2, ...)", "mysql": "CONCAT(s1, s2, ...)", "oracle": "s1 || s2 or CONCAT(s1, s2)", "tsql": "CONCAT(s1, s2, ...) or s1 + s2", "postgres": "CONCAT(s1, s2, ...) or s1 || s2", "spark": "CONCAT(s1, s2, ...)", "trino": "CONCAT(s1, s2, ...)", "snowflake": "CONCAT(s1, s2, ...)", "redshift": "CONCAT(s1, s2, ...)", "clickhouse": "concat(s1, s2, ...)", "duckdb": "CONCAT(s1, s2, ...)", "databricks": "CONCAT(s1, s2, ...)"}},
|
|
10
|
+
{"name": "SUBSTRING", "category": "string", "description": "Extract substring",
|
|
11
|
+
"dialects": {"hive": "SUBSTRING(str, pos, len)", "mysql": "SUBSTRING(str, pos, len)", "oracle": "SUBSTR(str, pos, len)", "tsql": "SUBSTRING(str, pos, len)", "postgres": "SUBSTRING(str FROM pos FOR len)", "spark": "SUBSTRING(str, pos, len)", "trino": "SUBSTR(str, pos, len)", "snowflake": "SUBSTR(str, pos, len)", "redshift": "SUBSTRING(str, pos, len)", "clickhouse": "substring(str, pos, len)", "duckdb": "SUBSTRING(str, pos, len)", "databricks": "SUBSTRING(str, pos, len)"}},
|
|
12
|
+
{"name": "EXPLODE", "category": "array", "description": "Expand array to rows",
|
|
13
|
+
"dialects": {"hive": "LATERAL VIEW EXPLODE(arr) t AS col", "mysql": "JSON_TABLE(arr, '$[*]' COLUMNS(...))", "oracle": "JSON_TABLE(...)", "tsql": "OPENJSON(arr)", "postgres": "UNNEST(arr)", "spark": "LATERAL VIEW EXPLODE(arr)", "trino": "CROSS JOIN UNNEST(arr)", "snowflake": "LATERAL FLATTEN(arr)", "redshift": "FROM arr AS t", "clickhouse": "ARRAY JOIN arr", "duckdb": "UNNEST(arr)", "databricks": "LATERAL VIEW EXPLODE(arr)"}},
|
|
14
|
+
{"name": "COLLECT_LIST", "category": "aggregate", "description": "Aggregate values into array",
|
|
15
|
+
"dialects": {"hive": "COLLECT_LIST(col)", "mysql": "JSON_ARRAYAGG(col)", "oracle": "LISTAGG(col, ',') or JSON_ARRAYAGG(col)", "tsql": "STRING_AGG(col, ',') (no native array)", "postgres": "ARRAY_AGG(col)", "spark": "COLLECT_LIST(col)", "trino": "ARRAY_AGG(col)", "snowflake": "ARRAY_AGG(col)", "redshift": "LISTAGG(col, ',')", "clickhouse": "groupArray(col)", "duckdb": "LIST(col)", "databricks": "COLLECT_LIST(col)"}},
|
|
16
|
+
{"name": "GET_JSON_OBJECT", "category": "json", "description": "Extract JSON field",
|
|
17
|
+
"dialects": {"hive": "GET_JSON_OBJECT(json, '$.path')", "mysql": "JSON_EXTRACT(json, '$.path')", "oracle": "JSON_VALUE(json, '$.path')", "tsql": "JSON_VALUE(json, '$.path')", "postgres": "json->>'path' or json_extract_path_text()", "spark": "GET_JSON_OBJECT(json, '$.path')", "trino": "JSON_EXTRACT_SCALAR(json, '$.path')", "snowflake": "GET_PATH(PARSE_JSON(json), 'path')", "redshift": "JSON_EXTRACT_PATH_TEXT(json, 'path')", "clickhouse": "JSONExtractString(json, 'path')", "duckdb": "json->>'$.path'", "databricks": "GET_JSON_OBJECT(json, '$.path')"}},
|
|
18
|
+
{"name": "ROW_NUMBER", "category": "window", "description": "Assign sequential row numbers",
|
|
19
|
+
"dialects": {"hive": "ROW_NUMBER() OVER(...)", "mysql": "ROW_NUMBER() OVER(...)", "oracle": "ROW_NUMBER() OVER(...)", "tsql": "ROW_NUMBER() OVER(...)", "postgres": "ROW_NUMBER() OVER(...)", "spark": "ROW_NUMBER() OVER(...)", "trino": "ROW_NUMBER() OVER(...)", "snowflake": "ROW_NUMBER() OVER(...)", "redshift": "ROW_NUMBER() OVER(...)", "clickhouse": "ROW_NUMBER() OVER(...)", "duckdb": "ROW_NUMBER() OVER(...)", "databricks": "ROW_NUMBER() OVER(...)"}},
|
|
20
|
+
{"name": "DATEDIFF", "category": "date", "description": "Days between two dates",
|
|
21
|
+
"dialects": {"hive": "DATEDIFF(end, start)", "mysql": "DATEDIFF(end, start)", "oracle": "end_date - start_date", "tsql": "DATEDIFF(day, start, end)", "postgres": "end_date - start_date", "spark": "DATEDIFF(end, start)", "trino": "DATE_DIFF('day', start, end)", "snowflake": "DATEDIFF(day, start, end)", "redshift": "DATEDIFF(day, start, end)", "clickhouse": "dateDiff('day', start, end)", "duckdb": "DATE_DIFF('day', start, end)", "databricks": "DATEDIFF(end, start)"}},
|
|
22
|
+
{"name": "DATE_FORMAT", "category": "date", "description": "Format date to string",
|
|
23
|
+
"dialects": {"hive": "DATE_FORMAT(date, 'yyyy-MM-dd')", "mysql": "DATE_FORMAT(date, '%Y-%m-%d')", "oracle": "TO_CHAR(date, 'YYYY-MM-DD')", "tsql": "FORMAT(date, 'yyyy-MM-dd')", "postgres": "TO_CHAR(date, 'YYYY-MM-DD')", "spark": "DATE_FORMAT(date, 'yyyy-MM-dd')", "trino": "DATE_FORMAT(date, '%Y-%m-%d')", "snowflake": "TO_CHAR(date, 'YYYY-MM-DD')", "redshift": "TO_CHAR(date, 'YYYY-MM-DD')", "clickhouse": "formatDateTime(date, '%Y-%m-%d')", "duckdb": "STRFTIME(date, '%Y-%m-%d')", "databricks": "DATE_FORMAT(date, 'yyyy-MM-dd')"}},
|
|
24
|
+
{"name": "CURRENT_DATE", "category": "date", "description": "Get current date",
|
|
25
|
+
"dialects": {"hive": "CURRENT_DATE", "mysql": "CURDATE() or CURRENT_DATE", "oracle": "SYSDATE or CURRENT_DATE", "tsql": "GETDATE() or CAST(GETDATE() AS DATE)", "postgres": "CURRENT_DATE", "spark": "CURRENT_DATE()", "trino": "CURRENT_DATE", "snowflake": "CURRENT_DATE()", "redshift": "CURRENT_DATE", "clickhouse": "today()", "duckdb": "CURRENT_DATE", "databricks": "CURRENT_DATE()"}},
|
|
26
|
+
{"name": "CURRENT_TIMESTAMP", "category": "date", "description": "Get current timestamp",
|
|
27
|
+
"dialects": {"hive": "CURRENT_TIMESTAMP", "mysql": "NOW() or CURRENT_TIMESTAMP", "oracle": "SYSTIMESTAMP or CURRENT_TIMESTAMP", "tsql": "GETDATE() or SYSDATETIME()", "postgres": "CURRENT_TIMESTAMP or NOW()", "spark": "CURRENT_TIMESTAMP()", "trino": "CURRENT_TIMESTAMP", "snowflake": "CURRENT_TIMESTAMP()", "redshift": "GETDATE() or CURRENT_TIMESTAMP", "clickhouse": "now()", "duckdb": "CURRENT_TIMESTAMP", "databricks": "CURRENT_TIMESTAMP()"}},
|
|
28
|
+
{"name": "YEAR", "category": "date", "description": "Extract year from date",
|
|
29
|
+
"dialects": {"hive": "YEAR(date)", "mysql": "YEAR(date)", "oracle": "EXTRACT(YEAR FROM date)", "tsql": "YEAR(date) or DATEPART(year, date)", "postgres": "EXTRACT(YEAR FROM date)", "spark": "YEAR(date)", "trino": "YEAR(date)", "snowflake": "YEAR(date)", "redshift": "EXTRACT(YEAR FROM date)", "clickhouse": "toYear(date)", "duckdb": "YEAR(date)", "databricks": "YEAR(date)"}},
|
|
30
|
+
{"name": "MONTH", "category": "date", "description": "Extract month from date",
|
|
31
|
+
"dialects": {"hive": "MONTH(date)", "mysql": "MONTH(date)", "oracle": "EXTRACT(MONTH FROM date)", "tsql": "MONTH(date)", "postgres": "EXTRACT(MONTH FROM date)", "spark": "MONTH(date)", "trino": "MONTH(date)", "snowflake": "MONTH(date)", "redshift": "EXTRACT(MONTH FROM date)", "clickhouse": "toMonth(date)", "duckdb": "MONTH(date)", "databricks": "MONTH(date)"}},
|
|
32
|
+
{"name": "DAY", "category": "date", "description": "Extract day from date",
|
|
33
|
+
"dialects": {"hive": "DAY(date)", "mysql": "DAY(date)", "oracle": "EXTRACT(DAY FROM date)", "tsql": "DAY(date)", "postgres": "EXTRACT(DAY FROM date)", "spark": "DAY(date)", "trino": "DAY(date)", "snowflake": "DAY(date)", "redshift": "EXTRACT(DAY FROM date)", "clickhouse": "toDayOfMonth(date)", "duckdb": "DAY(date)", "databricks": "DAY(date)"}},
|
|
34
|
+
{"name": "LENGTH", "category": "string", "description": "Get string length",
|
|
35
|
+
"dialects": {"hive": "LENGTH(str)", "mysql": "LENGTH(str) or CHAR_LENGTH(str)", "oracle": "LENGTH(str)", "tsql": "LEN(str)", "postgres": "LENGTH(str) or CHAR_LENGTH(str)", "spark": "LENGTH(str)", "trino": "LENGTH(str)", "snowflake": "LENGTH(str)", "redshift": "LEN(str)", "clickhouse": "length(str)", "duckdb": "LENGTH(str)", "databricks": "LENGTH(str)"}},
|
|
36
|
+
{"name": "UPPER", "category": "string", "description": "Convert to uppercase",
|
|
37
|
+
"dialects": {"hive": "UPPER(str)", "mysql": "UPPER(str)", "oracle": "UPPER(str)", "tsql": "UPPER(str)", "postgres": "UPPER(str)", "spark": "UPPER(str)", "trino": "UPPER(str)", "snowflake": "UPPER(str)", "redshift": "UPPER(str)", "clickhouse": "upper(str)", "duckdb": "UPPER(str)", "databricks": "UPPER(str)"}},
|
|
38
|
+
{"name": "LOWER", "category": "string", "description": "Convert to lowercase",
|
|
39
|
+
"dialects": {"hive": "LOWER(str)", "mysql": "LOWER(str)", "oracle": "LOWER(str)", "tsql": "LOWER(str)", "postgres": "LOWER(str)", "spark": "LOWER(str)", "trino": "LOWER(str)", "snowflake": "LOWER(str)", "redshift": "LOWER(str)", "clickhouse": "lower(str)", "duckdb": "LOWER(str)", "databricks": "LOWER(str)"}},
|
|
40
|
+
{"name": "TRIM", "category": "string", "description": "Remove leading/trailing spaces",
|
|
41
|
+
"dialects": {"hive": "TRIM(str)", "mysql": "TRIM(str)", "oracle": "TRIM(str)", "tsql": "LTRIM(RTRIM(str))", "postgres": "TRIM(str)", "spark": "TRIM(str)", "trino": "TRIM(str)", "snowflake": "TRIM(str)", "redshift": "TRIM(str)", "clickhouse": "trim(str)", "duckdb": "TRIM(str)", "databricks": "TRIM(str)"}},
|
|
42
|
+
{"name": "REPLACE", "category": "string", "description": "Replace substring",
|
|
43
|
+
"dialects": {"hive": "REPLACE(str, old, new)", "mysql": "REPLACE(str, old, new)", "oracle": "REPLACE(str, old, new)", "tsql": "REPLACE(str, old, new)", "postgres": "REPLACE(str, old, new)", "spark": "REPLACE(str, old, new)", "trino": "REPLACE(str, old, new)", "snowflake": "REPLACE(str, old, new)", "redshift": "REPLACE(str, old, new)", "clickhouse": "replaceAll(str, old, new)", "duckdb": "REPLACE(str, old, new)", "databricks": "REPLACE(str, old, new)"}},
|
|
44
|
+
{"name": "SPLIT", "category": "string", "description": "Split string into array",
|
|
45
|
+
"dialects": {"hive": "SPLIT(str, delim)", "mysql": "N/A (use SUBSTRING_INDEX)", "oracle": "N/A (use REGEXP_SUBSTR)", "tsql": "STRING_SPLIT(str, delim)", "postgres": "STRING_TO_ARRAY(str, delim)", "spark": "SPLIT(str, delim)", "trino": "SPLIT(str, delim)", "snowflake": "SPLIT(str, delim)", "redshift": "SPLIT_PART(str, delim, n)", "clickhouse": "splitByString(delim, str)", "duckdb": "STRING_SPLIT(str, delim)", "databricks": "SPLIT(str, delim)"}},
|
|
46
|
+
{"name": "REGEXP_REPLACE", "category": "string", "description": "Replace using regex",
|
|
47
|
+
"dialects": {"hive": "REGEXP_REPLACE(str, pattern, repl)", "mysql": "REGEXP_REPLACE(str, pattern, repl)", "oracle": "REGEXP_REPLACE(str, pattern, repl)", "tsql": "N/A (use CLR or LIKE)", "postgres": "REGEXP_REPLACE(str, pattern, repl)", "spark": "REGEXP_REPLACE(str, pattern, repl)", "trino": "REGEXP_REPLACE(str, pattern, repl)", "snowflake": "REGEXP_REPLACE(str, pattern, repl)", "redshift": "REGEXP_REPLACE(str, pattern, repl)", "clickhouse": "replaceRegexpAll(str, pattern, repl)", "duckdb": "REGEXP_REPLACE(str, pattern, repl)", "databricks": "REGEXP_REPLACE(str, pattern, repl)"}},
|
|
48
|
+
{"name": "INSTR", "category": "string", "description": "Find position of substring",
|
|
49
|
+
"dialects": {"hive": "INSTR(str, substr)", "mysql": "INSTR(str, substr) or LOCATE(substr, str)", "oracle": "INSTR(str, substr)", "tsql": "CHARINDEX(substr, str)", "postgres": "POSITION(substr IN str)", "spark": "INSTR(str, substr)", "trino": "STRPOS(str, substr)", "snowflake": "POSITION(substr IN str)", "redshift": "POSITION(substr IN str)", "clickhouse": "position(str, substr)", "duckdb": "INSTR(str, substr)", "databricks": "INSTR(str, substr)"}},
|
|
50
|
+
{"name": "COALESCE", "category": "conditional", "description": "Return first non-null value",
|
|
51
|
+
"dialects": {"hive": "COALESCE(v1, v2, ...)", "mysql": "COALESCE(v1, v2, ...) or IFNULL(v1, v2)", "oracle": "COALESCE(v1, v2, ...) or NVL(v1, v2)", "tsql": "COALESCE(v1, v2, ...) or ISNULL(v1, v2)", "postgres": "COALESCE(v1, v2, ...)", "spark": "COALESCE(v1, v2, ...)", "trino": "COALESCE(v1, v2, ...)", "snowflake": "COALESCE(v1, v2, ...) or NVL(v1, v2)", "redshift": "COALESCE(v1, v2, ...) or NVL(v1, v2)", "clickhouse": "coalesce(v1, v2, ...)", "duckdb": "COALESCE(v1, v2, ...)", "databricks": "COALESCE(v1, v2, ...)"}},
|
|
52
|
+
{"name": "NVL", "category": "conditional", "description": "Replace null with default",
|
|
53
|
+
"dialects": {"hive": "NVL(val, default) or COALESCE", "mysql": "IFNULL(val, default)", "oracle": "NVL(val, default)", "tsql": "ISNULL(val, default)", "postgres": "COALESCE(val, default)", "spark": "NVL(val, default)", "trino": "COALESCE(val, default)", "snowflake": "NVL(val, default)", "redshift": "NVL(val, default)", "clickhouse": "ifNull(val, default)", "duckdb": "COALESCE(val, default)", "databricks": "NVL(val, default)"}},
|
|
54
|
+
{"name": "CASE", "category": "conditional", "description": "Conditional expression",
|
|
55
|
+
"dialects": {"hive": "CASE WHEN cond THEN val ELSE default END", "mysql": "CASE WHEN cond THEN val ELSE default END", "oracle": "CASE WHEN cond THEN val ELSE default END", "tsql": "CASE WHEN cond THEN val ELSE default END", "postgres": "CASE WHEN cond THEN val ELSE default END", "spark": "CASE WHEN cond THEN val ELSE default END", "trino": "CASE WHEN cond THEN val ELSE default END", "snowflake": "CASE WHEN cond THEN val ELSE default END", "redshift": "CASE WHEN cond THEN val ELSE default END", "clickhouse": "CASE WHEN cond THEN val ELSE default END", "duckdb": "CASE WHEN cond THEN val ELSE default END", "databricks": "CASE WHEN cond THEN val ELSE default END"}},
|
|
56
|
+
{"name": "IF", "category": "conditional", "description": "Simple if-then-else",
|
|
57
|
+
"dialects": {"hive": "IF(cond, true_val, false_val)", "mysql": "IF(cond, true_val, false_val)", "oracle": "CASE WHEN cond THEN true_val ELSE false_val END", "tsql": "IIF(cond, true_val, false_val)", "postgres": "CASE WHEN cond THEN true_val ELSE false_val END", "spark": "IF(cond, true_val, false_val)", "trino": "IF(cond, true_val, false_val)", "snowflake": "IFF(cond, true_val, false_val)", "redshift": "CASE WHEN cond THEN true_val ELSE false_val END", "clickhouse": "if(cond, true_val, false_val)", "duckdb": "IF(cond, true_val, false_val)", "databricks": "IF(cond, true_val, false_val)"}},
|
|
58
|
+
{"name": "RANK", "category": "window", "description": "Assign rank with gaps",
|
|
59
|
+
"dialects": {"hive": "RANK() OVER(...)", "mysql": "RANK() OVER(...)", "oracle": "RANK() OVER(...)", "tsql": "RANK() OVER(...)", "postgres": "RANK() OVER(...)", "spark": "RANK() OVER(...)", "trino": "RANK() OVER(...)", "snowflake": "RANK() OVER(...)", "redshift": "RANK() OVER(...)", "clickhouse": "RANK() OVER(...)", "duckdb": "RANK() OVER(...)", "databricks": "RANK() OVER(...)"}},
|
|
60
|
+
{"name": "DENSE_RANK", "category": "window", "description": "Assign rank without gaps",
|
|
61
|
+
"dialects": {"hive": "DENSE_RANK() OVER(...)", "mysql": "DENSE_RANK() OVER(...)", "oracle": "DENSE_RANK() OVER(...)", "tsql": "DENSE_RANK() OVER(...)", "postgres": "DENSE_RANK() OVER(...)", "spark": "DENSE_RANK() OVER(...)", "trino": "DENSE_RANK() OVER(...)", "snowflake": "DENSE_RANK() OVER(...)", "redshift": "DENSE_RANK() OVER(...)", "clickhouse": "DENSE_RANK() OVER(...)", "duckdb": "DENSE_RANK() OVER(...)", "databricks": "DENSE_RANK() OVER(...)"}},
|
|
62
|
+
{"name": "LAG", "category": "window", "description": "Access previous row value",
|
|
63
|
+
"dialects": {"hive": "LAG(col, n, default) OVER(...)", "mysql": "LAG(col, n, default) OVER(...)", "oracle": "LAG(col, n, default) OVER(...)", "tsql": "LAG(col, n, default) OVER(...)", "postgres": "LAG(col, n, default) OVER(...)", "spark": "LAG(col, n, default) OVER(...)", "trino": "LAG(col, n, default) OVER(...)", "snowflake": "LAG(col, n, default) OVER(...)", "redshift": "LAG(col, n, default) OVER(...)", "clickhouse": "lagInFrame(col, n, default) OVER(...)", "duckdb": "LAG(col, n, default) OVER(...)", "databricks": "LAG(col, n, default) OVER(...)"}},
|
|
64
|
+
{"name": "LEAD", "category": "window", "description": "Access next row value",
|
|
65
|
+
"dialects": {"hive": "LEAD(col, n, default) OVER(...)", "mysql": "LEAD(col, n, default) OVER(...)", "oracle": "LEAD(col, n, default) OVER(...)", "tsql": "LEAD(col, n, default) OVER(...)", "postgres": "LEAD(col, n, default) OVER(...)", "spark": "LEAD(col, n, default) OVER(...)", "trino": "LEAD(col, n, default) OVER(...)", "snowflake": "LEAD(col, n, default) OVER(...)", "redshift": "LEAD(col, n, default) OVER(...)", "clickhouse": "leadInFrame(col, n, default) OVER(...)", "duckdb": "LEAD(col, n, default) OVER(...)", "databricks": "LEAD(col, n, default) OVER(...)"}},
|
|
66
|
+
{"name": "FIRST_VALUE", "category": "window", "description": "Get first value in window",
|
|
67
|
+
"dialects": {"hive": "FIRST_VALUE(col) OVER(...)", "mysql": "FIRST_VALUE(col) OVER(...)", "oracle": "FIRST_VALUE(col) OVER(...)", "tsql": "FIRST_VALUE(col) OVER(...)", "postgres": "FIRST_VALUE(col) OVER(...)", "spark": "FIRST_VALUE(col) OVER(...)", "trino": "FIRST_VALUE(col) OVER(...)", "snowflake": "FIRST_VALUE(col) OVER(...)", "redshift": "FIRST_VALUE(col) OVER(...)", "clickhouse": "first_value(col) OVER(...)", "duckdb": "FIRST_VALUE(col) OVER(...)", "databricks": "FIRST_VALUE(col) OVER(...)"}},
|
|
68
|
+
{"name": "LAST_VALUE", "category": "window", "description": "Get last value in window",
|
|
69
|
+
"dialects": {"hive": "LAST_VALUE(col) OVER(...)", "mysql": "LAST_VALUE(col) OVER(...)", "oracle": "LAST_VALUE(col) OVER(...)", "tsql": "LAST_VALUE(col) OVER(...)", "postgres": "LAST_VALUE(col) OVER(...)", "spark": "LAST_VALUE(col) OVER(...)", "trino": "LAST_VALUE(col) OVER(...)", "snowflake": "LAST_VALUE(col) OVER(...)", "redshift": "LAST_VALUE(col) OVER(...)", "clickhouse": "last_value(col) OVER(...)", "duckdb": "LAST_VALUE(col) OVER(...)", "databricks": "LAST_VALUE(col) OVER(...)"}},
|
|
70
|
+
{"name": "SUM", "category": "aggregate", "description": "Sum of values",
|
|
71
|
+
"dialects": {"hive": "SUM(col)", "mysql": "SUM(col)", "oracle": "SUM(col)", "tsql": "SUM(col)", "postgres": "SUM(col)", "spark": "SUM(col)", "trino": "SUM(col)", "snowflake": "SUM(col)", "redshift": "SUM(col)", "clickhouse": "sum(col)", "duckdb": "SUM(col)", "databricks": "SUM(col)"}},
|
|
72
|
+
{"name": "COUNT", "category": "aggregate", "description": "Count of rows",
|
|
73
|
+
"dialects": {"hive": "COUNT(*) or COUNT(col)", "mysql": "COUNT(*) or COUNT(col)", "oracle": "COUNT(*) or COUNT(col)", "tsql": "COUNT(*) or COUNT(col)", "postgres": "COUNT(*) or COUNT(col)", "spark": "COUNT(*) or COUNT(col)", "trino": "COUNT(*) or COUNT(col)", "snowflake": "COUNT(*) or COUNT(col)", "redshift": "COUNT(*) or COUNT(col)", "clickhouse": "count() or count(col)", "duckdb": "COUNT(*) or COUNT(col)", "databricks": "COUNT(*) or COUNT(col)"}},
|
|
74
|
+
{"name": "AVG", "category": "aggregate", "description": "Average of values",
|
|
75
|
+
"dialects": {"hive": "AVG(col)", "mysql": "AVG(col)", "oracle": "AVG(col)", "tsql": "AVG(col)", "postgres": "AVG(col)", "spark": "AVG(col)", "trino": "AVG(col)", "snowflake": "AVG(col)", "redshift": "AVG(col)", "clickhouse": "avg(col)", "duckdb": "AVG(col)", "databricks": "AVG(col)"}},
|
|
76
|
+
{"name": "MAX", "category": "aggregate", "description": "Maximum value",
|
|
77
|
+
"dialects": {"hive": "MAX(col)", "mysql": "MAX(col)", "oracle": "MAX(col)", "tsql": "MAX(col)", "postgres": "MAX(col)", "spark": "MAX(col)", "trino": "MAX(col)", "snowflake": "MAX(col)", "redshift": "MAX(col)", "clickhouse": "max(col)", "duckdb": "MAX(col)", "databricks": "MAX(col)"}},
|
|
78
|
+
{"name": "MIN", "category": "aggregate", "description": "Minimum value",
|
|
79
|
+
"dialects": {"hive": "MIN(col)", "mysql": "MIN(col)", "oracle": "MIN(col)", "tsql": "MIN(col)", "postgres": "MIN(col)", "spark": "MIN(col)", "trino": "MIN(col)", "snowflake": "MIN(col)", "redshift": "MIN(col)", "clickhouse": "min(col)", "duckdb": "MIN(col)", "databricks": "MIN(col)"}},
|
|
80
|
+
{"name": "LISTAGG", "category": "aggregate", "description": "Concatenate values into string",
|
|
81
|
+
"dialects": {"hive": "CONCAT_WS(',', COLLECT_LIST(col))", "mysql": "GROUP_CONCAT(col SEPARATOR ',')", "oracle": "LISTAGG(col, ',') WITHIN GROUP (ORDER BY col)", "tsql": "STRING_AGG(col, ',')", "postgres": "STRING_AGG(col, ',')", "spark": "CONCAT_WS(',', COLLECT_LIST(col))", "trino": "LISTAGG(col, ',') or ARRAY_JOIN(ARRAY_AGG(col), ',')", "snowflake": "LISTAGG(col, ',')", "redshift": "LISTAGG(col, ',')", "clickhouse": "groupConcat(col)", "duckdb": "STRING_AGG(col, ',')", "databricks": "CONCAT_WS(',', COLLECT_LIST(col))"}},
|
|
82
|
+
{"name": "STRING_AGG", "category": "aggregate", "description": "Aggregate strings with separator",
|
|
83
|
+
"dialects": {"hive": "CONCAT_WS(sep, COLLECT_LIST(col))", "mysql": "GROUP_CONCAT(col SEPARATOR sep)", "oracle": "LISTAGG(col, sep) WITHIN GROUP (ORDER BY col)", "tsql": "STRING_AGG(col, sep)", "postgres": "STRING_AGG(col, sep)", "spark": "CONCAT_WS(sep, COLLECT_LIST(col))", "trino": "ARRAY_JOIN(ARRAY_AGG(col), sep)", "snowflake": "LISTAGG(col, sep)", "redshift": "LISTAGG(col, sep)", "clickhouse": "groupConcat(col)", "duckdb": "STRING_AGG(col, sep)", "databricks": "CONCAT_WS(sep, COLLECT_LIST(col))"}},
|
|
84
|
+
{"name": "GROUP_CONCAT", "category": "aggregate", "description": "MySQL-style string aggregation",
|
|
85
|
+
"dialects": {"hive": "CONCAT_WS(',', COLLECT_LIST(col))", "mysql": "GROUP_CONCAT(col)", "oracle": "LISTAGG(col, ',')", "tsql": "STRING_AGG(col, ',')", "postgres": "STRING_AGG(col::text, ',')", "spark": "CONCAT_WS(',', COLLECT_LIST(col))", "trino": "ARRAY_JOIN(ARRAY_AGG(col), ',')", "snowflake": "LISTAGG(col, ',')", "redshift": "LISTAGG(col, ',')", "clickhouse": "groupConcat(col)", "duckdb": "STRING_AGG(col, ',')", "databricks": "CONCAT_WS(',', COLLECT_LIST(col))"}},
|
|
86
|
+
{"name": "JSON_EXTRACT", "category": "json", "description": "Extract value from JSON",
|
|
87
|
+
"dialects": {"hive": "GET_JSON_OBJECT(json, '$.path')", "mysql": "JSON_EXTRACT(json, '$.path')", "oracle": "JSON_VALUE(json, '$.path')", "tsql": "JSON_VALUE(json, '$.path')", "postgres": "json_extract_path(json, 'path')", "spark": "GET_JSON_OBJECT(json, '$.path')", "trino": "JSON_EXTRACT(json, '$.path')", "snowflake": "JSON_EXTRACT_PATH_TEXT(json, 'path')", "redshift": "JSON_EXTRACT_PATH_TEXT(json, 'path')", "clickhouse": "JSONExtract(json, 'path', 'String')", "duckdb": "json_extract(json, '$.path')", "databricks": "GET_JSON_OBJECT(json, '$.path')"}},
|
|
88
|
+
{"name": "JSON_ARRAY", "category": "json", "description": "Create JSON array",
|
|
89
|
+
"dialects": {"hive": "N/A (use named_struct + to_json)", "mysql": "JSON_ARRAY(v1, v2, ...)", "oracle": "JSON_ARRAY(v1, v2, ...)", "tsql": "JSON_ARRAY(v1, v2, ...)", "postgres": "JSON_BUILD_ARRAY(v1, v2, ...)", "spark": "TO_JSON(ARRAY(v1, v2, ...))", "trino": "JSON_ARRAY(v1, v2, ...)", "snowflake": "ARRAY_CONSTRUCT(v1, v2, ...)", "redshift": "JSON_PARSE('[v1, v2]')", "clickhouse": "JSONExtract('[v1,v2]', 'Array(String)')", "duckdb": "JSON_ARRAY(v1, v2, ...)", "databricks": "TO_JSON(ARRAY(v1, v2, ...))"}},
|
|
90
|
+
{"name": "ARRAY_CONTAINS", "category": "array", "description": "Check if array contains value",
|
|
91
|
+
"dialects": {"hive": "ARRAY_CONTAINS(arr, val)", "mysql": "JSON_CONTAINS(arr, val)", "oracle": "N/A (use JSON_EXISTS)", "tsql": "N/A (use OPENJSON)", "postgres": "val = ANY(arr)", "spark": "ARRAY_CONTAINS(arr, val)", "trino": "CONTAINS(arr, val)", "snowflake": "ARRAY_CONTAINS(val, arr)", "redshift": "N/A", "clickhouse": "has(arr, val)", "duckdb": "ARRAY_CONTAINS(arr, val)", "databricks": "ARRAY_CONTAINS(arr, val)"}},
|
|
92
|
+
{"name": "SIZE", "category": "array", "description": "Get array/map size",
|
|
93
|
+
"dialects": {"hive": "SIZE(arr)", "mysql": "JSON_LENGTH(arr)", "oracle": "JSON_QUERY(arr, '$.size()')", "tsql": "N/A", "postgres": "ARRAY_LENGTH(arr, 1) or CARDINALITY(arr)", "spark": "SIZE(arr)", "trino": "CARDINALITY(arr)", "snowflake": "ARRAY_SIZE(arr)", "redshift": "JSON_ARRAY_LENGTH(arr)", "clickhouse": "length(arr)", "duckdb": "LEN(arr)", "databricks": "SIZE(arr)"}},
|
|
94
|
+
{"name": "NTILE", "category": "window", "description": "Divide rows into n buckets",
|
|
95
|
+
"dialects": {"hive": "NTILE(n) OVER(...)", "mysql": "NTILE(n) OVER(...)", "oracle": "NTILE(n) OVER(...)", "tsql": "NTILE(n) OVER(...)", "postgres": "NTILE(n) OVER(...)", "spark": "NTILE(n) OVER(...)", "trino": "NTILE(n) OVER(...)", "snowflake": "NTILE(n) OVER(...)", "redshift": "NTILE(n) OVER(...)", "clickhouse": "NTILE(n) OVER(...)", "duckdb": "NTILE(n) OVER(...)", "databricks": "NTILE(n) OVER(...)"}},
|
|
96
|
+
{"name": "PERCENT_RANK", "category": "window", "description": "Relative rank as percentage",
|
|
97
|
+
"dialects": {"hive": "PERCENT_RANK() OVER(...)", "mysql": "PERCENT_RANK() OVER(...)", "oracle": "PERCENT_RANK() OVER(...)", "tsql": "PERCENT_RANK() OVER(...)", "postgres": "PERCENT_RANK() OVER(...)", "spark": "PERCENT_RANK() OVER(...)", "trino": "PERCENT_RANK() OVER(...)", "snowflake": "PERCENT_RANK() OVER(...)", "redshift": "PERCENT_RANK() OVER(...)", "clickhouse": "N/A", "duckdb": "PERCENT_RANK() OVER(...)", "databricks": "PERCENT_RANK() OVER(...)"}},
|
|
98
|
+
{"name": "CAST", "category": "conversion", "description": "Convert data type",
|
|
99
|
+
"dialects": {"hive": "CAST(val AS type)", "mysql": "CAST(val AS type)", "oracle": "CAST(val AS type) or TO_NUMBER/TO_CHAR", "tsql": "CAST(val AS type) or CONVERT(type, val)", "postgres": "CAST(val AS type) or val::type", "spark": "CAST(val AS type)", "trino": "CAST(val AS type)", "snowflake": "CAST(val AS type) or val::type", "redshift": "CAST(val AS type)", "clickhouse": "CAST(val AS type) or toInt32(val)", "duckdb": "CAST(val AS type)", "databricks": "CAST(val AS type)"}},
|
|
100
|
+
{"name": "TO_DATE", "category": "date", "description": "Convert string to date",
|
|
101
|
+
"dialects": {"hive": "TO_DATE(str)", "mysql": "STR_TO_DATE(str, format)", "oracle": "TO_DATE(str, 'YYYY-MM-DD')", "tsql": "CAST(str AS DATE) or CONVERT(DATE, str)", "postgres": "TO_DATE(str, 'YYYY-MM-DD')", "spark": "TO_DATE(str, format)", "trino": "DATE(str) or CAST(str AS DATE)", "snowflake": "TO_DATE(str, format)", "redshift": "TO_DATE(str, format)", "clickhouse": "toDate(str)", "duckdb": "CAST(str AS DATE)", "databricks": "TO_DATE(str, format)"}},
|
|
102
|
+
{"name": "TO_TIMESTAMP", "category": "date", "description": "Convert string to timestamp",
|
|
103
|
+
"dialects": {"hive": "TO_TIMESTAMP(str, format)", "mysql": "STR_TO_DATE(str, format)", "oracle": "TO_TIMESTAMP(str, 'YYYY-MM-DD HH24:MI:SS')", "tsql": "CAST(str AS DATETIME2)", "postgres": "TO_TIMESTAMP(str, 'YYYY-MM-DD HH24:MI:SS')", "spark": "TO_TIMESTAMP(str, format)", "trino": "CAST(str AS TIMESTAMP)", "snowflake": "TO_TIMESTAMP(str, format)", "redshift": "TO_TIMESTAMP(str, format)", "clickhouse": "toDateTime(str)", "duckdb": "CAST(str AS TIMESTAMP)", "databricks": "TO_TIMESTAMP(str, format)"}},
|
|
104
|
+
{"name": "UNIX_TIMESTAMP", "category": "date", "description": "Convert to Unix epoch seconds",
|
|
105
|
+
"dialects": {"hive": "UNIX_TIMESTAMP(ts)", "mysql": "UNIX_TIMESTAMP(ts)", "oracle": "(ts - DATE '1970-01-01') * 86400", "tsql": "DATEDIFF(SECOND, '1970-01-01', ts)", "postgres": "EXTRACT(EPOCH FROM ts)", "spark": "UNIX_TIMESTAMP(ts)", "trino": "TO_UNIXTIME(ts)", "snowflake": "DATE_PART(EPOCH_SECOND, ts)", "redshift": "EXTRACT(EPOCH FROM ts)", "clickhouse": "toUnixTimestamp(ts)", "duckdb": "EPOCH(ts)", "databricks": "UNIX_TIMESTAMP(ts)"}},
|
|
106
|
+
{"name": "FROM_UNIXTIME", "category": "date", "description": "Convert Unix epoch to timestamp",
|
|
107
|
+
"dialects": {"hive": "FROM_UNIXTIME(epoch)", "mysql": "FROM_UNIXTIME(epoch)", "oracle": "DATE '1970-01-01' + epoch/86400", "tsql": "DATEADD(SECOND, epoch, '1970-01-01')", "postgres": "TO_TIMESTAMP(epoch)", "spark": "FROM_UNIXTIME(epoch)", "trino": "FROM_UNIXTIME(epoch)", "snowflake": "TO_TIMESTAMP(epoch)", "redshift": "TIMESTAMP 'epoch' + epoch * INTERVAL '1 second'", "clickhouse": "toDateTime(epoch)", "duckdb": "TO_TIMESTAMP(epoch)", "databricks": "FROM_UNIXTIME(epoch)"}},
|
|
108
|
+
{"name": "ABS", "category": "math", "description": "Absolute value",
|
|
109
|
+
"dialects": {"hive": "ABS(n)", "mysql": "ABS(n)", "oracle": "ABS(n)", "tsql": "ABS(n)", "postgres": "ABS(n)", "spark": "ABS(n)", "trino": "ABS(n)", "snowflake": "ABS(n)", "redshift": "ABS(n)", "clickhouse": "abs(n)", "duckdb": "ABS(n)", "databricks": "ABS(n)"}},
|
|
110
|
+
{"name": "ROUND", "category": "math", "description": "Round to decimal places",
|
|
111
|
+
"dialects": {"hive": "ROUND(n, d)", "mysql": "ROUND(n, d)", "oracle": "ROUND(n, d)", "tsql": "ROUND(n, d)", "postgres": "ROUND(n, d)", "spark": "ROUND(n, d)", "trino": "ROUND(n, d)", "snowflake": "ROUND(n, d)", "redshift": "ROUND(n, d)", "clickhouse": "round(n, d)", "duckdb": "ROUND(n, d)", "databricks": "ROUND(n, d)"}},
|
|
112
|
+
{"name": "FLOOR", "category": "math", "description": "Round down to integer",
|
|
113
|
+
"dialects": {"hive": "FLOOR(n)", "mysql": "FLOOR(n)", "oracle": "FLOOR(n)", "tsql": "FLOOR(n)", "postgres": "FLOOR(n)", "spark": "FLOOR(n)", "trino": "FLOOR(n)", "snowflake": "FLOOR(n)", "redshift": "FLOOR(n)", "clickhouse": "floor(n)", "duckdb": "FLOOR(n)", "databricks": "FLOOR(n)"}},
|
|
114
|
+
{"name": "CEIL", "category": "math", "description": "Round up to integer",
|
|
115
|
+
"dialects": {"hive": "CEIL(n)", "mysql": "CEIL(n) or CEILING(n)", "oracle": "CEIL(n)", "tsql": "CEILING(n)", "postgres": "CEIL(n)", "spark": "CEIL(n)", "trino": "CEIL(n)", "snowflake": "CEIL(n)", "redshift": "CEIL(n)", "clickhouse": "ceil(n)", "duckdb": "CEIL(n)", "databricks": "CEIL(n)"}},
|
|
116
|
+
{"name": "HOUR", "category": "date", "description": "Extract hour from timestamp",
|
|
117
|
+
"dialects": {"hive": "HOUR(ts)", "mysql": "HOUR(ts)", "oracle": "EXTRACT(HOUR FROM ts)", "tsql": "DATEPART(hour, ts)", "postgres": "EXTRACT(HOUR FROM ts)", "spark": "HOUR(ts)", "trino": "HOUR(ts)", "snowflake": "HOUR(ts)", "redshift": "EXTRACT(HOUR FROM ts)", "clickhouse": "toHour(ts)", "duckdb": "HOUR(ts)", "databricks": "HOUR(ts)"}},
|
|
118
|
+
{"name": "MINUTE", "category": "date", "description": "Extract minute from timestamp",
|
|
119
|
+
"dialects": {"hive": "MINUTE(ts)", "mysql": "MINUTE(ts)", "oracle": "EXTRACT(MINUTE FROM ts)", "tsql": "DATEPART(minute, ts)", "postgres": "EXTRACT(MINUTE FROM ts)", "spark": "MINUTE(ts)", "trino": "MINUTE(ts)", "snowflake": "MINUTE(ts)", "redshift": "EXTRACT(MINUTE FROM ts)", "clickhouse": "toMinute(ts)", "duckdb": "MINUTE(ts)", "databricks": "MINUTE(ts)"}},
|
|
120
|
+
{"name": "SECOND", "category": "date", "description": "Extract second from timestamp",
|
|
121
|
+
"dialects": {"hive": "SECOND(ts)", "mysql": "SECOND(ts)", "oracle": "EXTRACT(SECOND FROM ts)", "tsql": "DATEPART(second, ts)", "postgres": "EXTRACT(SECOND FROM ts)", "spark": "SECOND(ts)", "trino": "SECOND(ts)", "snowflake": "SECOND(ts)", "redshift": "EXTRACT(SECOND FROM ts)", "clickhouse": "toSecond(ts)", "duckdb": "SECOND(ts)", "databricks": "SECOND(ts)"}},
|
|
122
|
+
{"name": "QUARTER", "category": "date", "description": "Extract quarter from date",
|
|
123
|
+
"dialects": {"hive": "QUARTER(date)", "mysql": "QUARTER(date)", "oracle": "TO_CHAR(date, 'Q')", "tsql": "DATEPART(quarter, date)", "postgres": "EXTRACT(QUARTER FROM date)", "spark": "QUARTER(date)", "trino": "QUARTER(date)", "snowflake": "QUARTER(date)", "redshift": "EXTRACT(QUARTER FROM date)", "clickhouse": "toQuarter(date)", "duckdb": "QUARTER(date)", "databricks": "QUARTER(date)"}},
|
|
124
|
+
{"name": "WEEKOFYEAR", "category": "date", "description": "Get week number of year",
|
|
125
|
+
"dialects": {"hive": "WEEKOFYEAR(date)", "mysql": "WEEK(date)", "oracle": "TO_CHAR(date, 'IW')", "tsql": "DATEPART(week, date)", "postgres": "EXTRACT(WEEK FROM date)", "spark": "WEEKOFYEAR(date)", "trino": "WEEK(date)", "snowflake": "WEEKOFYEAR(date)", "redshift": "EXTRACT(WEEK FROM date)", "clickhouse": "toWeek(date)", "duckdb": "WEEK(date)", "databricks": "WEEKOFYEAR(date)"}},
|
|
126
|
+
{"name": "DAYOFWEEK", "category": "date", "description": "Get day of week (1-7)",
|
|
127
|
+
"dialects": {"hive": "DAYOFWEEK(date)", "mysql": "DAYOFWEEK(date)", "oracle": "TO_CHAR(date, 'D')", "tsql": "DATEPART(weekday, date)", "postgres": "EXTRACT(DOW FROM date)", "spark": "DAYOFWEEK(date)", "trino": "DAY_OF_WEEK(date)", "snowflake": "DAYOFWEEK(date)", "redshift": "EXTRACT(DOW FROM date)", "clickhouse": "toDayOfWeek(date)", "duckdb": "DAYOFWEEK(date)", "databricks": "DAYOFWEEK(date)"}},
|
|
128
|
+
{"name": "LAST_DAY", "category": "date", "description": "Get last day of month",
|
|
129
|
+
"dialects": {"hive": "LAST_DAY(date)", "mysql": "LAST_DAY(date)", "oracle": "LAST_DAY(date)", "tsql": "EOMONTH(date)", "postgres": "(DATE_TRUNC('month', date) + INTERVAL '1 month - 1 day')::DATE", "spark": "LAST_DAY(date)", "trino": "LAST_DAY_OF_MONTH(date)", "snowflake": "LAST_DAY(date)", "redshift": "LAST_DAY(date)", "clickhouse": "toLastDayOfMonth(date)", "duckdb": "LAST_DAY(date)", "databricks": "LAST_DAY(date)"}},
|
|
130
|
+
{"name": "MONTHS_BETWEEN", "category": "date", "description": "Months between two dates",
|
|
131
|
+
"dialects": {"hive": "MONTHS_BETWEEN(date1, date2)", "mysql": "TIMESTAMPDIFF(MONTH, date2, date1)", "oracle": "MONTHS_BETWEEN(date1, date2)", "tsql": "DATEDIFF(month, date2, date1)", "postgres": "EXTRACT(YEAR FROM AGE(date1, date2)) * 12 + EXTRACT(MONTH FROM AGE(date1, date2))", "spark": "MONTHS_BETWEEN(date1, date2)", "trino": "DATE_DIFF('month', date2, date1)", "snowflake": "MONTHS_BETWEEN(date1, date2)", "redshift": "MONTHS_BETWEEN(date1, date2)", "clickhouse": "dateDiff('month', date2, date1)", "duckdb": "DATE_DIFF('month', date2, date1)", "databricks": "MONTHS_BETWEEN(date1, date2)"}},
|
|
132
|
+
{"name": "ADD_MONTHS", "category": "date", "description": "Add months to date",
|
|
133
|
+
"dialects": {"hive": "ADD_MONTHS(date, n)", "mysql": "DATE_ADD(date, INTERVAL n MONTH)", "oracle": "ADD_MONTHS(date, n)", "tsql": "DATEADD(month, n, date)", "postgres": "date + INTERVAL 'n months'", "spark": "ADD_MONTHS(date, n)", "trino": "DATE_ADD('month', n, date)", "snowflake": "DATEADD(month, n, date)", "redshift": "DATEADD(month, n, date)", "clickhouse": "addMonths(date, n)", "duckdb": "date + INTERVAL n MONTH", "databricks": "ADD_MONTHS(date, n)"}},
|
|
134
|
+
{"name": "NULLIF", "category": "conditional", "description": "Return NULL if two values are equal",
|
|
135
|
+
"dialects": {"hive": "NULLIF(a, b)", "mysql": "NULLIF(a, b)", "oracle": "NULLIF(a, b)", "tsql": "NULLIF(a, b)", "postgres": "NULLIF(a, b)", "spark": "NULLIF(a, b)", "trino": "NULLIF(a, b)", "snowflake": "NULLIF(a, b)", "redshift": "NULLIF(a, b)", "clickhouse": "nullIf(a, b)", "duckdb": "NULLIF(a, b)", "databricks": "NULLIF(a, b)"}},
|
|
136
|
+
{"name": "GREATEST", "category": "conditional", "description": "Return greatest value from list",
|
|
137
|
+
"dialects": {"hive": "GREATEST(a, b, ...)", "mysql": "GREATEST(a, b, ...)", "oracle": "GREATEST(a, b, ...)", "tsql": "(SELECT MAX(v) FROM (VALUES (a),(b)) AS T(v))", "postgres": "GREATEST(a, b, ...)", "spark": "GREATEST(a, b, ...)", "trino": "GREATEST(a, b, ...)", "snowflake": "GREATEST(a, b, ...)", "redshift": "GREATEST(a, b, ...)", "clickhouse": "greatest(a, b, ...)", "duckdb": "GREATEST(a, b, ...)", "databricks": "GREATEST(a, b, ...)"}},
|
|
138
|
+
{"name": "LEAST", "category": "conditional", "description": "Return smallest value from list",
|
|
139
|
+
"dialects": {"hive": "LEAST(a, b, ...)", "mysql": "LEAST(a, b, ...)", "oracle": "LEAST(a, b, ...)", "tsql": "(SELECT MIN(v) FROM (VALUES (a),(b)) AS T(v))", "postgres": "LEAST(a, b, ...)", "spark": "LEAST(a, b, ...)", "trino": "LEAST(a, b, ...)", "snowflake": "LEAST(a, b, ...)", "redshift": "LEAST(a, b, ...)", "clickhouse": "least(a, b, ...)", "duckdb": "LEAST(a, b, ...)", "databricks": "LEAST(a, b, ...)"}},
|
|
140
|
+
{"name": "DECODE", "category": "conditional", "description": "Oracle-style conditional decode",
|
|
141
|
+
"dialects": {"hive": "CASE col WHEN v1 THEN r1 WHEN v2 THEN r2 ELSE default END", "mysql": "CASE col WHEN v1 THEN r1 WHEN v2 THEN r2 ELSE default END", "oracle": "DECODE(col, v1, r1, v2, r2, default)", "tsql": "CASE col WHEN v1 THEN r1 WHEN v2 THEN r2 ELSE default END", "postgres": "CASE col WHEN v1 THEN r1 WHEN v2 THEN r2 ELSE default END", "spark": "DECODE(col, v1, r1, v2, r2, default)", "trino": "CASE col WHEN v1 THEN r1 WHEN v2 THEN r2 ELSE default END", "snowflake": "DECODE(col, v1, r1, v2, r2, default)", "redshift": "DECODE(col, v1, r1, v2, r2, default)", "clickhouse": "CASE col WHEN v1 THEN r1 WHEN v2 THEN r2 ELSE default END", "duckdb": "CASE col WHEN v1 THEN r1 WHEN v2 THEN r2 ELSE default END", "databricks": "DECODE(col, v1, r1, v2, r2, default)"}},
|
|
142
|
+
{"name": "MOD", "category": "math", "description": "Modulo (remainder)",
|
|
143
|
+
"dialects": {"hive": "MOD(a, b) or a % b", "mysql": "MOD(a, b) or a % b", "oracle": "MOD(a, b)", "tsql": "a % b", "postgres": "MOD(a, b) or a % b", "spark": "MOD(a, b) or a % b", "trino": "MOD(a, b)", "snowflake": "MOD(a, b)", "redshift": "MOD(a, b)", "clickhouse": "modulo(a, b) or a % b", "duckdb": "MOD(a, b)", "databricks": "MOD(a, b)"}},
|
|
144
|
+
{"name": "POWER", "category": "math", "description": "Raise to power",
|
|
145
|
+
"dialects": {"hive": "POWER(base, exp)", "mysql": "POWER(base, exp) or POW(base, exp)", "oracle": "POWER(base, exp)", "tsql": "POWER(base, exp)", "postgres": "POWER(base, exp)", "spark": "POWER(base, exp)", "trino": "POWER(base, exp)", "snowflake": "POWER(base, exp)", "redshift": "POWER(base, exp)", "clickhouse": "pow(base, exp)", "duckdb": "POWER(base, exp)", "databricks": "POWER(base, exp)"}},
|
|
146
|
+
{"name": "SQRT", "category": "math", "description": "Square root",
|
|
147
|
+
"dialects": {"hive": "SQRT(n)", "mysql": "SQRT(n)", "oracle": "SQRT(n)", "tsql": "SQRT(n)", "postgres": "SQRT(n)", "spark": "SQRT(n)", "trino": "SQRT(n)", "snowflake": "SQRT(n)", "redshift": "SQRT(n)", "clickhouse": "sqrt(n)", "duckdb": "SQRT(n)", "databricks": "SQRT(n)"}},
|
|
148
|
+
{"name": "LOG", "category": "math", "description": "Natural logarithm",
|
|
149
|
+
"dialects": {"hive": "LOG(n) or LN(n)", "mysql": "LOG(n) or LN(n)", "oracle": "LN(n)", "tsql": "LOG(n)", "postgres": "LN(n)", "spark": "LOG(n)", "trino": "LN(n)", "snowflake": "LN(n)", "redshift": "LN(n)", "clickhouse": "log(n)", "duckdb": "LN(n)", "databricks": "LOG(n)"}},
|
|
150
|
+
{"name": "LOG10", "category": "math", "description": "Base-10 logarithm",
|
|
151
|
+
"dialects": {"hive": "LOG10(n)", "mysql": "LOG10(n)", "oracle": "LOG(10, n)", "tsql": "LOG10(n)", "postgres": "LOG(n)", "spark": "LOG10(n)", "trino": "LOG10(n)", "snowflake": "LOG(10, n)", "redshift": "LOG(n)", "clickhouse": "log10(n)", "duckdb": "LOG10(n)", "databricks": "LOG10(n)"}},
|
|
152
|
+
{"name": "EXP", "category": "math", "description": "Exponential (e^n)",
|
|
153
|
+
"dialects": {"hive": "EXP(n)", "mysql": "EXP(n)", "oracle": "EXP(n)", "tsql": "EXP(n)", "postgres": "EXP(n)", "spark": "EXP(n)", "trino": "EXP(n)", "snowflake": "EXP(n)", "redshift": "EXP(n)", "clickhouse": "exp(n)", "duckdb": "EXP(n)", "databricks": "EXP(n)"}},
|
|
154
|
+
{"name": "SIGN", "category": "math", "description": "Return sign of number (-1, 0, 1)",
|
|
155
|
+
"dialects": {"hive": "SIGN(n)", "mysql": "SIGN(n)", "oracle": "SIGN(n)", "tsql": "SIGN(n)", "postgres": "SIGN(n)", "spark": "SIGN(n)", "trino": "SIGN(n)", "snowflake": "SIGN(n)", "redshift": "SIGN(n)", "clickhouse": "sign(n)", "duckdb": "SIGN(n)", "databricks": "SIGN(n)"}},
|
|
156
|
+
{"name": "TRUNCATE", "category": "math", "description": "Truncate to decimal places",
|
|
157
|
+
"dialects": {"hive": "TRUNCATE(n, d)", "mysql": "TRUNCATE(n, d)", "oracle": "TRUNC(n, d)", "tsql": "ROUND(n, d, 1)", "postgres": "TRUNC(n, d)", "spark": "TRUNCATE(n, d)", "trino": "TRUNCATE(n)", "snowflake": "TRUNC(n, d)", "redshift": "TRUNC(n, d)", "clickhouse": "trunc(n, d)", "duckdb": "TRUNC(n, d)", "databricks": "TRUNCATE(n, d)"}},
|
|
158
|
+
{"name": "LPAD", "category": "string", "description": "Left-pad string to length",
|
|
159
|
+
"dialects": {"hive": "LPAD(str, len, pad)", "mysql": "LPAD(str, len, pad)", "oracle": "LPAD(str, len, pad)", "tsql": "RIGHT(REPLICATE(pad, len) + str, len)", "postgres": "LPAD(str, len, pad)", "spark": "LPAD(str, len, pad)", "trino": "LPAD(str, len, pad)", "snowflake": "LPAD(str, len, pad)", "redshift": "LPAD(str, len, pad)", "clickhouse": "leftPad(str, len, pad)", "duckdb": "LPAD(str, len, pad)", "databricks": "LPAD(str, len, pad)"}},
|
|
160
|
+
{"name": "RPAD", "category": "string", "description": "Right-pad string to length",
|
|
161
|
+
"dialects": {"hive": "RPAD(str, len, pad)", "mysql": "RPAD(str, len, pad)", "oracle": "RPAD(str, len, pad)", "tsql": "LEFT(str + REPLICATE(pad, len), len)", "postgres": "RPAD(str, len, pad)", "spark": "RPAD(str, len, pad)", "trino": "RPAD(str, len, pad)", "snowflake": "RPAD(str, len, pad)", "redshift": "RPAD(str, len, pad)", "clickhouse": "rightPad(str, len, pad)", "duckdb": "RPAD(str, len, pad)", "databricks": "RPAD(str, len, pad)"}},
|
|
162
|
+
{"name": "REVERSE", "category": "string", "description": "Reverse string",
|
|
163
|
+
"dialects": {"hive": "REVERSE(str)", "mysql": "REVERSE(str)", "oracle": "REVERSE(str)", "tsql": "REVERSE(str)", "postgres": "REVERSE(str)", "spark": "REVERSE(str)", "trino": "REVERSE(str)", "snowflake": "REVERSE(str)", "redshift": "REVERSE(str)", "clickhouse": "reverse(str)", "duckdb": "REVERSE(str)", "databricks": "REVERSE(str)"}},
|
|
164
|
+
{"name": "INITCAP", "category": "string", "description": "Capitalize first letter of each word",
|
|
165
|
+
"dialects": {"hive": "INITCAP(str)", "mysql": "N/A (use custom function)", "oracle": "INITCAP(str)", "tsql": "N/A (use custom function)", "postgres": "INITCAP(str)", "spark": "INITCAP(str)", "trino": "N/A", "snowflake": "INITCAP(str)", "redshift": "INITCAP(str)", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "INITCAP(str)"}},
|
|
166
|
+
{"name": "TRANSLATE", "category": "string", "description": "Replace characters in string",
|
|
167
|
+
"dialects": {"hive": "TRANSLATE(str, from, to)", "mysql": "N/A (use REPLACE)", "oracle": "TRANSLATE(str, from, to)", "tsql": "N/A (use REPLACE)", "postgres": "TRANSLATE(str, from, to)", "spark": "TRANSLATE(str, from, to)", "trino": "TRANSLATE(str, from, to)", "snowflake": "TRANSLATE(str, from, to)", "redshift": "TRANSLATE(str, from, to)", "clickhouse": "N/A", "duckdb": "TRANSLATE(str, from, to)", "databricks": "TRANSLATE(str, from, to)"}},
|
|
168
|
+
{"name": "SOUNDEX", "category": "string", "description": "Phonetic encoding of string",
|
|
169
|
+
"dialects": {"hive": "SOUNDEX(str)", "mysql": "SOUNDEX(str)", "oracle": "SOUNDEX(str)", "tsql": "SOUNDEX(str)", "postgres": "SOUNDEX(str)", "spark": "SOUNDEX(str)", "trino": "N/A", "snowflake": "SOUNDEX(str)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "SOUNDEX(str)"}},
|
|
170
|
+
{"name": "ASCII", "category": "string", "description": "Get ASCII code of first character",
|
|
171
|
+
"dialects": {"hive": "ASCII(str)", "mysql": "ASCII(str)", "oracle": "ASCII(str)", "tsql": "ASCII(str)", "postgres": "ASCII(str)", "spark": "ASCII(str)", "trino": "CODEPOINT(str)", "snowflake": "ASCII(str)", "redshift": "ASCII(str)", "clickhouse": "toASCII(str)", "duckdb": "ASCII(str)", "databricks": "ASCII(str)"}},
|
|
172
|
+
{"name": "CHR", "category": "string", "description": "Get character from ASCII code",
|
|
173
|
+
"dialects": {"hive": "CHR(n)", "mysql": "CHAR(n)", "oracle": "CHR(n)", "tsql": "CHAR(n)", "postgres": "CHR(n)", "spark": "CHR(n)", "trino": "CHR(n)", "snowflake": "CHR(n)", "redshift": "CHR(n)", "clickhouse": "char(n)", "duckdb": "CHR(n)", "databricks": "CHR(n)"}},
|
|
174
|
+
{"name": "CUME_DIST", "category": "window", "description": "Cumulative distribution",
|
|
175
|
+
"dialects": {"hive": "CUME_DIST() OVER(...)", "mysql": "CUME_DIST() OVER(...)", "oracle": "CUME_DIST() OVER(...)", "tsql": "CUME_DIST() OVER(...)", "postgres": "CUME_DIST() OVER(...)", "spark": "CUME_DIST() OVER(...)", "trino": "CUME_DIST() OVER(...)", "snowflake": "CUME_DIST() OVER(...)", "redshift": "CUME_DIST() OVER(...)", "clickhouse": "N/A", "duckdb": "CUME_DIST() OVER(...)", "databricks": "CUME_DIST() OVER(...)"}},
|
|
176
|
+
{"name": "NTH_VALUE", "category": "window", "description": "Get nth value in window",
|
|
177
|
+
"dialects": {"hive": "NTH_VALUE(col, n) OVER(...)", "mysql": "NTH_VALUE(col, n) OVER(...)", "oracle": "NTH_VALUE(col, n) OVER(...)", "tsql": "N/A (use ROW_NUMBER subquery)", "postgres": "NTH_VALUE(col, n) OVER(...)", "spark": "NTH_VALUE(col, n) OVER(...)", "trino": "NTH_VALUE(col, n) OVER(...)", "snowflake": "NTH_VALUE(col, n) OVER(...)", "redshift": "NTH_VALUE(col, n) OVER(...)", "clickhouse": "N/A", "duckdb": "NTH_VALUE(col, n) OVER(...)", "databricks": "NTH_VALUE(col, n) OVER(...)"}},
|
|
178
|
+
{"name": "PERCENTILE_CONT", "category": "window", "description": "Continuous percentile",
|
|
179
|
+
"dialects": {"hive": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col)", "mysql": "N/A", "oracle": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col)", "tsql": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col) OVER(...)", "postgres": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col)", "spark": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col)", "trino": "APPROX_PERCENTILE(col, p)", "snowflake": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col)", "redshift": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col)", "clickhouse": "quantile(p)(col)", "duckdb": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col)", "databricks": "PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY col)"}},
|
|
180
|
+
{"name": "PERCENTILE_DISC", "category": "window", "description": "Discrete percentile",
|
|
181
|
+
"dialects": {"hive": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col)", "mysql": "N/A", "oracle": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col)", "tsql": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col) OVER(...)", "postgres": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col)", "spark": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col)", "trino": "APPROX_PERCENTILE(col, p)", "snowflake": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col)", "redshift": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col)", "clickhouse": "quantileExact(p)(col)", "duckdb": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col)", "databricks": "PERCENTILE_DISC(p) WITHIN GROUP (ORDER BY col)"}},
|
|
182
|
+
{"name": "JSON_OBJECT", "category": "json", "description": "Create JSON object",
|
|
183
|
+
"dialects": {"hive": "N/A (use named_struct + to_json)", "mysql": "JSON_OBJECT(k1, v1, k2, v2)", "oracle": "JSON_OBJECT(k1 VALUE v1, k2 VALUE v2)", "tsql": "JSON_OBJECT(k1: v1, k2: v2)", "postgres": "JSON_BUILD_OBJECT(k1, v1, k2, v2)", "spark": "TO_JSON(STRUCT(k1, v1))", "trino": "JSON_OBJECT(k1: v1, k2: v2)", "snowflake": "OBJECT_CONSTRUCT(k1, v1, k2, v2)", "redshift": "JSON_PARSE('{}')", "clickhouse": "N/A", "duckdb": "JSON_OBJECT(k1, v1)", "databricks": "TO_JSON(STRUCT(k1, v1))"}},
|
|
184
|
+
{"name": "JSON_QUERY", "category": "json", "description": "Extract JSON object/array",
|
|
185
|
+
"dialects": {"hive": "GET_JSON_OBJECT(json, '$.path')", "mysql": "JSON_EXTRACT(json, '$.path')", "oracle": "JSON_QUERY(json, '$.path')", "tsql": "JSON_QUERY(json, '$.path')", "postgres": "json->'path'", "spark": "GET_JSON_OBJECT(json, '$.path')", "trino": "JSON_EXTRACT(json, '$.path')", "snowflake": "GET_PATH(json, 'path')", "redshift": "JSON_EXTRACT_PATH_TEXT(json, 'path')", "clickhouse": "JSONExtract(json, 'path')", "duckdb": "json->'$.path'", "databricks": "GET_JSON_OBJECT(json, '$.path')"}},
|
|
186
|
+
{"name": "JSON_SET", "category": "json", "description": "Set value in JSON",
|
|
187
|
+
"dialects": {"hive": "N/A", "mysql": "JSON_SET(json, '$.path', value)", "oracle": "JSON_TRANSFORM(json, SET '$.path' = value)", "tsql": "JSON_MODIFY(json, '$.path', value)", "postgres": "JSONB_SET(json, '{path}', value)", "spark": "N/A", "trino": "N/A", "snowflake": "OBJECT_INSERT(json, 'path', value)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "N/A"}},
|
|
188
|
+
{"name": "JSON_REMOVE", "category": "json", "description": "Remove key from JSON",
|
|
189
|
+
"dialects": {"hive": "N/A", "mysql": "JSON_REMOVE(json, '$.path')", "oracle": "JSON_TRANSFORM(json, REMOVE '$.path')", "tsql": "JSON_MODIFY(json, '$.path', NULL)", "postgres": "json - 'path' or json #- '{path}'", "spark": "N/A", "trino": "N/A", "snowflake": "OBJECT_DELETE(json, 'path')", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "N/A"}},
|
|
190
|
+
{"name": "JSON_KEYS", "category": "json", "description": "Get keys from JSON object",
|
|
191
|
+
"dialects": {"hive": "N/A", "mysql": "JSON_KEYS(json)", "oracle": "N/A", "tsql": "N/A (use OPENJSON)", "postgres": "JSON_OBJECT_KEYS(json)", "spark": "N/A", "trino": "MAP_KEYS(CAST(json AS MAP))", "snowflake": "OBJECT_KEYS(json)", "redshift": "N/A", "clickhouse": "JSONExtractKeys(json)", "duckdb": "JSON_KEYS(json)", "databricks": "N/A"}},
|
|
192
|
+
{"name": "LTRIM", "category": "string", "description": "Remove leading spaces/chars",
|
|
193
|
+
"dialects": {"hive": "LTRIM(str)", "mysql": "LTRIM(str)", "oracle": "LTRIM(str, chars)", "tsql": "LTRIM(str)", "postgres": "LTRIM(str, chars)", "spark": "LTRIM(str)", "trino": "LTRIM(str)", "snowflake": "LTRIM(str, chars)", "redshift": "LTRIM(str, chars)", "clickhouse": "trimLeft(str)", "duckdb": "LTRIM(str, chars)", "databricks": "LTRIM(str)"}},
|
|
194
|
+
{"name": "RTRIM", "category": "string", "description": "Remove trailing spaces/chars",
|
|
195
|
+
"dialects": {"hive": "RTRIM(str)", "mysql": "RTRIM(str)", "oracle": "RTRIM(str, chars)", "tsql": "RTRIM(str)", "postgres": "RTRIM(str, chars)", "spark": "RTRIM(str)", "trino": "RTRIM(str)", "snowflake": "RTRIM(str, chars)", "redshift": "RTRIM(str, chars)", "clickhouse": "trimRight(str)", "duckdb": "RTRIM(str, chars)", "databricks": "RTRIM(str)"}},
|
|
196
|
+
{"name": "REPEAT", "category": "string", "description": "Repeat string n times",
|
|
197
|
+
"dialects": {"hive": "REPEAT(str, n)", "mysql": "REPEAT(str, n)", "oracle": "RPAD(str, LENGTH(str)*n, str)", "tsql": "REPLICATE(str, n)", "postgres": "REPEAT(str, n)", "spark": "REPEAT(str, n)", "trino": "REPEAT(str, n)", "snowflake": "REPEAT(str, n)", "redshift": "REPEAT(str, n)", "clickhouse": "repeat(str, n)", "duckdb": "REPEAT(str, n)", "databricks": "REPEAT(str, n)"}},
|
|
198
|
+
{"name": "SPACE", "category": "string", "description": "Generate n spaces",
|
|
199
|
+
"dialects": {"hive": "SPACE(n)", "mysql": "SPACE(n)", "oracle": "RPAD(' ', n)", "tsql": "SPACE(n)", "postgres": "REPEAT(' ', n)", "spark": "SPACE(n)", "trino": "N/A (use REPEAT)", "snowflake": "SPACE(n)", "redshift": "REPEAT(' ', n)", "clickhouse": "repeat(' ', n)", "duckdb": "REPEAT(' ', n)", "databricks": "SPACE(n)"}},
|
|
200
|
+
{"name": "LEFT", "category": "string", "description": "Get leftmost n characters",
|
|
201
|
+
"dialects": {"hive": "SUBSTR(str, 1, n)", "mysql": "LEFT(str, n)", "oracle": "SUBSTR(str, 1, n)", "tsql": "LEFT(str, n)", "postgres": "LEFT(str, n)", "spark": "LEFT(str, n)", "trino": "SUBSTR(str, 1, n)", "snowflake": "LEFT(str, n)", "redshift": "LEFT(str, n)", "clickhouse": "left(str, n)", "duckdb": "LEFT(str, n)", "databricks": "LEFT(str, n)"}},
|
|
202
|
+
{"name": "RIGHT", "category": "string", "description": "Get rightmost n characters",
|
|
203
|
+
"dialects": {"hive": "SUBSTR(str, -n)", "mysql": "RIGHT(str, n)", "oracle": "SUBSTR(str, -n)", "tsql": "RIGHT(str, n)", "postgres": "RIGHT(str, n)", "spark": "RIGHT(str, n)", "trino": "SUBSTR(str, -n)", "snowflake": "RIGHT(str, n)", "redshift": "RIGHT(str, n)", "clickhouse": "right(str, n)", "duckdb": "RIGHT(str, n)", "databricks": "RIGHT(str, n)"}},
|
|
204
|
+
{"name": "LOCATE", "category": "string", "description": "Find position of substring",
|
|
205
|
+
"dialects": {"hive": "LOCATE(substr, str)", "mysql": "LOCATE(substr, str)", "oracle": "INSTR(str, substr)", "tsql": "CHARINDEX(substr, str)", "postgres": "POSITION(substr IN str)", "spark": "LOCATE(substr, str)", "trino": "STRPOS(str, substr)", "snowflake": "POSITION(substr IN str)", "redshift": "POSITION(substr IN str)", "clickhouse": "position(str, substr)", "duckdb": "INSTR(str, substr)", "databricks": "LOCATE(substr, str)"}},
|
|
206
|
+
{"name": "CONCAT_WS", "category": "string", "description": "Concatenate with separator",
|
|
207
|
+
"dialects": {"hive": "CONCAT_WS(sep, s1, s2, ...)", "mysql": "CONCAT_WS(sep, s1, s2, ...)", "oracle": "s1 || sep || s2", "tsql": "CONCAT_WS(sep, s1, s2, ...)", "postgres": "CONCAT_WS(sep, s1, s2, ...)", "spark": "CONCAT_WS(sep, s1, s2, ...)", "trino": "ARRAY_JOIN(ARRAY[s1, s2], sep)", "snowflake": "CONCAT_WS(sep, s1, s2, ...)", "redshift": "CONCAT_WS(sep, s1, s2, ...)", "clickhouse": "concat_ws(sep, s1, s2, ...)", "duckdb": "CONCAT_WS(sep, s1, s2, ...)", "databricks": "CONCAT_WS(sep, s1, s2, ...)"}},
|
|
208
|
+
{"name": "FORMAT", "category": "string", "description": "Format number with pattern",
|
|
209
|
+
"dialects": {"hive": "FORMAT_NUMBER(n, d)", "mysql": "FORMAT(n, d)", "oracle": "TO_CHAR(n, 'FM999,999.00')", "tsql": "FORMAT(n, 'N2')", "postgres": "TO_CHAR(n, 'FM999,999.00')", "spark": "FORMAT_NUMBER(n, d)", "trino": "FORMAT('%,.2f', n)", "snowflake": "TO_CHAR(n, '999,999.00')", "redshift": "TO_CHAR(n, '999,999.00')", "clickhouse": "formatReadableQuantity(n)", "duckdb": "FORMAT('{:,.2f}', n)", "databricks": "FORMAT_NUMBER(n, d)"}},
|
|
210
|
+
{"name": "REGEXP_EXTRACT", "category": "string", "description": "Extract regex match",
|
|
211
|
+
"dialects": {"hive": "REGEXP_EXTRACT(str, pattern, idx)", "mysql": "REGEXP_SUBSTR(str, pattern)", "oracle": "REGEXP_SUBSTR(str, pattern)", "tsql": "N/A", "postgres": "REGEXP_MATCH(str, pattern)[idx]", "spark": "REGEXP_EXTRACT(str, pattern, idx)", "trino": "REGEXP_EXTRACT(str, pattern, idx)", "snowflake": "REGEXP_SUBSTR(str, pattern)", "redshift": "REGEXP_SUBSTR(str, pattern)", "clickhouse": "extractAll(str, pattern)[idx]", "duckdb": "REGEXP_EXTRACT(str, pattern)", "databricks": "REGEXP_EXTRACT(str, pattern, idx)"}},
|
|
212
|
+
{"name": "REGEXP_LIKE", "category": "string", "description": "Test regex match",
|
|
213
|
+
"dialects": {"hive": "str RLIKE pattern", "mysql": "str REGEXP pattern", "oracle": "REGEXP_LIKE(str, pattern)", "tsql": "str LIKE pattern", "postgres": "str ~ pattern", "spark": "str RLIKE pattern", "trino": "REGEXP_LIKE(str, pattern)", "snowflake": "REGEXP_LIKE(str, pattern)", "redshift": "str ~ pattern", "clickhouse": "match(str, pattern)", "duckdb": "REGEXP_MATCHES(str, pattern)", "databricks": "str RLIKE pattern"}},
|
|
214
|
+
{"name": "MD5", "category": "string", "description": "MD5 hash of string",
|
|
215
|
+
"dialects": {"hive": "MD5(str)", "mysql": "MD5(str)", "oracle": "RAWTOHEX(DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW(str), 2))", "tsql": "HASHBYTES('MD5', str)", "postgres": "MD5(str)", "spark": "MD5(str)", "trino": "MD5(str)", "snowflake": "MD5(str)", "redshift": "MD5(str)", "clickhouse": "MD5(str)", "duckdb": "MD5(str)", "databricks": "MD5(str)"}},
|
|
216
|
+
{"name": "SHA1", "category": "string", "description": "SHA1 hash of string",
|
|
217
|
+
"dialects": {"hive": "SHA1(str)", "mysql": "SHA1(str)", "oracle": "RAWTOHEX(DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW(str), 3))", "tsql": "HASHBYTES('SHA1', str)", "postgres": "ENCODE(DIGEST(str, 'sha1'), 'hex')", "spark": "SHA1(str)", "trino": "SHA1(str)", "snowflake": "SHA1(str)", "redshift": "SHA1(str)", "clickhouse": "SHA1(str)", "duckdb": "SHA1(str)", "databricks": "SHA1(str)"}},
|
|
218
|
+
{"name": "BASE64_ENCODE", "category": "string", "description": "Encode to Base64",
|
|
219
|
+
"dialects": {"hive": "BASE64(str)", "mysql": "TO_BASE64(str)", "oracle": "UTL_ENCODE.BASE64_ENCODE(UTL_RAW.CAST_TO_RAW(str))", "tsql": "CAST(str AS VARBINARY(MAX)) FOR XML PATH('')", "postgres": "ENCODE(str::bytea, 'base64')", "spark": "BASE64(str)", "trino": "TO_BASE64(str)", "snowflake": "BASE64_ENCODE(str)", "redshift": "N/A", "clickhouse": "base64Encode(str)", "duckdb": "BASE64(str)", "databricks": "BASE64(str)"}},
|
|
220
|
+
{"name": "BASE64_DECODE", "category": "string", "description": "Decode from Base64",
|
|
221
|
+
"dialects": {"hive": "UNBASE64(str)", "mysql": "FROM_BASE64(str)", "oracle": "UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_DECODE(str))", "tsql": "CAST(CAST(str AS XML).value('.', 'VARBINARY(MAX)') AS VARCHAR(MAX))", "postgres": "DECODE(str, 'base64')", "spark": "UNBASE64(str)", "trino": "FROM_BASE64(str)", "snowflake": "BASE64_DECODE_STRING(str)", "redshift": "N/A", "clickhouse": "base64Decode(str)", "duckdb": "FROM_BASE64(str)", "databricks": "UNBASE64(str)"}},
|
|
222
|
+
{"name": "ARRAY_JOIN", "category": "array", "description": "Join array elements to string",
|
|
223
|
+
"dialects": {"hive": "CONCAT_WS(sep, arr)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY_TO_STRING(arr, sep)", "spark": "ARRAY_JOIN(arr, sep)", "trino": "ARRAY_JOIN(arr, sep)", "snowflake": "ARRAY_TO_STRING(arr, sep)", "redshift": "N/A", "clickhouse": "arrayStringConcat(arr, sep)", "duckdb": "ARRAY_TO_STRING(arr, sep)", "databricks": "ARRAY_JOIN(arr, sep)"}},
|
|
224
|
+
{"name": "ARRAY_DISTINCT", "category": "array", "description": "Remove duplicates from array",
|
|
225
|
+
"dialects": {"hive": "ARRAY_DISTINCT(arr)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY(SELECT DISTINCT UNNEST(arr))", "spark": "ARRAY_DISTINCT(arr)", "trino": "ARRAY_DISTINCT(arr)", "snowflake": "ARRAY_DISTINCT(arr)", "redshift": "N/A", "clickhouse": "arrayDistinct(arr)", "duckdb": "ARRAY_DISTINCT(arr)", "databricks": "ARRAY_DISTINCT(arr)"}},
|
|
226
|
+
{"name": "ARRAY_SORT", "category": "array", "description": "Sort array elements",
|
|
227
|
+
"dialects": {"hive": "SORT_ARRAY(arr)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY(SELECT UNNEST(arr) ORDER BY 1)", "spark": "ARRAY_SORT(arr)", "trino": "ARRAY_SORT(arr)", "snowflake": "ARRAY_SORT(arr)", "redshift": "N/A", "clickhouse": "arraySort(arr)", "duckdb": "ARRAY_SORT(arr)", "databricks": "ARRAY_SORT(arr)"}},
|
|
228
|
+
{"name": "ARRAY_POSITION", "category": "array", "description": "Find position of element in array",
|
|
229
|
+
"dialects": {"hive": "ARRAY_POSITION(arr, val)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY_POSITION(arr, val)", "spark": "ARRAY_POSITION(arr, val)", "trino": "ARRAY_POSITION(arr, val)", "snowflake": "ARRAY_POSITION(val, arr)", "redshift": "N/A", "clickhouse": "indexOf(arr, val)", "duckdb": "ARRAY_POSITION(arr, val)", "databricks": "ARRAY_POSITION(arr, val)"}},
|
|
230
|
+
{"name": "ARRAY_SLICE", "category": "array", "description": "Get slice of array",
|
|
231
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "arr[start:end]", "spark": "SLICE(arr, start, len)", "trino": "SLICE(arr, start, len)", "snowflake": "ARRAY_SLICE(arr, start, end)", "redshift": "N/A", "clickhouse": "arraySlice(arr, start, len)", "duckdb": "arr[start:end]", "databricks": "SLICE(arr, start, len)"}},
|
|
232
|
+
{"name": "ARRAY_CONCAT", "category": "array", "description": "Concatenate arrays",
|
|
233
|
+
"dialects": {"hive": "CONCAT(arr1, arr2)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "arr1 || arr2", "spark": "CONCAT(arr1, arr2)", "trino": "CONCAT(arr1, arr2)", "snowflake": "ARRAY_CAT(arr1, arr2)", "redshift": "N/A", "clickhouse": "arrayConcat(arr1, arr2)", "duckdb": "arr1 || arr2", "databricks": "CONCAT(arr1, arr2)"}},
|
|
234
|
+
{"name": "MAP_KEYS", "category": "array", "description": "Get keys from map",
|
|
235
|
+
"dialects": {"hive": "MAP_KEYS(map)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A (use jsonb_object_keys)", "spark": "MAP_KEYS(map)", "trino": "MAP_KEYS(map)", "snowflake": "OBJECT_KEYS(map)", "redshift": "N/A", "clickhouse": "mapKeys(map)", "duckdb": "MAP_KEYS(map)", "databricks": "MAP_KEYS(map)"}},
|
|
236
|
+
{"name": "MAP_VALUES", "category": "array", "description": "Get values from map",
|
|
237
|
+
"dialects": {"hive": "MAP_VALUES(map)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "MAP_VALUES(map)", "trino": "MAP_VALUES(map)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "mapValues(map)", "duckdb": "MAP_VALUES(map)", "databricks": "MAP_VALUES(map)"}},
|
|
238
|
+
{"name": "MAP_FROM_ARRAYS", "category": "array", "description": "Create map from key/value arrays",
|
|
239
|
+
"dialects": {"hive": "MAP_FROM_ARRAYS(keys, values)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "MAP_FROM_ARRAYS(keys, values)", "trino": "MAP(keys, values)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "mapFromArrays(keys, values)", "duckdb": "MAP(keys, values)", "databricks": "MAP_FROM_ARRAYS(keys, values)"}},
|
|
240
|
+
{"name": "COLLECT_SET", "category": "aggregate", "description": "Aggregate unique values into array",
|
|
241
|
+
"dialects": {"hive": "COLLECT_SET(col)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY_AGG(DISTINCT col)", "spark": "COLLECT_SET(col)", "trino": "ARRAY_AGG(DISTINCT col)", "snowflake": "ARRAY_UNIQUE_AGG(col)", "redshift": "N/A", "clickhouse": "groupUniqArray(col)", "duckdb": "LIST(DISTINCT col)", "databricks": "COLLECT_SET(col)"}},
|
|
242
|
+
{"name": "COUNT_DISTINCT", "category": "aggregate", "description": "Count distinct values",
|
|
243
|
+
"dialects": {"hive": "COUNT(DISTINCT col)", "mysql": "COUNT(DISTINCT col)", "oracle": "COUNT(DISTINCT col)", "tsql": "COUNT(DISTINCT col)", "postgres": "COUNT(DISTINCT col)", "spark": "COUNT(DISTINCT col)", "trino": "COUNT(DISTINCT col)", "snowflake": "COUNT(DISTINCT col)", "redshift": "COUNT(DISTINCT col)", "clickhouse": "uniq(col)", "duckdb": "COUNT(DISTINCT col)", "databricks": "COUNT(DISTINCT col)"}},
|
|
244
|
+
{"name": "APPROX_COUNT_DISTINCT", "category": "aggregate", "description": "Approximate distinct count",
|
|
245
|
+
"dialects": {"hive": "APPROX_COUNT_DISTINCT(col)", "mysql": "N/A", "oracle": "APPROX_COUNT_DISTINCT(col)", "tsql": "APPROX_COUNT_DISTINCT(col)", "postgres": "N/A (use HyperLogLog extension)", "spark": "APPROX_COUNT_DISTINCT(col)", "trino": "APPROX_DISTINCT(col)", "snowflake": "APPROX_COUNT_DISTINCT(col)", "redshift": "APPROXIMATE COUNT(DISTINCT col)", "clickhouse": "uniqHLL12(col)", "duckdb": "APPROX_COUNT_DISTINCT(col)", "databricks": "APPROX_COUNT_DISTINCT(col)"}},
|
|
246
|
+
{"name": "STDDEV", "category": "aggregate", "description": "Standard deviation",
|
|
247
|
+
"dialects": {"hive": "STDDEV(col)", "mysql": "STDDEV(col)", "oracle": "STDDEV(col)", "tsql": "STDEV(col)", "postgres": "STDDEV(col)", "spark": "STDDEV(col)", "trino": "STDDEV(col)", "snowflake": "STDDEV(col)", "redshift": "STDDEV(col)", "clickhouse": "stddevPop(col)", "duckdb": "STDDEV(col)", "databricks": "STDDEV(col)"}},
|
|
248
|
+
{"name": "VARIANCE", "category": "aggregate", "description": "Variance",
|
|
249
|
+
"dialects": {"hive": "VARIANCE(col)", "mysql": "VARIANCE(col)", "oracle": "VARIANCE(col)", "tsql": "VAR(col)", "postgres": "VARIANCE(col)", "spark": "VARIANCE(col)", "trino": "VARIANCE(col)", "snowflake": "VARIANCE(col)", "redshift": "VARIANCE(col)", "clickhouse": "varPop(col)", "duckdb": "VARIANCE(col)", "databricks": "VARIANCE(col)"}},
|
|
250
|
+
{"name": "CORR", "category": "aggregate", "description": "Correlation coefficient",
|
|
251
|
+
"dialects": {"hive": "CORR(col1, col2)", "mysql": "N/A", "oracle": "CORR(col1, col2)", "tsql": "N/A", "postgres": "CORR(col1, col2)", "spark": "CORR(col1, col2)", "trino": "CORR(col1, col2)", "snowflake": "CORR(col1, col2)", "redshift": "CORR(col1, col2)", "clickhouse": "corr(col1, col2)", "duckdb": "CORR(col1, col2)", "databricks": "CORR(col1, col2)"}},
|
|
252
|
+
{"name": "COVAR_POP", "category": "aggregate", "description": "Population covariance",
|
|
253
|
+
"dialects": {"hive": "COVAR_POP(col1, col2)", "mysql": "N/A", "oracle": "COVAR_POP(col1, col2)", "tsql": "N/A", "postgres": "COVAR_POP(col1, col2)", "spark": "COVAR_POP(col1, col2)", "trino": "COVAR_POP(col1, col2)", "snowflake": "COVAR_POP(col1, col2)", "redshift": "COVAR_POP(col1, col2)", "clickhouse": "covarPop(col1, col2)", "duckdb": "COVAR_POP(col1, col2)", "databricks": "COVAR_POP(col1, col2)"}},
|
|
254
|
+
{"name": "MEDIAN", "category": "aggregate", "description": "Median value",
|
|
255
|
+
"dialects": {"hive": "PERCENTILE(col, 0.5)", "mysql": "N/A", "oracle": "MEDIAN(col)", "tsql": "PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY col)", "postgres": "PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY col)", "spark": "PERCENTILE(col, 0.5)", "trino": "APPROX_PERCENTILE(col, 0.5)", "snowflake": "MEDIAN(col)", "redshift": "MEDIAN(col)", "clickhouse": "median(col)", "duckdb": "MEDIAN(col)", "databricks": "PERCENTILE(col, 0.5)"}},
|
|
256
|
+
{"name": "MODE", "category": "aggregate", "description": "Most frequent value",
|
|
257
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "STATS_MODE(col)", "tsql": "N/A", "postgres": "MODE() WITHIN GROUP (ORDER BY col)", "spark": "N/A", "trino": "N/A", "snowflake": "MODE(col)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "MODE(col)", "databricks": "N/A"}},
|
|
258
|
+
{"name": "BIT_AND", "category": "aggregate", "description": "Bitwise AND aggregate",
|
|
259
|
+
"dialects": {"hive": "N/A", "mysql": "BIT_AND(col)", "oracle": "N/A", "tsql": "N/A", "postgres": "BIT_AND(col)", "spark": "BIT_AND(col)", "trino": "BITWISE_AND_AGG(col)", "snowflake": "BITAND_AGG(col)", "redshift": "BIT_AND(col)", "clickhouse": "groupBitAnd(col)", "duckdb": "BIT_AND(col)", "databricks": "BIT_AND(col)"}},
|
|
260
|
+
{"name": "BIT_OR", "category": "aggregate", "description": "Bitwise OR aggregate",
|
|
261
|
+
"dialects": {"hive": "N/A", "mysql": "BIT_OR(col)", "oracle": "N/A", "tsql": "N/A", "postgres": "BIT_OR(col)", "spark": "BIT_OR(col)", "trino": "BITWISE_OR_AGG(col)", "snowflake": "BITOR_AGG(col)", "redshift": "BIT_OR(col)", "clickhouse": "groupBitOr(col)", "duckdb": "BIT_OR(col)", "databricks": "BIT_OR(col)"}},
|
|
262
|
+
{"name": "BOOL_AND", "category": "aggregate", "description": "Logical AND aggregate",
|
|
263
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "BOOL_AND(col)", "spark": "BOOL_AND(col)", "trino": "BOOL_AND(col)", "snowflake": "BOOLAND_AGG(col)", "redshift": "BOOL_AND(col)", "clickhouse": "N/A", "duckdb": "BOOL_AND(col)", "databricks": "BOOL_AND(col)"}},
|
|
264
|
+
{"name": "BOOL_OR", "category": "aggregate", "description": "Logical OR aggregate",
|
|
265
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "BOOL_OR(col)", "spark": "BOOL_OR(col)", "trino": "BOOL_OR(col)", "snowflake": "BOOLOR_AGG(col)", "redshift": "BOOL_OR(col)", "clickhouse": "N/A", "duckdb": "BOOL_OR(col)", "databricks": "BOOL_OR(col)"}},
|
|
266
|
+
{"name": "FIRST", "category": "aggregate", "description": "First value in group",
|
|
267
|
+
"dialects": {"hive": "FIRST_VALUE(col)", "mysql": "N/A (use subquery)", "oracle": "FIRST_VALUE(col)", "tsql": "N/A (use TOP 1)", "postgres": "N/A (use DISTINCT ON)", "spark": "FIRST(col)", "trino": "ARBITRARY(col)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "any(col)", "duckdb": "FIRST(col)", "databricks": "FIRST(col)"}},
|
|
268
|
+
{"name": "DATE_TRUNC", "category": "date", "description": "Truncate date to specified precision",
|
|
269
|
+
"dialects": {"hive": "TRUNC(date, 'MM')", "mysql": "DATE_FORMAT(date, '%Y-%m-01')", "oracle": "TRUNC(date, 'MM')", "tsql": "DATETRUNC(month, date)", "postgres": "DATE_TRUNC('month', date)", "spark": "DATE_TRUNC('month', date)", "trino": "DATE_TRUNC('month', date)", "snowflake": "DATE_TRUNC('month', date)", "redshift": "DATE_TRUNC('month', date)", "clickhouse": "toStartOfMonth(date)", "duckdb": "DATE_TRUNC('month', date)", "databricks": "DATE_TRUNC('month', date)"}},
|
|
270
|
+
{"name": "EXTRACT", "category": "date", "description": "Extract date/time component",
|
|
271
|
+
"dialects": {"hive": "EXTRACT(YEAR FROM date)", "mysql": "EXTRACT(YEAR FROM date)", "oracle": "EXTRACT(YEAR FROM date)", "tsql": "DATEPART(year, date)", "postgres": "EXTRACT(YEAR FROM date)", "spark": "EXTRACT(YEAR FROM date)", "trino": "EXTRACT(YEAR FROM date)", "snowflake": "EXTRACT(YEAR FROM date)", "redshift": "EXTRACT(YEAR FROM date)", "clickhouse": "toYear(date)", "duckdb": "EXTRACT(YEAR FROM date)", "databricks": "EXTRACT(YEAR FROM date)"}},
|
|
272
|
+
{"name": "NOW", "category": "date", "description": "Current timestamp",
|
|
273
|
+
"dialects": {"hive": "CURRENT_TIMESTAMP", "mysql": "NOW()", "oracle": "SYSDATE", "tsql": "GETDATE()", "postgres": "NOW()", "spark": "CURRENT_TIMESTAMP()", "trino": "NOW()", "snowflake": "CURRENT_TIMESTAMP()", "redshift": "GETDATE()", "clickhouse": "now()", "duckdb": "NOW()", "databricks": "CURRENT_TIMESTAMP()"}},
|
|
274
|
+
{"name": "SYSDATE", "category": "date", "description": "System date (Oracle style)",
|
|
275
|
+
"dialects": {"hive": "CURRENT_DATE", "mysql": "SYSDATE()", "oracle": "SYSDATE", "tsql": "GETDATE()", "postgres": "CURRENT_DATE", "spark": "CURRENT_DATE()", "trino": "CURRENT_DATE", "snowflake": "SYSDATE()", "redshift": "SYSDATE", "clickhouse": "today()", "duckdb": "CURRENT_DATE", "databricks": "CURRENT_DATE()"}},
|
|
276
|
+
{"name": "GETDATE", "category": "date", "description": "Get current date/time (SQL Server style)",
|
|
277
|
+
"dialects": {"hive": "CURRENT_TIMESTAMP", "mysql": "NOW()", "oracle": "SYSDATE", "tsql": "GETDATE()", "postgres": "NOW()", "spark": "CURRENT_TIMESTAMP()", "trino": "NOW()", "snowflake": "CURRENT_TIMESTAMP()", "redshift": "GETDATE()", "clickhouse": "now()", "duckdb": "NOW()", "databricks": "CURRENT_TIMESTAMP()"}},
|
|
278
|
+
{"name": "DATEPART", "category": "date", "description": "Extract part of date (SQL Server style)",
|
|
279
|
+
"dialects": {"hive": "EXTRACT(part FROM date)", "mysql": "EXTRACT(part FROM date)", "oracle": "EXTRACT(part FROM date)", "tsql": "DATEPART(part, date)", "postgres": "EXTRACT(part FROM date)", "spark": "EXTRACT(part FROM date)", "trino": "EXTRACT(part FROM date)", "snowflake": "DATE_PART(part, date)", "redshift": "DATE_PART(part, date)", "clickhouse": "toYear/toMonth/toDay(date)", "duckdb": "DATE_PART(part, date)", "databricks": "EXTRACT(part FROM date)"}},
|
|
280
|
+
{"name": "MAKE_DATE", "category": "date", "description": "Create date from year, month, day",
|
|
281
|
+
"dialects": {"hive": "N/A (use CONCAT + TO_DATE)", "mysql": "MAKEDATE(year, dayofyear) or STR_TO_DATE", "oracle": "TO_DATE(year||'-'||month||'-'||day, 'YYYY-MM-DD')", "tsql": "DATEFROMPARTS(year, month, day)", "postgres": "MAKE_DATE(year, month, day)", "spark": "MAKE_DATE(year, month, day)", "trino": "N/A", "snowflake": "DATE_FROM_PARTS(year, month, day)", "redshift": "N/A", "clickhouse": "makeDate(year, month, day)", "duckdb": "MAKE_DATE(year, month, day)", "databricks": "MAKE_DATE(year, month, day)"}},
|
|
282
|
+
{"name": "MAKE_TIMESTAMP", "category": "date", "description": "Create timestamp from components",
|
|
283
|
+
"dialects": {"hive": "N/A", "mysql": "N/A (use STR_TO_DATE)", "oracle": "TO_TIMESTAMP(...)", "tsql": "DATETIMEFROMPARTS(y, m, d, h, mi, s, ms)", "postgres": "MAKE_TIMESTAMP(y, m, d, h, mi, s)", "spark": "MAKE_TIMESTAMP(y, m, d, h, mi, s)", "trino": "N/A", "snowflake": "TIMESTAMP_FROM_PARTS(y, m, d, h, mi, s)", "redshift": "N/A", "clickhouse": "makeDateTime(y, m, d, h, mi, s)", "duckdb": "MAKE_TIMESTAMP(y, m, d, h, mi, s)", "databricks": "MAKE_TIMESTAMP(y, m, d, h, mi, s)"}},
|
|
284
|
+
{"name": "AGE", "category": "date", "description": "Calculate age/interval between dates",
|
|
285
|
+
"dialects": {"hive": "DATEDIFF(date1, date2)", "mysql": "TIMESTAMPDIFF(YEAR, date2, date1)", "oracle": "MONTHS_BETWEEN(date1, date2)/12", "tsql": "DATEDIFF(year, date2, date1)", "postgres": "AGE(date1, date2)", "spark": "DATEDIFF(date1, date2)", "trino": "DATE_DIFF('day', date2, date1)", "snowflake": "DATEDIFF(year, date2, date1)", "redshift": "DATEDIFF(year, date2, date1)", "clickhouse": "dateDiff('year', date2, date1)", "duckdb": "AGE(date1, date2)", "databricks": "DATEDIFF(date1, date2)"}},
|
|
286
|
+
{"name": "RAND", "category": "math", "description": "Random number between 0 and 1",
|
|
287
|
+
"dialects": {"hive": "RAND()", "mysql": "RAND()", "oracle": "DBMS_RANDOM.VALUE", "tsql": "RAND()", "postgres": "RANDOM()", "spark": "RAND()", "trino": "RAND()", "snowflake": "RANDOM()", "redshift": "RANDOM()", "clickhouse": "rand()", "duckdb": "RANDOM()", "databricks": "RAND()"}},
|
|
288
|
+
{"name": "SIN", "category": "math", "description": "Sine of angle (radians)",
|
|
289
|
+
"dialects": {"hive": "SIN(x)", "mysql": "SIN(x)", "oracle": "SIN(x)", "tsql": "SIN(x)", "postgres": "SIN(x)", "spark": "SIN(x)", "trino": "SIN(x)", "snowflake": "SIN(x)", "redshift": "SIN(x)", "clickhouse": "sin(x)", "duckdb": "SIN(x)", "databricks": "SIN(x)"}},
|
|
290
|
+
{"name": "COS", "category": "math", "description": "Cosine of angle (radians)",
|
|
291
|
+
"dialects": {"hive": "COS(x)", "mysql": "COS(x)", "oracle": "COS(x)", "tsql": "COS(x)", "postgres": "COS(x)", "spark": "COS(x)", "trino": "COS(x)", "snowflake": "COS(x)", "redshift": "COS(x)", "clickhouse": "cos(x)", "duckdb": "COS(x)", "databricks": "COS(x)"}},
|
|
292
|
+
{"name": "TAN", "category": "math", "description": "Tangent of angle (radians)",
|
|
293
|
+
"dialects": {"hive": "TAN(x)", "mysql": "TAN(x)", "oracle": "TAN(x)", "tsql": "TAN(x)", "postgres": "TAN(x)", "spark": "TAN(x)", "trino": "TAN(x)", "snowflake": "TAN(x)", "redshift": "TAN(x)", "clickhouse": "tan(x)", "duckdb": "TAN(x)", "databricks": "TAN(x)"}},
|
|
294
|
+
{"name": "ASIN", "category": "math", "description": "Arc sine (inverse sine)",
|
|
295
|
+
"dialects": {"hive": "ASIN(x)", "mysql": "ASIN(x)", "oracle": "ASIN(x)", "tsql": "ASIN(x)", "postgres": "ASIN(x)", "spark": "ASIN(x)", "trino": "ASIN(x)", "snowflake": "ASIN(x)", "redshift": "ASIN(x)", "clickhouse": "asin(x)", "duckdb": "ASIN(x)", "databricks": "ASIN(x)"}},
|
|
296
|
+
{"name": "ACOS", "category": "math", "description": "Arc cosine (inverse cosine)",
|
|
297
|
+
"dialects": {"hive": "ACOS(x)", "mysql": "ACOS(x)", "oracle": "ACOS(x)", "tsql": "ACOS(x)", "postgres": "ACOS(x)", "spark": "ACOS(x)", "trino": "ACOS(x)", "snowflake": "ACOS(x)", "redshift": "ACOS(x)", "clickhouse": "acos(x)", "duckdb": "ACOS(x)", "databricks": "ACOS(x)"}},
|
|
298
|
+
{"name": "ATAN", "category": "math", "description": "Arc tangent (inverse tangent)",
|
|
299
|
+
"dialects": {"hive": "ATAN(x)", "mysql": "ATAN(x)", "oracle": "ATAN(x)", "tsql": "ATAN(x)", "postgres": "ATAN(x)", "spark": "ATAN(x)", "trino": "ATAN(x)", "snowflake": "ATAN(x)", "redshift": "ATAN(x)", "clickhouse": "atan(x)", "duckdb": "ATAN(x)", "databricks": "ATAN(x)"}},
|
|
300
|
+
{"name": "ATAN2", "category": "math", "description": "Arc tangent of y/x",
|
|
301
|
+
"dialects": {"hive": "ATAN2(y, x)", "mysql": "ATAN2(y, x)", "oracle": "ATAN2(y, x)", "tsql": "ATN2(y, x)", "postgres": "ATAN2(y, x)", "spark": "ATAN2(y, x)", "trino": "ATAN2(y, x)", "snowflake": "ATAN2(y, x)", "redshift": "ATAN2(y, x)", "clickhouse": "atan2(y, x)", "duckdb": "ATAN2(y, x)", "databricks": "ATAN2(y, x)"}},
|
|
302
|
+
{"name": "PI", "category": "math", "description": "Mathematical constant PI",
|
|
303
|
+
"dialects": {"hive": "PI()", "mysql": "PI()", "oracle": "ACOS(-1)", "tsql": "PI()", "postgres": "PI()", "spark": "PI()", "trino": "PI()", "snowflake": "PI()", "redshift": "PI()", "clickhouse": "pi()", "duckdb": "PI()", "databricks": "PI()"}},
|
|
304
|
+
{"name": "DEGREES", "category": "math", "description": "Convert radians to degrees",
|
|
305
|
+
"dialects": {"hive": "DEGREES(x)", "mysql": "DEGREES(x)", "oracle": "x * 180 / ACOS(-1)", "tsql": "DEGREES(x)", "postgres": "DEGREES(x)", "spark": "DEGREES(x)", "trino": "DEGREES(x)", "snowflake": "DEGREES(x)", "redshift": "DEGREES(x)", "clickhouse": "degrees(x)", "duckdb": "DEGREES(x)", "databricks": "DEGREES(x)"}},
|
|
306
|
+
{"name": "RADIANS", "category": "math", "description": "Convert degrees to radians",
|
|
307
|
+
"dialects": {"hive": "RADIANS(x)", "mysql": "RADIANS(x)", "oracle": "x * ACOS(-1) / 180", "tsql": "RADIANS(x)", "postgres": "RADIANS(x)", "spark": "RADIANS(x)", "trino": "RADIANS(x)", "snowflake": "RADIANS(x)", "redshift": "RADIANS(x)", "clickhouse": "radians(x)", "duckdb": "RADIANS(x)", "databricks": "RADIANS(x)"}},
|
|
308
|
+
{"name": "LOG2", "category": "math", "description": "Base-2 logarithm",
|
|
309
|
+
"dialects": {"hive": "LOG2(x)", "mysql": "LOG2(x)", "oracle": "LOG(2, x)", "tsql": "LOG(x, 2)", "postgres": "LOG(2, x)", "spark": "LOG2(x)", "trino": "LOG2(x)", "snowflake": "LOG(2, x)", "redshift": "LOG(2, x)", "clickhouse": "log2(x)", "duckdb": "LOG2(x)", "databricks": "LOG2(x)"}},
|
|
310
|
+
{"name": "CBRT", "category": "math", "description": "Cube root",
|
|
311
|
+
"dialects": {"hive": "POWER(x, 1/3)", "mysql": "POWER(x, 1/3)", "oracle": "POWER(x, 1/3)", "tsql": "POWER(x, 1.0/3)", "postgres": "CBRT(x)", "spark": "CBRT(x)", "trino": "CBRT(x)", "snowflake": "CBRT(x)", "redshift": "CBRT(x)", "clickhouse": "cbrt(x)", "duckdb": "CBRT(x)", "databricks": "CBRT(x)"}},
|
|
312
|
+
{"name": "CONVERT", "category": "conversion", "description": "Convert data type (SQL Server style)",
|
|
313
|
+
"dialects": {"hive": "CAST(val AS type)", "mysql": "CONVERT(val, type)", "oracle": "CAST(val AS type)", "tsql": "CONVERT(type, val, style)", "postgres": "CAST(val AS type)", "spark": "CAST(val AS type)", "trino": "CAST(val AS type)", "snowflake": "CONVERT(type, val)", "redshift": "CAST(val AS type)", "clickhouse": "CAST(val AS type)", "duckdb": "CAST(val AS type)", "databricks": "CAST(val AS type)"}},
|
|
314
|
+
{"name": "TRY_CAST", "category": "conversion", "description": "Cast with NULL on failure",
|
|
315
|
+
"dialects": {"hive": "CAST(val AS type)", "mysql": "CAST(val AS type)", "oracle": "CAST(val AS type DEFAULT NULL ON CONVERSION ERROR)", "tsql": "TRY_CAST(val AS type)", "postgres": "N/A (use CASE)", "spark": "TRY_CAST(val AS type)", "trino": "TRY_CAST(val AS type)", "snowflake": "TRY_CAST(val AS type)", "redshift": "N/A", "clickhouse": "toInt32OrNull(val)", "duckdb": "TRY_CAST(val AS type)", "databricks": "TRY_CAST(val AS type)"}},
|
|
316
|
+
{"name": "TO_NUMBER", "category": "conversion", "description": "Convert string to number",
|
|
317
|
+
"dialects": {"hive": "CAST(str AS DECIMAL)", "mysql": "CAST(str AS DECIMAL)", "oracle": "TO_NUMBER(str, format)", "tsql": "CAST(str AS DECIMAL)", "postgres": "TO_NUMBER(str, format)", "spark": "CAST(str AS DECIMAL)", "trino": "CAST(str AS DECIMAL)", "snowflake": "TO_NUMBER(str, format)", "redshift": "TO_NUMBER(str, format)", "clickhouse": "toDecimal64(str, scale)", "duckdb": "CAST(str AS DECIMAL)", "databricks": "CAST(str AS DECIMAL)"}},
|
|
318
|
+
{"name": "TO_CHAR", "category": "conversion", "description": "Convert to formatted string",
|
|
319
|
+
"dialects": {"hive": "CAST(val AS STRING)", "mysql": "CAST(val AS CHAR)", "oracle": "TO_CHAR(val, format)", "tsql": "FORMAT(val, format)", "postgres": "TO_CHAR(val, format)", "spark": "CAST(val AS STRING)", "trino": "CAST(val AS VARCHAR)", "snowflake": "TO_CHAR(val, format)", "redshift": "TO_CHAR(val, format)", "clickhouse": "toString(val)", "duckdb": "CAST(val AS VARCHAR)", "databricks": "CAST(val AS STRING)"}},
|
|
320
|
+
{"name": "PARSE_JSON", "category": "json", "description": "Parse string as JSON",
|
|
321
|
+
"dialects": {"hive": "N/A (strings are JSON)", "mysql": "JSON_EXTRACT(str, '$')", "oracle": "JSON_VALUE(str, '$')", "tsql": "JSON_VALUE(str, '$')", "postgres": "str::json or str::jsonb", "spark": "FROM_JSON(str, schema)", "trino": "JSON_PARSE(str)", "snowflake": "PARSE_JSON(str)", "redshift": "JSON_PARSE(str)", "clickhouse": "N/A", "duckdb": "str::JSON", "databricks": "FROM_JSON(str, schema)"}},
|
|
322
|
+
{"name": "TO_JSON", "category": "json", "description": "Convert value to JSON string",
|
|
323
|
+
"dialects": {"hive": "TO_JSON(val)", "mysql": "JSON_OBJECT(val)", "oracle": "JSON_OBJECT(val)", "tsql": "FOR JSON PATH", "postgres": "TO_JSON(val) or TO_JSONB(val)", "spark": "TO_JSON(val)", "trino": "JSON_FORMAT(val)", "snowflake": "TO_JSON(val)", "redshift": "N/A", "clickhouse": "toJSONString(val)", "duckdb": "TO_JSON(val)", "databricks": "TO_JSON(val)"}},
|
|
324
|
+
{"name": "IIF", "category": "conditional", "description": "Inline if-then-else (SQL Server style)",
|
|
325
|
+
"dialects": {"hive": "IF(cond, true_val, false_val)", "mysql": "IF(cond, true_val, false_val)", "oracle": "CASE WHEN cond THEN true_val ELSE false_val END", "tsql": "IIF(cond, true_val, false_val)", "postgres": "CASE WHEN cond THEN true_val ELSE false_val END", "spark": "IF(cond, true_val, false_val)", "trino": "IF(cond, true_val, false_val)", "snowflake": "IFF(cond, true_val, false_val)", "redshift": "CASE WHEN cond THEN true_val ELSE false_val END", "clickhouse": "if(cond, true_val, false_val)", "duckdb": "IF(cond, true_val, false_val)", "databricks": "IF(cond, true_val, false_val)"}},
|
|
326
|
+
{"name": "CHOOSE", "category": "conditional", "description": "Return value at index position",
|
|
327
|
+
"dialects": {"hive": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "mysql": "ELT(idx, v1, v2, ...)", "oracle": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "tsql": "CHOOSE(idx, v1, v2, ...)", "postgres": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "spark": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "trino": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "snowflake": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "redshift": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "clickhouse": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "duckdb": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END", "databricks": "CASE idx WHEN 1 THEN v1 WHEN 2 THEN v2 ... END"}},
|
|
328
|
+
{"name": "NVL2", "category": "conditional", "description": "Return value based on null check",
|
|
329
|
+
"dialects": {"hive": "IF(val IS NOT NULL, not_null_val, null_val)", "mysql": "IF(val IS NOT NULL, not_null_val, null_val)", "oracle": "NVL2(val, not_null_val, null_val)", "tsql": "CASE WHEN val IS NOT NULL THEN not_null_val ELSE null_val END", "postgres": "CASE WHEN val IS NOT NULL THEN not_null_val ELSE null_val END", "spark": "NVL2(val, not_null_val, null_val)", "trino": "IF(val IS NOT NULL, not_null_val, null_val)", "snowflake": "NVL2(val, not_null_val, null_val)", "redshift": "NVL2(val, not_null_val, null_val)", "clickhouse": "if(val IS NOT NULL, not_null_val, null_val)", "duckdb": "CASE WHEN val IS NOT NULL THEN not_null_val ELSE null_val END", "databricks": "NVL2(val, not_null_val, null_val)"}},
|
|
330
|
+
{"name": "ZEROIFNULL", "category": "conditional", "description": "Return 0 if value is NULL",
|
|
331
|
+
"dialects": {"hive": "COALESCE(val, 0)", "mysql": "IFNULL(val, 0)", "oracle": "NVL(val, 0)", "tsql": "ISNULL(val, 0)", "postgres": "COALESCE(val, 0)", "spark": "COALESCE(val, 0)", "trino": "COALESCE(val, 0)", "snowflake": "ZEROIFNULL(val)", "redshift": "NVL(val, 0)", "clickhouse": "ifNull(val, 0)", "duckdb": "COALESCE(val, 0)", "databricks": "COALESCE(val, 0)"}},
|
|
332
|
+
{"name": "CHAR_LENGTH", "category": "string", "description": "Character length of string",
|
|
333
|
+
"dialects": {"hive": "CHAR_LENGTH(str)", "mysql": "CHAR_LENGTH(str)", "oracle": "LENGTH(str)", "tsql": "LEN(str)", "postgres": "CHAR_LENGTH(str)", "spark": "CHAR_LENGTH(str)", "trino": "CHAR_LENGTH(str)", "snowflake": "CHAR_LENGTH(str)", "redshift": "CHAR_LENGTH(str)", "clickhouse": "char_length(str)", "duckdb": "CHAR_LENGTH(str)", "databricks": "CHAR_LENGTH(str)"}},
|
|
334
|
+
{"name": "OCTET_LENGTH", "category": "string", "description": "Byte length of string",
|
|
335
|
+
"dialects": {"hive": "OCTET_LENGTH(str)", "mysql": "OCTET_LENGTH(str)", "oracle": "LENGTHB(str)", "tsql": "DATALENGTH(str)", "postgres": "OCTET_LENGTH(str)", "spark": "OCTET_LENGTH(str)", "trino": "LENGTH(str)", "snowflake": "OCTET_LENGTH(str)", "redshift": "OCTET_LENGTH(str)", "clickhouse": "length(str)", "duckdb": "OCTET_LENGTH(str)", "databricks": "OCTET_LENGTH(str)"}},
|
|
336
|
+
{"name": "UUID", "category": "system", "description": "Generate UUID",
|
|
337
|
+
"dialects": {"hive": "UUID()", "mysql": "UUID()", "oracle": "SYS_GUID()", "tsql": "NEWID()", "postgres": "GEN_RANDOM_UUID()", "spark": "UUID()", "trino": "UUID()", "snowflake": "UUID_STRING()", "redshift": "N/A", "clickhouse": "generateUUIDv4()", "duckdb": "UUID()", "databricks": "UUID()"}},
|
|
338
|
+
{"name": "VERSION", "category": "system", "description": "Database version",
|
|
339
|
+
"dialects": {"hive": "VERSION()", "mysql": "VERSION()", "oracle": "SELECT * FROM V$VERSION", "tsql": "@@VERSION", "postgres": "VERSION()", "spark": "VERSION()", "trino": "N/A", "snowflake": "CURRENT_VERSION()", "redshift": "VERSION()", "clickhouse": "version()", "duckdb": "VERSION()", "databricks": "VERSION()"}},
|
|
340
|
+
{"name": "DATABASE", "category": "system", "description": "Current database name",
|
|
341
|
+
"dialects": {"hive": "CURRENT_DATABASE()", "mysql": "DATABASE()", "oracle": "SYS_CONTEXT('USERENV', 'DB_NAME')", "tsql": "DB_NAME()", "postgres": "CURRENT_DATABASE()", "spark": "CURRENT_DATABASE()", "trino": "CURRENT_CATALOG", "snowflake": "CURRENT_DATABASE()", "redshift": "CURRENT_DATABASE()", "clickhouse": "currentDatabase()", "duckdb": "CURRENT_DATABASE()", "databricks": "CURRENT_DATABASE()"}},
|
|
342
|
+
{"name": "CURRENT_USER", "category": "system", "description": "Current user name",
|
|
343
|
+
"dialects": {"hive": "CURRENT_USER()", "mysql": "CURRENT_USER()", "oracle": "USER", "tsql": "CURRENT_USER", "postgres": "CURRENT_USER", "spark": "CURRENT_USER()", "trino": "CURRENT_USER", "snowflake": "CURRENT_USER()", "redshift": "CURRENT_USER", "clickhouse": "currentUser()", "duckdb": "CURRENT_USER", "databricks": "CURRENT_USER()"}},
|
|
344
|
+
{"name": "JSON_LENGTH", "category": "json", "description": "Get length of JSON array/object",
|
|
345
|
+
"dialects": {"hive": "SIZE(FROM_JSON(json, 'array<string>'))", "mysql": "JSON_LENGTH(json)", "oracle": "JSON_QUERY(json, '$.size()')", "tsql": "(SELECT COUNT(*) FROM OPENJSON(json))", "postgres": "JSON_ARRAY_LENGTH(json)", "spark": "SIZE(FROM_JSON(json, schema))", "trino": "JSON_ARRAY_LENGTH(json)", "snowflake": "ARRAY_SIZE(PARSE_JSON(json))", "redshift": "JSON_ARRAY_LENGTH(json)", "clickhouse": "JSONLength(json)", "duckdb": "JSON_ARRAY_LENGTH(json)", "databricks": "SIZE(FROM_JSON(json, schema))"}},
|
|
346
|
+
{"name": "JSON_VALID", "category": "json", "description": "Check if string is valid JSON",
|
|
347
|
+
"dialects": {"hive": "N/A", "mysql": "JSON_VALID(str)", "oracle": "N/A (use JSON_VALUE with error handling)", "tsql": "ISJSON(str)", "postgres": "str::jsonb IS NOT NULL", "spark": "N/A", "trino": "N/A", "snowflake": "TRY_PARSE_JSON(str) IS NOT NULL", "redshift": "IS_VALID_JSON(str)", "clickhouse": "isValidJSON(str)", "duckdb": "N/A", "databricks": "N/A"}},
|
|
348
|
+
{"name": "JSON_TYPE", "category": "json", "description": "Get type of JSON value",
|
|
349
|
+
"dialects": {"hive": "N/A", "mysql": "JSON_TYPE(json)", "oracle": "N/A", "tsql": "N/A", "postgres": "JSON_TYPEOF(json)", "spark": "N/A", "trino": "N/A", "snowflake": "TYPEOF(PARSE_JSON(json))", "redshift": "JSON_TYPEOF(json)", "clickhouse": "JSONType(json)", "duckdb": "JSON_TYPE(json)", "databricks": "N/A"}},
|
|
350
|
+
{"name": "JSON_DEPTH", "category": "json", "description": "Get maximum depth of JSON",
|
|
351
|
+
"dialects": {"hive": "N/A", "mysql": "JSON_DEPTH(json)", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "N/A", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "N/A"}},
|
|
352
|
+
{"name": "JSON_MERGE", "category": "json", "description": "Merge JSON documents",
|
|
353
|
+
"dialects": {"hive": "N/A", "mysql": "JSON_MERGE_PATCH(json1, json2)", "oracle": "JSON_MERGEPATCH(json1, json2)", "tsql": "N/A", "postgres": "json1 || json2", "spark": "N/A", "trino": "N/A", "snowflake": "OBJECT_INSERT(json1, key, val)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "json1 || json2", "databricks": "N/A"}},
|
|
354
|
+
{"name": "JSON_ARRAYAGG", "category": "aggregate", "description": "Aggregate values into JSON array",
|
|
355
|
+
"dialects": {"hive": "TO_JSON(COLLECT_LIST(col))", "mysql": "JSON_ARRAYAGG(col)", "oracle": "JSON_ARRAYAGG(col)", "tsql": "N/A (use FOR JSON)", "postgres": "JSON_AGG(col)", "spark": "TO_JSON(COLLECT_LIST(col))", "trino": "N/A", "snowflake": "ARRAY_AGG(col)", "redshift": "N/A", "clickhouse": "groupArray(col)", "duckdb": "JSON_GROUP_ARRAY(col)", "databricks": "TO_JSON(COLLECT_LIST(col))"}},
|
|
356
|
+
{"name": "JSON_OBJECTAGG", "category": "aggregate", "description": "Aggregate key-value pairs into JSON object",
|
|
357
|
+
"dialects": {"hive": "N/A", "mysql": "JSON_OBJECTAGG(key, val)", "oracle": "JSON_OBJECTAGG(key VALUE val)", "tsql": "N/A", "postgres": "JSON_OBJECT_AGG(key, val)", "spark": "N/A", "trino": "N/A", "snowflake": "OBJECT_AGG(key, val)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "JSON_GROUP_OBJECT(key, val)", "databricks": "N/A"}},
|
|
358
|
+
{"name": "ARRAY_LENGTH", "category": "array", "description": "Get length of array",
|
|
359
|
+
"dialects": {"hive": "SIZE(arr)", "mysql": "JSON_LENGTH(arr)", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY_LENGTH(arr, 1)", "spark": "SIZE(arr)", "trino": "CARDINALITY(arr)", "snowflake": "ARRAY_SIZE(arr)", "redshift": "N/A", "clickhouse": "length(arr)", "duckdb": "ARRAY_LENGTH(arr)", "databricks": "SIZE(arr)"}},
|
|
360
|
+
{"name": "ARRAY_REMOVE", "category": "array", "description": "Remove element from array",
|
|
361
|
+
"dialects": {"hive": "ARRAY_REMOVE(arr, val)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY_REMOVE(arr, val)", "spark": "ARRAY_REMOVE(arr, val)", "trino": "ARRAY_REMOVE(arr, val)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayFilter(x -> x != val, arr)", "duckdb": "ARRAY_FILTER(arr, x -> x != val)", "databricks": "ARRAY_REMOVE(arr, val)"}},
|
|
362
|
+
{"name": "ARRAY_REVERSE", "category": "array", "description": "Reverse array elements",
|
|
363
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A (use generate_series)", "spark": "REVERSE(arr)", "trino": "REVERSE(arr)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayReverse(arr)", "duckdb": "ARRAY_REVERSE(arr)", "databricks": "REVERSE(arr)"}},
|
|
364
|
+
{"name": "ARRAY_UNION", "category": "array", "description": "Union of two arrays (unique)",
|
|
365
|
+
"dialects": {"hive": "ARRAY_UNION(arr1, arr2)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY(SELECT DISTINCT UNNEST(arr1 || arr2))", "spark": "ARRAY_UNION(arr1, arr2)", "trino": "ARRAY_UNION(arr1, arr2)", "snowflake": "ARRAY_DISTINCT(ARRAY_CAT(arr1, arr2))", "redshift": "N/A", "clickhouse": "arrayDistinct(arrayConcat(arr1, arr2))", "duckdb": "ARRAY_DISTINCT(arr1 || arr2)", "databricks": "ARRAY_UNION(arr1, arr2)"}},
|
|
366
|
+
{"name": "ARRAY_INTERSECT", "category": "array", "description": "Intersection of two arrays",
|
|
367
|
+
"dialects": {"hive": "ARRAY_INTERSECT(arr1, arr2)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY(SELECT UNNEST(arr1) INTERSECT SELECT UNNEST(arr2))", "spark": "ARRAY_INTERSECT(arr1, arr2)", "trino": "ARRAY_INTERSECT(arr1, arr2)", "snowflake": "ARRAY_INTERSECTION(arr1, arr2)", "redshift": "N/A", "clickhouse": "arrayIntersect(arr1, arr2)", "duckdb": "N/A", "databricks": "ARRAY_INTERSECT(arr1, arr2)"}},
|
|
368
|
+
{"name": "ARRAY_EXCEPT", "category": "array", "description": "Difference of two arrays",
|
|
369
|
+
"dialects": {"hive": "ARRAY_EXCEPT(arr1, arr2)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY(SELECT UNNEST(arr1) EXCEPT SELECT UNNEST(arr2))", "spark": "ARRAY_EXCEPT(arr1, arr2)", "trino": "ARRAY_EXCEPT(arr1, arr2)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayDifference(arr1, arr2)", "duckdb": "N/A", "databricks": "ARRAY_EXCEPT(arr1, arr2)"}},
|
|
370
|
+
{"name": "BIT_XOR", "category": "aggregate", "description": "Bitwise XOR aggregate",
|
|
371
|
+
"dialects": {"hive": "N/A", "mysql": "BIT_XOR(col)", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "BIT_XOR(col)", "trino": "BITWISE_XOR_AGG(col)", "snowflake": "BITXOR_AGG(col)", "redshift": "N/A", "clickhouse": "groupBitXor(col)", "duckdb": "BIT_XOR(col)", "databricks": "BIT_XOR(col)"}},
|
|
372
|
+
{"name": "BITWISE_NOT", "category": "math", "description": "Bitwise NOT operation",
|
|
373
|
+
"dialects": {"hive": "~n", "mysql": "~n", "oracle": "N/A", "tsql": "~n", "postgres": "~n", "spark": "~n", "trino": "BITWISE_NOT(n)", "snowflake": "BITNOT(n)", "redshift": "~n", "clickhouse": "bitNot(n)", "duckdb": "~n", "databricks": "~n"}},
|
|
374
|
+
{"name": "BITWISE_AND", "category": "math", "description": "Bitwise AND operation",
|
|
375
|
+
"dialects": {"hive": "a & b", "mysql": "a & b", "oracle": "BITAND(a, b)", "tsql": "a & b", "postgres": "a & b", "spark": "a & b", "trino": "BITWISE_AND(a, b)", "snowflake": "BITAND(a, b)", "redshift": "a & b", "clickhouse": "bitAnd(a, b)", "duckdb": "a & b", "databricks": "a & b"}},
|
|
376
|
+
{"name": "BITWISE_OR", "category": "math", "description": "Bitwise OR operation",
|
|
377
|
+
"dialects": {"hive": "a | b", "mysql": "a | b", "oracle": "N/A (use BITOR UDF)", "tsql": "a | b", "postgres": "a | b", "spark": "a | b", "trino": "BITWISE_OR(a, b)", "snowflake": "BITOR(a, b)", "redshift": "a | b", "clickhouse": "bitOr(a, b)", "duckdb": "a | b", "databricks": "a | b"}},
|
|
378
|
+
{"name": "BITWISE_XOR", "category": "math", "description": "Bitwise XOR operation",
|
|
379
|
+
"dialects": {"hive": "a ^ b", "mysql": "a ^ b", "oracle": "N/A", "tsql": "a ^ b", "postgres": "a # b", "spark": "a ^ b", "trino": "BITWISE_XOR(a, b)", "snowflake": "BITXOR(a, b)", "redshift": "a # b", "clickhouse": "bitXor(a, b)", "duckdb": "XOR(a, b)", "databricks": "a ^ b"}},
|
|
380
|
+
{"name": "SHIFTLEFT", "category": "math", "description": "Bit shift left",
|
|
381
|
+
"dialects": {"hive": "SHIFTLEFT(n, bits)", "mysql": "n << bits", "oracle": "N/A", "tsql": "N/A", "postgres": "n << bits", "spark": "SHIFTLEFT(n, bits)", "trino": "BITWISE_LEFT_SHIFT(n, bits)", "snowflake": "BITSHIFTLEFT(n, bits)", "redshift": "n << bits", "clickhouse": "bitShiftLeft(n, bits)", "duckdb": "n << bits", "databricks": "SHIFTLEFT(n, bits)"}},
|
|
382
|
+
{"name": "SHIFTRIGHT", "category": "math", "description": "Bit shift right",
|
|
383
|
+
"dialects": {"hive": "SHIFTRIGHT(n, bits)", "mysql": "n >> bits", "oracle": "N/A", "tsql": "N/A", "postgres": "n >> bits", "spark": "SHIFTRIGHT(n, bits)", "trino": "BITWISE_RIGHT_SHIFT(n, bits)", "snowflake": "BITSHIFTRIGHT(n, bits)", "redshift": "n >> bits", "clickhouse": "bitShiftRight(n, bits)", "duckdb": "n >> bits", "databricks": "SHIFTRIGHT(n, bits)"}},
|
|
384
|
+
{"name": "BIT_COUNT", "category": "math", "description": "Count set bits in number",
|
|
385
|
+
"dialects": {"hive": "N/A", "mysql": "BIT_COUNT(n)", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "BIT_COUNT(n)", "trino": "BIT_COUNT(n, bits)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "bitCount(n)", "duckdb": "BIT_COUNT(n)", "databricks": "BIT_COUNT(n)"}},
|
|
386
|
+
{"name": "ANY_VALUE", "category": "aggregate", "description": "Return any value from group",
|
|
387
|
+
"dialects": {"hive": "FIRST_VALUE(col)", "mysql": "ANY_VALUE(col)", "oracle": "ANY_VALUE(col)", "tsql": "N/A (use TOP 1)", "postgres": "N/A (use DISTINCT ON)", "spark": "ANY_VALUE(col)", "trino": "ARBITRARY(col)", "snowflake": "ANY_VALUE(col)", "redshift": "N/A", "clickhouse": "any(col)", "duckdb": "ANY_VALUE(col)", "databricks": "ANY_VALUE(col)"}},
|
|
388
|
+
{"name": "EVERY", "category": "aggregate", "description": "True if all values are true",
|
|
389
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "EVERY(cond) or BOOL_AND(cond)", "spark": "EVERY(cond)", "trino": "EVERY(cond)", "snowflake": "BOOLAND_AGG(cond)", "redshift": "BOOL_AND(cond)", "clickhouse": "N/A", "duckdb": "EVERY(cond)", "databricks": "EVERY(cond)"}},
|
|
390
|
+
{"name": "REGR_SLOPE", "category": "aggregate", "description": "Slope of linear regression",
|
|
391
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "REGR_SLOPE(y, x)", "tsql": "N/A", "postgres": "REGR_SLOPE(y, x)", "spark": "N/A", "trino": "REGR_SLOPE(y, x)", "snowflake": "REGR_SLOPE(y, x)", "redshift": "REGR_SLOPE(y, x)", "clickhouse": "N/A", "duckdb": "REGR_SLOPE(y, x)", "databricks": "N/A"}},
|
|
392
|
+
{"name": "REGR_INTERCEPT", "category": "aggregate", "description": "Y-intercept of linear regression",
|
|
393
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "REGR_INTERCEPT(y, x)", "tsql": "N/A", "postgres": "REGR_INTERCEPT(y, x)", "spark": "N/A", "trino": "REGR_INTERCEPT(y, x)", "snowflake": "REGR_INTERCEPT(y, x)", "redshift": "REGR_INTERCEPT(y, x)", "clickhouse": "N/A", "duckdb": "REGR_INTERCEPT(y, x)", "databricks": "N/A"}},
|
|
394
|
+
{"name": "REGR_R2", "category": "aggregate", "description": "R-squared of linear regression",
|
|
395
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "REGR_R2(y, x)", "tsql": "N/A", "postgres": "REGR_R2(y, x)", "spark": "N/A", "trino": "REGR_R2(y, x)", "snowflake": "REGR_R2(y, x)", "redshift": "REGR_R2(y, x)", "clickhouse": "N/A", "duckdb": "REGR_R2(y, x)", "databricks": "N/A"}},
|
|
396
|
+
{"name": "COVAR_SAMP", "category": "aggregate", "description": "Sample covariance",
|
|
397
|
+
"dialects": {"hive": "COVAR_SAMP(col1, col2)", "mysql": "N/A", "oracle": "COVAR_SAMP(col1, col2)", "tsql": "N/A", "postgres": "COVAR_SAMP(col1, col2)", "spark": "COVAR_SAMP(col1, col2)", "trino": "COVAR_SAMP(col1, col2)", "snowflake": "COVAR_SAMP(col1, col2)", "redshift": "COVAR_SAMP(col1, col2)", "clickhouse": "covarSamp(col1, col2)", "duckdb": "COVAR_SAMP(col1, col2)", "databricks": "COVAR_SAMP(col1, col2)"}},
|
|
398
|
+
{"name": "STDDEV_POP", "category": "aggregate", "description": "Population standard deviation",
|
|
399
|
+
"dialects": {"hive": "STDDEV_POP(col)", "mysql": "STDDEV_POP(col)", "oracle": "STDDEV_POP(col)", "tsql": "STDEVP(col)", "postgres": "STDDEV_POP(col)", "spark": "STDDEV_POP(col)", "trino": "STDDEV_POP(col)", "snowflake": "STDDEV_POP(col)", "redshift": "STDDEV_POP(col)", "clickhouse": "stddevPop(col)", "duckdb": "STDDEV_POP(col)", "databricks": "STDDEV_POP(col)"}},
|
|
400
|
+
{"name": "STDDEV_SAMP", "category": "aggregate", "description": "Sample standard deviation",
|
|
401
|
+
"dialects": {"hive": "STDDEV_SAMP(col)", "mysql": "STDDEV_SAMP(col)", "oracle": "STDDEV_SAMP(col)", "tsql": "STDEV(col)", "postgres": "STDDEV_SAMP(col)", "spark": "STDDEV_SAMP(col)", "trino": "STDDEV_SAMP(col)", "snowflake": "STDDEV_SAMP(col)", "redshift": "STDDEV_SAMP(col)", "clickhouse": "stddevSamp(col)", "duckdb": "STDDEV_SAMP(col)", "databricks": "STDDEV_SAMP(col)"}},
|
|
402
|
+
{"name": "VAR_POP", "category": "aggregate", "description": "Population variance",
|
|
403
|
+
"dialects": {"hive": "VAR_POP(col)", "mysql": "VAR_POP(col)", "oracle": "VAR_POP(col)", "tsql": "VARP(col)", "postgres": "VAR_POP(col)", "spark": "VAR_POP(col)", "trino": "VAR_POP(col)", "snowflake": "VAR_POP(col)", "redshift": "VAR_POP(col)", "clickhouse": "varPop(col)", "duckdb": "VAR_POP(col)", "databricks": "VAR_POP(col)"}},
|
|
404
|
+
{"name": "VAR_SAMP", "category": "aggregate", "description": "Sample variance",
|
|
405
|
+
"dialects": {"hive": "VAR_SAMP(col)", "mysql": "VAR_SAMP(col)", "oracle": "VAR_SAMP(col)", "tsql": "VAR(col)", "postgres": "VAR_SAMP(col)", "spark": "VAR_SAMP(col)", "trino": "VAR_SAMP(col)", "snowflake": "VAR_SAMP(col)", "redshift": "VAR_SAMP(col)", "clickhouse": "varSamp(col)", "duckdb": "VAR_SAMP(col)", "databricks": "VAR_SAMP(col)"}},
|
|
406
|
+
{"name": "LEVENSHTEIN", "category": "string", "description": "Levenshtein edit distance",
|
|
407
|
+
"dialects": {"hive": "LEVENSHTEIN(str1, str2)", "mysql": "N/A", "oracle": "UTL_MATCH.EDIT_DISTANCE(str1, str2)", "tsql": "N/A", "postgres": "LEVENSHTEIN(str1, str2)", "spark": "LEVENSHTEIN(str1, str2)", "trino": "LEVENSHTEIN_DISTANCE(str1, str2)", "snowflake": "EDITDISTANCE(str1, str2)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "LEVENSHTEIN(str1, str2)", "databricks": "LEVENSHTEIN(str1, str2)"}},
|
|
408
|
+
{"name": "PARSE_URL", "category": "string", "description": "Extract component from URL",
|
|
409
|
+
"dialects": {"hive": "PARSE_URL(url, 'HOST')", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "PARSE_URL(url, 'HOST')", "trino": "URL_EXTRACT_HOST(url)", "snowflake": "PARSE_URL(url):host", "redshift": "N/A", "clickhouse": "domain(url)", "duckdb": "N/A", "databricks": "PARSE_URL(url, 'HOST')"}},
|
|
410
|
+
{"name": "URL_ENCODE", "category": "string", "description": "URL encode string",
|
|
411
|
+
"dialects": {"hive": "REFLECT('java.net.URLEncoder', 'encode', str, 'UTF-8')", "mysql": "N/A", "oracle": "UTL_URL.ESCAPE(str)", "tsql": "N/A", "postgres": "N/A", "spark": "N/A", "trino": "URL_ENCODE(str)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "encodeURLComponent(str)", "duckdb": "N/A", "databricks": "N/A"}},
|
|
412
|
+
{"name": "URL_DECODE", "category": "string", "description": "URL decode string",
|
|
413
|
+
"dialects": {"hive": "REFLECT('java.net.URLDecoder', 'decode', str, 'UTF-8')", "mysql": "N/A", "oracle": "UTL_URL.UNESCAPE(str)", "tsql": "N/A", "postgres": "N/A", "spark": "N/A", "trino": "URL_DECODE(str)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "decodeURLComponent(str)", "duckdb": "N/A", "databricks": "N/A"}},
|
|
414
|
+
{"name": "SHA256", "category": "string", "description": "SHA-256 hash of string",
|
|
415
|
+
"dialects": {"hive": "SHA2(str, 256)", "mysql": "SHA2(str, 256)", "oracle": "RAWTOHEX(DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW(str), 4))", "tsql": "HASHBYTES('SHA2_256', str)", "postgres": "ENCODE(DIGEST(str, 'sha256'), 'hex')", "spark": "SHA2(str, 256)", "trino": "SHA256(str)", "snowflake": "SHA2(str, 256)", "redshift": "SHA2(str, 256)", "clickhouse": "SHA256(str)", "duckdb": "SHA256(str)", "databricks": "SHA2(str, 256)"}},
|
|
416
|
+
{"name": "CRC32", "category": "string", "description": "CRC32 checksum",
|
|
417
|
+
"dialects": {"hive": "CRC32(str)", "mysql": "CRC32(str)", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "CRC32(str)", "trino": "CRC32(str)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "CRC32(str)", "duckdb": "N/A", "databricks": "CRC32(str)"}},
|
|
418
|
+
{"name": "PRINTF", "category": "string", "description": "Format string with placeholders",
|
|
419
|
+
"dialects": {"hive": "PRINTF(format, args...)", "mysql": "N/A", "oracle": "N/A", "tsql": "FORMATMESSAGE(format, args...)", "postgres": "FORMAT(format, args...)", "spark": "PRINTF(format, args...)", "trino": "FORMAT(format, args...)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "printf(format, args...)", "duckdb": "PRINTF(format, args...)", "databricks": "PRINTF(format, args...)"}},
|
|
420
|
+
{"name": "NEXT_DAY", "category": "date", "description": "Next occurrence of weekday",
|
|
421
|
+
"dialects": {"hive": "NEXT_DAY(date, 'MON')", "mysql": "N/A", "oracle": "NEXT_DAY(date, 'MONDAY')", "tsql": "DATEADD(day, (DATEDIFF(day, 0, date) / 7 + 1) * 7 - DATEDIFF(day, 0, date), date)", "postgres": "date + (7 - EXTRACT(DOW FROM date) + dow)::INT % 7", "spark": "NEXT_DAY(date, 'MON')", "trino": "N/A", "snowflake": "NEXT_DAY(date, 'MO')", "redshift": "NEXT_DAY(date, 'monday')", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "NEXT_DAY(date, 'MON')"}},
|
|
422
|
+
{"name": "DATE_PART", "category": "date", "description": "Extract part of date (PostgreSQL style)",
|
|
423
|
+
"dialects": {"hive": "EXTRACT(part FROM date)", "mysql": "EXTRACT(part FROM date)", "oracle": "EXTRACT(part FROM date)", "tsql": "DATEPART(part, date)", "postgres": "DATE_PART('part', date)", "spark": "DATE_PART('part', date)", "trino": "DATE_PART('part', date)", "snowflake": "DATE_PART(part, date)", "redshift": "DATE_PART(part, date)", "clickhouse": "toYear/toMonth/toDay(date)", "duckdb": "DATE_PART('part', date)", "databricks": "DATE_PART('part', date)"}},
|
|
424
|
+
{"name": "DAYOFYEAR", "category": "date", "description": "Day of year (1-366)",
|
|
425
|
+
"dialects": {"hive": "DAYOFYEAR(date)", "mysql": "DAYOFYEAR(date)", "oracle": "TO_NUMBER(TO_CHAR(date, 'DDD'))", "tsql": "DATEPART(dayofyear, date)", "postgres": "EXTRACT(DOY FROM date)", "spark": "DAYOFYEAR(date)", "trino": "DAY_OF_YEAR(date)", "snowflake": "DAYOFYEAR(date)", "redshift": "EXTRACT(DOY FROM date)", "clickhouse": "toDayOfYear(date)", "duckdb": "DAYOFYEAR(date)", "databricks": "DAYOFYEAR(date)"}},
|
|
426
|
+
{"name": "DAYOFMONTH", "category": "date", "description": "Day of month (1-31)",
|
|
427
|
+
"dialects": {"hive": "DAYOFMONTH(date)", "mysql": "DAYOFMONTH(date)", "oracle": "EXTRACT(DAY FROM date)", "tsql": "DAY(date)", "postgres": "EXTRACT(DAY FROM date)", "spark": "DAYOFMONTH(date)", "trino": "DAY_OF_MONTH(date)", "snowflake": "DAYOFMONTH(date)", "redshift": "EXTRACT(DAY FROM date)", "clickhouse": "toDayOfMonth(date)", "duckdb": "DAYOFMONTH(date)", "databricks": "DAYOFMONTH(date)"}},
|
|
428
|
+
{"name": "TIMESTAMPADD", "category": "date", "description": "Add interval to timestamp",
|
|
429
|
+
"dialects": {"hive": "date + INTERVAL n unit", "mysql": "TIMESTAMPADD(unit, n, ts)", "oracle": "ts + INTERVAL 'n' unit", "tsql": "DATEADD(unit, n, ts)", "postgres": "ts + INTERVAL 'n unit'", "spark": "TIMESTAMPADD(unit, n, ts)", "trino": "DATE_ADD(unit, n, ts)", "snowflake": "TIMESTAMPADD(unit, n, ts)", "redshift": "DATEADD(unit, n, ts)", "clickhouse": "addSeconds/addMinutes/addHours(ts, n)", "duckdb": "ts + INTERVAL n unit", "databricks": "TIMESTAMPADD(unit, n, ts)"}},
|
|
430
|
+
{"name": "TIMESTAMPDIFF", "category": "date", "description": "Difference between timestamps",
|
|
431
|
+
"dialects": {"hive": "DATEDIFF(ts1, ts2)", "mysql": "TIMESTAMPDIFF(unit, ts1, ts2)", "oracle": "ts2 - ts1", "tsql": "DATEDIFF(unit, ts1, ts2)", "postgres": "EXTRACT(EPOCH FROM ts2 - ts1)", "spark": "TIMESTAMPDIFF(unit, ts1, ts2)", "trino": "DATE_DIFF(unit, ts1, ts2)", "snowflake": "TIMESTAMPDIFF(unit, ts1, ts2)", "redshift": "DATEDIFF(unit, ts1, ts2)", "clickhouse": "dateDiff('unit', ts1, ts2)", "duckdb": "DATE_DIFF('unit', ts1, ts2)", "databricks": "TIMESTAMPDIFF(unit, ts1, ts2)"}},
|
|
432
|
+
{"name": "EOMONTH", "category": "date", "description": "End of month date",
|
|
433
|
+
"dialects": {"hive": "LAST_DAY(date)", "mysql": "LAST_DAY(date)", "oracle": "LAST_DAY(date)", "tsql": "EOMONTH(date)", "postgres": "(DATE_TRUNC('month', date) + INTERVAL '1 month - 1 day')::DATE", "spark": "LAST_DAY(date)", "trino": "LAST_DAY_OF_MONTH(date)", "snowflake": "LAST_DAY(date)", "redshift": "LAST_DAY(date)", "clickhouse": "toLastDayOfMonth(date)", "duckdb": "LAST_DAY(date)", "databricks": "LAST_DAY(date)"}},
|
|
434
|
+
{"name": "ARRAY_MAX", "category": "array", "description": "Maximum value in array",
|
|
435
|
+
"dialects": {"hive": "ARRAY_MAX(arr)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "(SELECT MAX(x) FROM UNNEST(arr) x)", "spark": "ARRAY_MAX(arr)", "trino": "ARRAY_MAX(arr)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayMax(arr)", "duckdb": "ARRAY_MAX(arr)", "databricks": "ARRAY_MAX(arr)"}},
|
|
436
|
+
{"name": "ARRAY_MIN", "category": "array", "description": "Minimum value in array",
|
|
437
|
+
"dialects": {"hive": "ARRAY_MIN(arr)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "(SELECT MIN(x) FROM UNNEST(arr) x)", "spark": "ARRAY_MIN(arr)", "trino": "ARRAY_MIN(arr)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayMin(arr)", "duckdb": "ARRAY_MIN(arr)", "databricks": "ARRAY_MIN(arr)"}},
|
|
438
|
+
{"name": "ARRAY_SUM", "category": "array", "description": "Sum of array elements",
|
|
439
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "(SELECT SUM(x) FROM UNNEST(arr) x)", "spark": "AGGREGATE(arr, 0, (acc, x) -> acc + x)", "trino": "REDUCE(arr, 0, (s, x) -> s + x, s -> s)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arraySum(arr)", "duckdb": "LIST_SUM(arr)", "databricks": "AGGREGATE(arr, 0, (acc, x) -> acc + x)"}},
|
|
440
|
+
{"name": "ARRAY_AVG", "category": "array", "description": "Average of array elements",
|
|
441
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "(SELECT AVG(x) FROM UNNEST(arr) x)", "spark": "AGGREGATE(arr, (0D, 0L), (acc, x) -> (acc._1 + x, acc._2 + 1), acc -> acc._1 / acc._2)", "trino": "REDUCE(arr, CAST(ROW(0, 0) AS ROW(sum DOUBLE, cnt BIGINT)), ...)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayAvg(arr)", "duckdb": "LIST_AVG(arr)", "databricks": "N/A"}},
|
|
442
|
+
{"name": "ARRAY_FILTER", "category": "array", "description": "Filter array elements",
|
|
443
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY(SELECT x FROM UNNEST(arr) x WHERE condition)", "spark": "FILTER(arr, x -> condition)", "trino": "FILTER(arr, x -> condition)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayFilter(x -> condition, arr)", "duckdb": "ARRAY_FILTER(arr, x -> condition)", "databricks": "FILTER(arr, x -> condition)"}},
|
|
444
|
+
{"name": "ARRAY_TRANSFORM", "category": "array", "description": "Transform array elements",
|
|
445
|
+
"dialects": {"hive": "TRANSFORM(arr, x -> expr)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY(SELECT expr FROM UNNEST(arr) x)", "spark": "TRANSFORM(arr, x -> expr)", "trino": "TRANSFORM(arr, x -> expr)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayMap(x -> expr, arr)", "duckdb": "ARRAY_TRANSFORM(arr, x -> expr)", "databricks": "TRANSFORM(arr, x -> expr)"}},
|
|
446
|
+
{"name": "FLATTEN", "category": "array", "description": "Flatten nested array",
|
|
447
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "FLATTEN(arr)", "trino": "FLATTEN(arr)", "snowflake": "FLATTEN(arr)", "redshift": "N/A", "clickhouse": "arrayFlatten(arr)", "duckdb": "FLATTEN(arr)", "databricks": "FLATTEN(arr)"}},
|
|
448
|
+
{"name": "SEQUENCE", "category": "array", "description": "Generate sequence array",
|
|
449
|
+
"dialects": {"hive": "SEQUENCE(start, end, step)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY(SELECT generate_series(start, end, step))", "spark": "SEQUENCE(start, end, step)", "trino": "SEQUENCE(start, end, step)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "range(start, end, step)", "duckdb": "GENERATE_SERIES(start, end, step)", "databricks": "SEQUENCE(start, end, step)"}},
|
|
450
|
+
{"name": "CURRENT_SCHEMA", "category": "system", "description": "Current schema name",
|
|
451
|
+
"dialects": {"hive": "CURRENT_DATABASE()", "mysql": "DATABASE()", "oracle": "SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA')", "tsql": "SCHEMA_NAME()", "postgres": "CURRENT_SCHEMA()", "spark": "CURRENT_DATABASE()", "trino": "CURRENT_SCHEMA", "snowflake": "CURRENT_SCHEMA()", "redshift": "CURRENT_SCHEMA()", "clickhouse": "currentDatabase()", "duckdb": "CURRENT_SCHEMA()", "databricks": "CURRENT_DATABASE()"}},
|
|
452
|
+
{"name": "SESSION_USER", "category": "system", "description": "Session user name",
|
|
453
|
+
"dialects": {"hive": "CURRENT_USER()", "mysql": "SESSION_USER()", "oracle": "SYS_CONTEXT('USERENV', 'SESSION_USER')", "tsql": "SESSION_USER", "postgres": "SESSION_USER", "spark": "CURRENT_USER()", "trino": "N/A", "snowflake": "CURRENT_USER()", "redshift": "SESSION_USER", "clickhouse": "currentUser()", "duckdb": "SESSION_USER", "databricks": "CURRENT_USER()"}},
|
|
454
|
+
{"name": "TYPEOF", "category": "system", "description": "Get data type of expression",
|
|
455
|
+
"dialects": {"hive": "TYPEOF(expr)", "mysql": "N/A", "oracle": "DUMP(expr)", "tsql": "SQL_VARIANT_PROPERTY(expr, 'BaseType')", "postgres": "PG_TYPEOF(expr)", "spark": "TYPEOF(expr)", "trino": "TYPEOF(expr)", "snowflake": "TYPEOF(expr)", "redshift": "N/A", "clickhouse": "toTypeName(expr)", "duckdb": "TYPEOF(expr)", "databricks": "TYPEOF(expr)"}},
|
|
456
|
+
{"name": "HASH", "category": "system", "description": "Hash value of expression",
|
|
457
|
+
"dialects": {"hive": "HASH(expr)", "mysql": "N/A", "oracle": "ORA_HASH(expr)", "tsql": "HASHBYTES('SHA2_256', expr)", "postgres": "HASHTEXT(expr::text)", "spark": "HASH(expr)", "trino": "XXHASH64(expr)", "snowflake": "HASH(expr)", "redshift": "N/A", "clickhouse": "cityHash64(expr)", "duckdb": "HASH(expr)", "databricks": "HASH(expr)"}},
|
|
458
|
+
{"name": "SPLIT_PART", "category": "string", "description": "Get nth part of split string",
|
|
459
|
+
"dialects": {"hive": "SPLIT(str, delim)[n-1]", "mysql": "SUBSTRING_INDEX(SUBSTRING_INDEX(str, delim, n), delim, -1)", "oracle": "REGEXP_SUBSTR(str, '[^delim]+', 1, n)", "tsql": "N/A", "postgres": "SPLIT_PART(str, delim, n)", "spark": "SPLIT(str, delim)[n-1]", "trino": "SPLIT_PART(str, delim, n)", "snowflake": "SPLIT_PART(str, delim, n)", "redshift": "SPLIT_PART(str, delim, n)", "clickhouse": "splitByString(delim, str)[n]", "duckdb": "SPLIT_PART(str, delim, n)", "databricks": "SPLIT(str, delim)[n-1]"}},
|
|
460
|
+
{"name": "OVERLAY", "category": "string", "description": "Replace substring at position",
|
|
461
|
+
"dialects": {"hive": "CONCAT(SUBSTR(str, 1, pos-1), repl, SUBSTR(str, pos+len))", "mysql": "INSERT(str, pos, len, repl)", "oracle": "N/A", "tsql": "STUFF(str, pos, len, repl)", "postgres": "OVERLAY(str PLACING repl FROM pos FOR len)", "spark": "OVERLAY(str, repl, pos, len)", "trino": "N/A", "snowflake": "INSERT(str, pos, len, repl)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "OVERLAY(str PLACING repl FROM pos FOR len)", "databricks": "OVERLAY(str, repl, pos, len)"}},
|
|
462
|
+
{"name": "STUFF", "category": "string", "description": "Insert string at position (SQL Server)",
|
|
463
|
+
"dialects": {"hive": "CONCAT(SUBSTR(str, 1, pos-1), repl, SUBSTR(str, pos+len))", "mysql": "INSERT(str, pos, len, repl)", "oracle": "N/A", "tsql": "STUFF(str, pos, len, repl)", "postgres": "OVERLAY(str PLACING repl FROM pos FOR len)", "spark": "OVERLAY(str, repl, pos, len)", "trino": "N/A", "snowflake": "INSERT(str, pos, len, repl)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "OVERLAY(str PLACING repl FROM pos FOR len)", "databricks": "OVERLAY(str, repl, pos, len)"}},
|
|
464
|
+
{"name": "QUOTE_LITERAL", "category": "string", "description": "Quote string as SQL literal",
|
|
465
|
+
"dialects": {"hive": "CONCAT('''', str, '''')", "mysql": "QUOTE(str)", "oracle": "CONCAT('''', str, '''')", "tsql": "QUOTENAME(str, '''')", "postgres": "QUOTE_LITERAL(str)", "spark": "CONCAT('''', str, '''')", "trino": "N/A", "snowflake": "N/A", "redshift": "QUOTE_LITERAL(str)", "clickhouse": "N/A", "duckdb": "QUOTE(str)", "databricks": "CONCAT('''', str, '''')"}},
|
|
466
|
+
{"name": "QUOTE_IDENT", "category": "string", "description": "Quote string as SQL identifier",
|
|
467
|
+
"dialects": {"hive": "CONCAT('`', str, '`')", "mysql": "CONCAT('`', str, '`')", "oracle": "CONCAT('\"', str, '\"')", "tsql": "QUOTENAME(str)", "postgres": "QUOTE_IDENT(str)", "spark": "CONCAT('`', str, '`')", "trino": "N/A", "snowflake": "N/A", "redshift": "QUOTE_IDENT(str)", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "CONCAT('`', str, '`')"}},
|
|
468
|
+
{"name": "NORMALIZE", "category": "string", "description": "Unicode normalization",
|
|
469
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "NORMALIZE(str, form)", "spark": "N/A", "trino": "NORMALIZE(str, form)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "N/A"}},
|
|
470
|
+
{"name": "WORD_COUNT", "category": "string", "description": "Count words in string",
|
|
471
|
+
"dialects": {"hive": "SIZE(SPLIT(TRIM(str), '\\\\s+'))", "mysql": "LENGTH(str) - LENGTH(REPLACE(str, ' ', '')) + 1", "oracle": "REGEXP_COUNT(str, '\\S+')", "tsql": "LEN(str) - LEN(REPLACE(str, ' ', '')) + 1", "postgres": "ARRAY_LENGTH(REGEXP_SPLIT_TO_ARRAY(str, '\\s+'), 1)", "spark": "SIZE(SPLIT(TRIM(str), '\\\\s+'))", "trino": "CARDINALITY(REGEXP_SPLIT(str, '\\s+'))", "snowflake": "ARRAY_SIZE(SPLIT(str, ' '))", "redshift": "REGEXP_COUNT(str, '\\S+')", "clickhouse": "length(splitByString(' ', str))", "duckdb": "ARRAY_LENGTH(STRING_SPLIT_REGEX(str, '\\s+'))", "databricks": "SIZE(SPLIT(TRIM(str), '\\\\s+'))"}},
|
|
472
|
+
{"name": "RATIO_TO_REPORT", "category": "window", "description": "Ratio of value to sum in partition",
|
|
473
|
+
"dialects": {"hive": "col / SUM(col) OVER(PARTITION BY ...)", "mysql": "col / SUM(col) OVER(PARTITION BY ...)", "oracle": "RATIO_TO_REPORT(col) OVER(PARTITION BY ...)", "tsql": "col * 1.0 / SUM(col) OVER(PARTITION BY ...)", "postgres": "col::NUMERIC / SUM(col) OVER(PARTITION BY ...)", "spark": "col / SUM(col) OVER(PARTITION BY ...)", "trino": "col / SUM(col) OVER(PARTITION BY ...)", "snowflake": "RATIO_TO_REPORT(col) OVER(PARTITION BY ...)", "redshift": "RATIO_TO_REPORT(col) OVER(PARTITION BY ...)", "clickhouse": "col / sum(col) OVER(PARTITION BY ...)", "duckdb": "col / SUM(col) OVER(PARTITION BY ...)", "databricks": "col / SUM(col) OVER(PARTITION BY ...)"}},
|
|
474
|
+
{"name": "WIDTH_BUCKET", "category": "math", "description": "Assign value to histogram bucket",
|
|
475
|
+
"dialects": {"hive": "WIDTH_BUCKET(val, min, max, buckets)", "mysql": "N/A", "oracle": "WIDTH_BUCKET(val, min, max, buckets)", "tsql": "N/A", "postgres": "WIDTH_BUCKET(val, min, max, buckets)", "spark": "WIDTH_BUCKET(val, min, max, buckets)", "trino": "WIDTH_BUCKET(val, min, max, buckets)", "snowflake": "WIDTH_BUCKET(val, min, max, buckets)", "redshift": "WIDTH_BUCKET(val, min, max, buckets)", "clickhouse": "N/A", "duckdb": "WIDTH_BUCKET(val, min, max, buckets)", "databricks": "WIDTH_BUCKET(val, min, max, buckets)"}},
|
|
476
|
+
{"name": "SINH", "category": "math", "description": "Hyperbolic sine",
|
|
477
|
+
"dialects": {"hive": "SINH(x)", "mysql": "N/A", "oracle": "SINH(x)", "tsql": "N/A", "postgres": "SINH(x)", "spark": "SINH(x)", "trino": "SINH(x)", "snowflake": "SINH(x)", "redshift": "N/A", "clickhouse": "sinh(x)", "duckdb": "SINH(x)", "databricks": "SINH(x)"}},
|
|
478
|
+
{"name": "COSH", "category": "math", "description": "Hyperbolic cosine",
|
|
479
|
+
"dialects": {"hive": "COSH(x)", "mysql": "N/A", "oracle": "COSH(x)", "tsql": "N/A", "postgres": "COSH(x)", "spark": "COSH(x)", "trino": "COSH(x)", "snowflake": "COSH(x)", "redshift": "N/A", "clickhouse": "cosh(x)", "duckdb": "COSH(x)", "databricks": "COSH(x)"}},
|
|
480
|
+
{"name": "TANH", "category": "math", "description": "Hyperbolic tangent",
|
|
481
|
+
"dialects": {"hive": "TANH(x)", "mysql": "N/A", "oracle": "TANH(x)", "tsql": "N/A", "postgres": "TANH(x)", "spark": "TANH(x)", "trino": "TANH(x)", "snowflake": "TANH(x)", "redshift": "N/A", "clickhouse": "tanh(x)", "duckdb": "TANH(x)", "databricks": "TANH(x)"}},
|
|
482
|
+
{"name": "LN", "category": "math", "description": "Natural logarithm (base e)",
|
|
483
|
+
"dialects": {"hive": "LN(x)", "mysql": "LN(x)", "oracle": "LN(x)", "tsql": "LOG(x)", "postgres": "LN(x)", "spark": "LN(x)", "trino": "LN(x)", "snowflake": "LN(x)", "redshift": "LN(x)", "clickhouse": "log(x)", "duckdb": "LN(x)", "databricks": "LN(x)"}},
|
|
484
|
+
{"name": "FACTORIAL", "category": "math", "description": "Factorial of number",
|
|
485
|
+
"dialects": {"hive": "FACTORIAL(n)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "FACTORIAL(n) or n!", "spark": "FACTORIAL(n)", "trino": "N/A", "snowflake": "FACTORIAL(n)", "redshift": "N/A", "clickhouse": "factorial(n)", "duckdb": "FACTORIAL(n)", "databricks": "FACTORIAL(n)"}},
|
|
486
|
+
{"name": "GCD", "category": "math", "description": "Greatest common divisor",
|
|
487
|
+
"dialects": {"hive": "GCD(a, b)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "GCD(a, b)", "spark": "GCD(a, b)", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "gcd(a, b)", "duckdb": "GCD(a, b)", "databricks": "GCD(a, b)"}},
|
|
488
|
+
{"name": "LCM", "category": "math", "description": "Least common multiple",
|
|
489
|
+
"dialects": {"hive": "LCM(a, b)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "LCM(a, b)", "spark": "LCM(a, b)", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "lcm(a, b)", "duckdb": "LCM(a, b)", "databricks": "LCM(a, b)"}},
|
|
490
|
+
{"name": "ISNAN", "category": "conditional", "description": "Check if value is NaN",
|
|
491
|
+
"dialects": {"hive": "ISNAN(val)", "mysql": "val != val", "oracle": "N/A", "tsql": "N/A", "postgres": "val != val", "spark": "ISNAN(val)", "trino": "IS_NAN(val)", "snowflake": "val != val", "redshift": "N/A", "clickhouse": "isNaN(val)", "duckdb": "ISNAN(val)", "databricks": "ISNAN(val)"}},
|
|
492
|
+
{"name": "ISINF", "category": "conditional", "description": "Check if value is infinite",
|
|
493
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "val = 'Infinity' OR val = '-Infinity'", "spark": "N/A", "trino": "IS_INFINITE(val)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "isInfinite(val)", "duckdb": "ISINF(val)", "databricks": "N/A"}},
|
|
494
|
+
{"name": "NANVL", "category": "conditional", "description": "Return default if NaN",
|
|
495
|
+
"dialects": {"hive": "IF(ISNAN(val), default, val)", "mysql": "IF(val != val, default, val)", "oracle": "NANVL(val, default)", "tsql": "N/A", "postgres": "CASE WHEN val != val THEN default ELSE val END", "spark": "NANVL(val, default)", "trino": "IF(IS_NAN(val), default, val)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "if(isNaN(val), default, val)", "duckdb": "IF(ISNAN(val), default, val)", "databricks": "NANVL(val, default)"}},
|
|
496
|
+
{"name": "TRUNC_DATE", "category": "date", "description": "Truncate date to unit",
|
|
497
|
+
"dialects": {"hive": "TRUNC(date, 'MM')", "mysql": "DATE_FORMAT(date, '%Y-%m-01')", "oracle": "TRUNC(date, 'MM')", "tsql": "DATETRUNC(month, date)", "postgres": "DATE_TRUNC('month', date)", "spark": "TRUNC(date, 'MM')", "trino": "DATE_TRUNC('month', date)", "snowflake": "TRUNC(date, 'MONTH')", "redshift": "TRUNC(date)", "clickhouse": "toStartOfMonth(date)", "duckdb": "DATE_TRUNC('month', date)", "databricks": "TRUNC(date, 'MM')"}},
|
|
498
|
+
{"name": "INTERVAL", "category": "date", "description": "Create interval value",
|
|
499
|
+
"dialects": {"hive": "INTERVAL n DAY", "mysql": "INTERVAL n DAY", "oracle": "INTERVAL 'n' DAY", "tsql": "N/A (use DATEADD)", "postgres": "INTERVAL 'n days'", "spark": "INTERVAL n DAY", "trino": "INTERVAL 'n' DAY", "snowflake": "INTERVAL 'n DAY'", "redshift": "INTERVAL 'n days'", "clickhouse": "INTERVAL n DAY", "duckdb": "INTERVAL n DAY", "databricks": "INTERVAL n DAY"}},
|
|
500
|
+
{"name": "EPOCH", "category": "date", "description": "Convert to/from Unix epoch",
|
|
501
|
+
"dialects": {"hive": "UNIX_TIMESTAMP(ts)", "mysql": "UNIX_TIMESTAMP(ts)", "oracle": "(ts - DATE '1970-01-01') * 86400", "tsql": "DATEDIFF(SECOND, '1970-01-01', ts)", "postgres": "EXTRACT(EPOCH FROM ts)", "spark": "UNIX_TIMESTAMP(ts)", "trino": "TO_UNIXTIME(ts)", "snowflake": "DATE_PART(EPOCH_SECOND, ts)", "redshift": "EXTRACT(EPOCH FROM ts)", "clickhouse": "toUnixTimestamp(ts)", "duckdb": "EPOCH(ts)", "databricks": "UNIX_TIMESTAMP(ts)"}},
|
|
502
|
+
{"name": "TIMEZONE", "category": "date", "description": "Convert timestamp timezone",
|
|
503
|
+
"dialects": {"hive": "FROM_UTC_TIMESTAMP(ts, 'tz')", "mysql": "CONVERT_TZ(ts, from_tz, to_tz)", "oracle": "ts AT TIME ZONE 'tz'", "tsql": "ts AT TIME ZONE 'tz'", "postgres": "ts AT TIME ZONE 'tz'", "spark": "FROM_UTC_TIMESTAMP(ts, 'tz')", "trino": "ts AT TIME ZONE 'tz'", "snowflake": "CONVERT_TIMEZONE('tz', ts)", "redshift": "CONVERT_TIMEZONE('tz', ts)", "clickhouse": "toTimezone(ts, 'tz')", "duckdb": "ts AT TIME ZONE 'tz'", "databricks": "FROM_UTC_TIMESTAMP(ts, 'tz')"}},
|
|
504
|
+
{"name": "WEEK", "category": "date", "description": "Week number of year",
|
|
505
|
+
"dialects": {"hive": "WEEKOFYEAR(date)", "mysql": "WEEK(date)", "oracle": "TO_NUMBER(TO_CHAR(date, 'IW'))", "tsql": "DATEPART(week, date)", "postgres": "EXTRACT(WEEK FROM date)", "spark": "WEEKOFYEAR(date)", "trino": "WEEK(date)", "snowflake": "WEEK(date)", "redshift": "EXTRACT(WEEK FROM date)", "clickhouse": "toWeek(date)", "duckdb": "WEEK(date)", "databricks": "WEEKOFYEAR(date)"}},
|
|
506
|
+
{"name": "ARRAY_AGG", "category": "aggregate", "description": "Aggregate into array",
|
|
507
|
+
"dialects": {"hive": "COLLECT_LIST(col)", "mysql": "JSON_ARRAYAGG(col)", "oracle": "COLLECT(col)", "tsql": "N/A", "postgres": "ARRAY_AGG(col)", "spark": "COLLECT_LIST(col)", "trino": "ARRAY_AGG(col)", "snowflake": "ARRAY_AGG(col)", "redshift": "LISTAGG(col, ',')", "clickhouse": "groupArray(col)", "duckdb": "ARRAY_AGG(col)", "databricks": "COLLECT_LIST(col)"}},
|
|
508
|
+
{"name": "OBJECT_AGG", "category": "aggregate", "description": "Aggregate into object/map",
|
|
509
|
+
"dialects": {"hive": "MAP_FROM_ENTRIES(COLLECT_LIST(STRUCT(k, v)))", "mysql": "JSON_OBJECTAGG(k, v)", "oracle": "JSON_OBJECTAGG(k VALUE v)", "tsql": "N/A", "postgres": "JSON_OBJECT_AGG(k, v)", "spark": "MAP_FROM_ENTRIES(COLLECT_LIST(STRUCT(k, v)))", "trino": "MAP_AGG(k, v)", "snowflake": "OBJECT_AGG(k, v)", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "MAP(LIST(k), LIST(v))", "databricks": "MAP_FROM_ENTRIES(COLLECT_LIST(STRUCT(k, v)))"}},
|
|
510
|
+
{"name": "HISTOGRAM", "category": "aggregate", "description": "Create histogram",
|
|
511
|
+
"dialects": {"hive": "HISTOGRAM_NUMERIC(col, buckets)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "HISTOGRAM_NUMERIC(col, buckets)", "trino": "HISTOGRAM(col)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "histogram(buckets)(col)", "duckdb": "HISTOGRAM(col)", "databricks": "HISTOGRAM_NUMERIC(col, buckets)"}},
|
|
512
|
+
{"name": "APPROX_PERCENTILE", "category": "aggregate", "description": "Approximate percentile",
|
|
513
|
+
"dialects": {"hive": "PERCENTILE_APPROX(col, p)", "mysql": "N/A", "oracle": "APPROX_PERCENTILE(col, p)", "tsql": "N/A", "postgres": "N/A", "spark": "PERCENTILE_APPROX(col, p)", "trino": "APPROX_PERCENTILE(col, p)", "snowflake": "APPROX_PERCENTILE(col, p)", "redshift": "APPROXIMATE PERCENTILE_DISC(p)", "clickhouse": "quantile(p)(col)", "duckdb": "APPROX_QUANTILE(col, p)", "databricks": "PERCENTILE_APPROX(col, p)"}},
|
|
514
|
+
{"name": "KURTOSIS", "category": "aggregate", "description": "Kurtosis of values",
|
|
515
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "KURTOSIS(col)", "trino": "KURTOSIS(col)", "snowflake": "KURTOSIS(col)", "redshift": "N/A", "clickhouse": "kurtPop(col)", "duckdb": "KURTOSIS(col)", "databricks": "KURTOSIS(col)"}},
|
|
516
|
+
{"name": "SKEWNESS", "category": "aggregate", "description": "Skewness of values",
|
|
517
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "SKEWNESS(col)", "trino": "SKEWNESS(col)", "snowflake": "SKEW(col)", "redshift": "N/A", "clickhouse": "skewPop(col)", "duckdb": "SKEWNESS(col)", "databricks": "SKEWNESS(col)"}},
|
|
518
|
+
{"name": "ELEMENT_AT", "category": "array", "description": "Get element at index",
|
|
519
|
+
"dialects": {"hive": "arr[idx]", "mysql": "JSON_EXTRACT(arr, CONCAT('$[', idx, ']'))", "oracle": "N/A", "tsql": "N/A", "postgres": "arr[idx]", "spark": "ELEMENT_AT(arr, idx)", "trino": "ELEMENT_AT(arr, idx)", "snowflake": "arr[idx]", "redshift": "N/A", "clickhouse": "arr[idx]", "duckdb": "arr[idx]", "databricks": "ELEMENT_AT(arr, idx)"}},
|
|
520
|
+
{"name": "ARRAY_PREPEND", "category": "array", "description": "Add element to start of array",
|
|
521
|
+
"dialects": {"hive": "CONCAT(ARRAY(val), arr)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY_PREPEND(val, arr)", "spark": "CONCAT(ARRAY(val), arr)", "trino": "CONCAT(ARRAY[val], arr)", "snowflake": "ARRAY_PREPEND(arr, val)", "redshift": "N/A", "clickhouse": "arrayPushFront(arr, val)", "duckdb": "ARRAY_PREPEND(arr, val)", "databricks": "CONCAT(ARRAY(val), arr)"}},
|
|
522
|
+
{"name": "ARRAY_APPEND", "category": "array", "description": "Add element to end of array",
|
|
523
|
+
"dialects": {"hive": "CONCAT(arr, ARRAY(val))", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ARRAY_APPEND(arr, val)", "spark": "CONCAT(arr, ARRAY(val))", "trino": "CONCAT(arr, ARRAY[val])", "snowflake": "ARRAY_APPEND(arr, val)", "redshift": "N/A", "clickhouse": "arrayPushBack(arr, val)", "duckdb": "ARRAY_APPEND(arr, val)", "databricks": "CONCAT(arr, ARRAY(val))"}},
|
|
524
|
+
{"name": "CARDINALITY", "category": "array", "description": "Number of elements in array",
|
|
525
|
+
"dialects": {"hive": "SIZE(arr)", "mysql": "JSON_LENGTH(arr)", "oracle": "N/A", "tsql": "N/A", "postgres": "CARDINALITY(arr)", "spark": "SIZE(arr)", "trino": "CARDINALITY(arr)", "snowflake": "ARRAY_SIZE(arr)", "redshift": "N/A", "clickhouse": "length(arr)", "duckdb": "CARDINALITY(arr)", "databricks": "SIZE(arr)"}},
|
|
526
|
+
{"name": "ZIP", "category": "array", "description": "Combine arrays element-wise",
|
|
527
|
+
"dialects": {"hive": "ARRAYS_ZIP(arr1, arr2)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "ARRAYS_ZIP(arr1, arr2)", "trino": "ZIP(arr1, arr2)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "arrayZip(arr1, arr2)", "duckdb": "N/A", "databricks": "ARRAYS_ZIP(arr1, arr2)"}},
|
|
528
|
+
{"name": "STRUCT", "category": "conversion", "description": "Create struct/row type",
|
|
529
|
+
"dialects": {"hive": "STRUCT(col1, col2, ...)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "ROW(col1, col2, ...)", "spark": "STRUCT(col1, col2, ...)", "trino": "ROW(col1, col2, ...)", "snowflake": "OBJECT_CONSTRUCT('k1', v1, 'k2', v2)", "redshift": "N/A", "clickhouse": "tuple(col1, col2, ...)", "duckdb": "STRUCT_PACK(col1, col2, ...)", "databricks": "STRUCT(col1, col2, ...)"}},
|
|
530
|
+
{"name": "NAMED_STRUCT", "category": "conversion", "description": "Create named struct",
|
|
531
|
+
"dialects": {"hive": "NAMED_STRUCT('k1', v1, 'k2', v2)", "mysql": "JSON_OBJECT('k1', v1, 'k2', v2)", "oracle": "N/A", "tsql": "N/A", "postgres": "ROW(v1, v2)", "spark": "NAMED_STRUCT('k1', v1, 'k2', v2)", "trino": "CAST(ROW(v1, v2) AS ROW(k1 type1, k2 type2))", "snowflake": "OBJECT_CONSTRUCT('k1', v1, 'k2', v2)", "redshift": "N/A", "clickhouse": "tuple(v1, v2)", "duckdb": "{'k1': v1, 'k2': v2}", "databricks": "NAMED_STRUCT('k1', v1, 'k2', v2)"}},
|
|
532
|
+
{"name": "MAP", "category": "conversion", "description": "Create map from key-value pairs",
|
|
533
|
+
"dialects": {"hive": "MAP(k1, v1, k2, v2)", "mysql": "JSON_OBJECT(k1, v1, k2, v2)", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "MAP(k1, v1, k2, v2)", "trino": "MAP(ARRAY[k1, k2], ARRAY[v1, v2])", "snowflake": "OBJECT_CONSTRUCT(k1, v1, k2, v2)", "redshift": "N/A", "clickhouse": "map(k1, v1, k2, v2)", "duckdb": "MAP([k1, k2], [v1, v2])", "databricks": "MAP(k1, v1, k2, v2)"}},
|
|
534
|
+
{"name": "MAP_CONCAT", "category": "array", "description": "Concatenate maps",
|
|
535
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "m1 || m2", "spark": "MAP_CONCAT(m1, m2)", "trino": "MAP_CONCAT(m1, m2)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "MAP_CONCAT(m1, m2)", "databricks": "MAP_CONCAT(m1, m2)"}},
|
|
536
|
+
{"name": "MAP_FILTER", "category": "array", "description": "Filter map entries",
|
|
537
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "MAP_FILTER(map, (k, v) -> condition)", "trino": "MAP_FILTER(map, (k, v) -> condition)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "MAP_FILTER(map, (k, v) -> condition)"}},
|
|
538
|
+
{"name": "ENCODE", "category": "string", "description": "Encode string to bytes",
|
|
539
|
+
"dialects": {"hive": "ENCODE(str, 'UTF-8')", "mysql": "CONVERT(str USING charset)", "oracle": "UTL_RAW.CAST_TO_RAW(str)", "tsql": "CAST(str AS VARBINARY)", "postgres": "ENCODE(str::bytea, 'base64')", "spark": "ENCODE(str, 'UTF-8')", "trino": "TO_UTF8(str)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "ENCODE(str)", "databricks": "ENCODE(str, 'UTF-8')"}},
|
|
540
|
+
{"name": "DECODE_STR", "category": "string", "description": "Decode bytes to string",
|
|
541
|
+
"dialects": {"hive": "DECODE(bytes, 'UTF-8')", "mysql": "CONVERT(bytes USING charset)", "oracle": "UTL_RAW.CAST_TO_VARCHAR2(bytes)", "tsql": "CAST(bytes AS VARCHAR)", "postgres": "DECODE(str, 'base64')", "spark": "DECODE(bytes, 'UTF-8')", "trino": "FROM_UTF8(bytes)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "DECODE(bytes)", "databricks": "DECODE(bytes, 'UTF-8')"}},
|
|
542
|
+
{"name": "HEX", "category": "string", "description": "Convert to hexadecimal",
|
|
543
|
+
"dialects": {"hive": "HEX(str)", "mysql": "HEX(str)", "oracle": "RAWTOHEX(UTL_RAW.CAST_TO_RAW(str))", "tsql": "CONVERT(VARCHAR(MAX), str, 2)", "postgres": "ENCODE(str::bytea, 'hex')", "spark": "HEX(str)", "trino": "TO_HEX(TO_UTF8(str))", "snowflake": "HEX_ENCODE(str)", "redshift": "N/A", "clickhouse": "hex(str)", "duckdb": "HEX(str)", "databricks": "HEX(str)"}},
|
|
544
|
+
{"name": "UNHEX", "category": "string", "description": "Convert from hexadecimal",
|
|
545
|
+
"dialects": {"hive": "UNHEX(hex)", "mysql": "UNHEX(hex)", "oracle": "UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW(hex))", "tsql": "CONVERT(VARCHAR(MAX), hex, 1)", "postgres": "DECODE(hex, 'hex')", "spark": "UNHEX(hex)", "trino": "FROM_HEX(hex)", "snowflake": "HEX_DECODE_STRING(hex)", "redshift": "N/A", "clickhouse": "unhex(hex)", "duckdb": "UNHEX(hex)", "databricks": "UNHEX(hex)"}},
|
|
546
|
+
{"name": "BIN", "category": "string", "description": "Convert to binary string",
|
|
547
|
+
"dialects": {"hive": "BIN(n)", "mysql": "BIN(n)", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "BIN(n)", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "bin(n)", "duckdb": "N/A", "databricks": "BIN(n)"}},
|
|
548
|
+
{"name": "OCT", "category": "string", "description": "Convert to octal string",
|
|
549
|
+
"dialects": {"hive": "N/A", "mysql": "OCT(n)", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "N/A", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "N/A"}},
|
|
550
|
+
{"name": "CONV", "category": "conversion", "description": "Convert number between bases",
|
|
551
|
+
"dialects": {"hive": "CONV(n, from_base, to_base)", "mysql": "CONV(n, from_base, to_base)", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "CONV(n, from_base, to_base)", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "CONV(n, from_base, to_base)"}},
|
|
552
|
+
{"name": "ASSERT_TRUE", "category": "conditional", "description": "Assert condition is true",
|
|
553
|
+
"dialects": {"hive": "ASSERT_TRUE(cond)", "mysql": "N/A", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "ASSERT_TRUE(cond)", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "ASSERT_TRUE(cond)"}},
|
|
554
|
+
{"name": "RAISE_ERROR", "category": "conditional", "description": "Raise error with message",
|
|
555
|
+
"dialects": {"hive": "N/A", "mysql": "SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg", "oracle": "RAISE_APPLICATION_ERROR(-20001, msg)", "tsql": "RAISERROR(msg, 16, 1)", "postgres": "RAISE EXCEPTION '%', msg", "spark": "RAISE_ERROR(msg)", "trino": "FAIL(msg)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "throwIf(true, msg)", "duckdb": "N/A", "databricks": "RAISE_ERROR(msg)"}},
|
|
556
|
+
{"name": "SHA512", "category": "string", "description": "SHA-512 hash of string",
|
|
557
|
+
"dialects": {"hive": "SHA2(str, 512)", "mysql": "SHA2(str, 512)", "oracle": "RAWTOHEX(DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW(str), 6))", "tsql": "HASHBYTES('SHA2_512', str)", "postgres": "ENCODE(DIGEST(str, 'sha512'), 'hex')", "spark": "SHA2(str, 512)", "trino": "SHA512(str)", "snowflake": "SHA2(str, 512)", "redshift": "N/A", "clickhouse": "SHA512(str)", "duckdb": "SHA512(str)", "databricks": "SHA2(str, 512)"}},
|
|
558
|
+
{"name": "AES_ENCRYPT", "category": "string", "description": "AES encrypt string",
|
|
559
|
+
"dialects": {"hive": "AES_ENCRYPT(str, key)", "mysql": "AES_ENCRYPT(str, key)", "oracle": "DBMS_CRYPTO.ENCRYPT(...)", "tsql": "ENCRYPTBYKEY(key_guid, str)", "postgres": "ENCRYPT(str::bytea, key::bytea, 'aes')", "spark": "AES_ENCRYPT(str, key)", "trino": "N/A", "snowflake": "ENCRYPT(str, key)", "redshift": "N/A", "clickhouse": "encrypt('aes-256-cbc', str, key)", "duckdb": "N/A", "databricks": "AES_ENCRYPT(str, key)"}},
|
|
560
|
+
{"name": "AES_DECRYPT", "category": "string", "description": "AES decrypt string",
|
|
561
|
+
"dialects": {"hive": "AES_DECRYPT(encrypted, key)", "mysql": "AES_DECRYPT(encrypted, key)", "oracle": "DBMS_CRYPTO.DECRYPT(...)", "tsql": "DECRYPTBYKEY(encrypted)", "postgres": "DECRYPT(encrypted, key::bytea, 'aes')", "spark": "AES_DECRYPT(encrypted, key)", "trino": "N/A", "snowflake": "DECRYPT(encrypted, key)", "redshift": "N/A", "clickhouse": "decrypt('aes-256-cbc', encrypted, key)", "duckdb": "N/A", "databricks": "AES_DECRYPT(encrypted, key)"}},
|
|
562
|
+
{"name": "HMAC", "category": "string", "description": "HMAC hash with key",
|
|
563
|
+
"dialects": {"hive": "N/A", "mysql": "N/A", "oracle": "DBMS_CRYPTO.MAC(...)", "tsql": "N/A", "postgres": "HMAC(str, key, 'sha256')", "spark": "N/A", "trino": "HMAC_SHA256(str, key)", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "N/A"}},
|
|
564
|
+
{"name": "ST_POINT", "category": "geo", "description": "Create point geometry",
|
|
565
|
+
"dialects": {"hive": "ST_POINT(lon, lat)", "mysql": "ST_POINT(lon, lat)", "oracle": "SDO_GEOMETRY(2001, 4326, SDO_POINT_TYPE(lon, lat, NULL), NULL, NULL)", "tsql": "GEOGRAPHY::Point(lat, lon, 4326)", "postgres": "ST_POINT(lon, lat)", "spark": "ST_POINT(lon, lat)", "trino": "ST_POINT(lon, lat)", "snowflake": "ST_MAKEPOINT(lon, lat)", "redshift": "ST_POINT(lon, lat)", "clickhouse": "N/A", "duckdb": "ST_POINT(lon, lat)", "databricks": "ST_POINT(lon, lat)"}},
|
|
566
|
+
{"name": "ST_DISTANCE", "category": "geo", "description": "Distance between geometries",
|
|
567
|
+
"dialects": {"hive": "ST_DISTANCE(geom1, geom2)", "mysql": "ST_DISTANCE(geom1, geom2)", "oracle": "SDO_GEOM.SDO_DISTANCE(geom1, geom2, 0.005)", "tsql": "geom1.STDistance(geom2)", "postgres": "ST_DISTANCE(geom1, geom2)", "spark": "ST_DISTANCE(geom1, geom2)", "trino": "ST_DISTANCE(geom1, geom2)", "snowflake": "ST_DISTANCE(geom1, geom2)", "redshift": "ST_DISTANCE(geom1, geom2)", "clickhouse": "N/A", "duckdb": "ST_DISTANCE(geom1, geom2)", "databricks": "ST_DISTANCE(geom1, geom2)"}},
|
|
568
|
+
{"name": "ST_CONTAINS", "category": "geo", "description": "Check if geometry contains another",
|
|
569
|
+
"dialects": {"hive": "ST_CONTAINS(geom1, geom2)", "mysql": "ST_CONTAINS(geom1, geom2)", "oracle": "SDO_CONTAINS(geom1, geom2) = 'TRUE'", "tsql": "geom1.STContains(geom2)", "postgres": "ST_CONTAINS(geom1, geom2)", "spark": "ST_CONTAINS(geom1, geom2)", "trino": "ST_CONTAINS(geom1, geom2)", "snowflake": "ST_CONTAINS(geom1, geom2)", "redshift": "ST_CONTAINS(geom1, geom2)", "clickhouse": "N/A", "duckdb": "ST_CONTAINS(geom1, geom2)", "databricks": "ST_CONTAINS(geom1, geom2)"}},
|
|
570
|
+
{"name": "ST_WITHIN", "category": "geo", "description": "Check if geometry is within another",
|
|
571
|
+
"dialects": {"hive": "ST_WITHIN(geom1, geom2)", "mysql": "ST_WITHIN(geom1, geom2)", "oracle": "SDO_WITHIN_DISTANCE(geom1, geom2, 0) = 'TRUE'", "tsql": "geom1.STWithin(geom2)", "postgres": "ST_WITHIN(geom1, geom2)", "spark": "ST_WITHIN(geom1, geom2)", "trino": "ST_WITHIN(geom1, geom2)", "snowflake": "ST_WITHIN(geom1, geom2)", "redshift": "ST_WITHIN(geom1, geom2)", "clickhouse": "N/A", "duckdb": "ST_WITHIN(geom1, geom2)", "databricks": "ST_WITHIN(geom1, geom2)"}},
|
|
572
|
+
{"name": "ST_INTERSECTS", "category": "geo", "description": "Check if geometries intersect",
|
|
573
|
+
"dialects": {"hive": "ST_INTERSECTS(geom1, geom2)", "mysql": "ST_INTERSECTS(geom1, geom2)", "oracle": "SDO_ANYINTERACT(geom1, geom2) = 'TRUE'", "tsql": "geom1.STIntersects(geom2)", "postgres": "ST_INTERSECTS(geom1, geom2)", "spark": "ST_INTERSECTS(geom1, geom2)", "trino": "ST_INTERSECTS(geom1, geom2)", "snowflake": "ST_INTERSECTS(geom1, geom2)", "redshift": "ST_INTERSECTS(geom1, geom2)", "clickhouse": "N/A", "duckdb": "ST_INTERSECTS(geom1, geom2)", "databricks": "ST_INTERSECTS(geom1, geom2)"}},
|
|
574
|
+
{"name": "ST_AREA", "category": "geo", "description": "Area of geometry",
|
|
575
|
+
"dialects": {"hive": "ST_AREA(geom)", "mysql": "ST_AREA(geom)", "oracle": "SDO_GEOM.SDO_AREA(geom, 0.005)", "tsql": "geom.STArea()", "postgres": "ST_AREA(geom)", "spark": "ST_AREA(geom)", "trino": "ST_AREA(geom)", "snowflake": "ST_AREA(geom)", "redshift": "ST_AREA(geom)", "clickhouse": "N/A", "duckdb": "ST_AREA(geom)", "databricks": "ST_AREA(geom)"}},
|
|
576
|
+
{"name": "ST_LENGTH", "category": "geo", "description": "Length of geometry",
|
|
577
|
+
"dialects": {"hive": "ST_LENGTH(geom)", "mysql": "ST_LENGTH(geom)", "oracle": "SDO_GEOM.SDO_LENGTH(geom, 0.005)", "tsql": "geom.STLength()", "postgres": "ST_LENGTH(geom)", "spark": "ST_LENGTH(geom)", "trino": "ST_LENGTH(geom)", "snowflake": "ST_LENGTH(geom)", "redshift": "ST_LENGTH(geom)", "clickhouse": "N/A", "duckdb": "ST_LENGTH(geom)", "databricks": "ST_LENGTH(geom)"}},
|
|
578
|
+
{"name": "ST_BUFFER", "category": "geo", "description": "Buffer around geometry",
|
|
579
|
+
"dialects": {"hive": "ST_BUFFER(geom, distance)", "mysql": "ST_BUFFER(geom, distance)", "oracle": "SDO_GEOM.SDO_BUFFER(geom, distance, 0.005)", "tsql": "geom.STBuffer(distance)", "postgres": "ST_BUFFER(geom, distance)", "spark": "ST_BUFFER(geom, distance)", "trino": "ST_BUFFER(geom, distance)", "snowflake": "ST_BUFFER(geom, distance)", "redshift": "ST_BUFFER(geom, distance)", "clickhouse": "N/A", "duckdb": "ST_BUFFER(geom, distance)", "databricks": "ST_BUFFER(geom, distance)"}},
|
|
580
|
+
{"name": "ST_CENTROID", "category": "geo", "description": "Centroid of geometry",
|
|
581
|
+
"dialects": {"hive": "ST_CENTROID(geom)", "mysql": "ST_CENTROID(geom)", "oracle": "SDO_GEOM.SDO_CENTROID(geom, 0.005)", "tsql": "geom.STCentroid()", "postgres": "ST_CENTROID(geom)", "spark": "ST_CENTROID(geom)", "trino": "ST_CENTROID(geom)", "snowflake": "ST_CENTROID(geom)", "redshift": "ST_CENTROID(geom)", "clickhouse": "N/A", "duckdb": "ST_CENTROID(geom)", "databricks": "ST_CENTROID(geom)"}},
|
|
582
|
+
{"name": "ST_GEOMFROMTEXT", "category": "geo", "description": "Create geometry from WKT",
|
|
583
|
+
"dialects": {"hive": "ST_GEOMFROMTEXT(wkt)", "mysql": "ST_GEOMFROMTEXT(wkt)", "oracle": "SDO_GEOMETRY(wkt)", "tsql": "GEOGRAPHY::STGeomFromText(wkt, 4326)", "postgres": "ST_GEOMFROMTEXT(wkt)", "spark": "ST_GEOMFROMTEXT(wkt)", "trino": "ST_GEOMFROMTEXT(wkt)", "snowflake": "ST_GEOMFROMTEXT(wkt)", "redshift": "ST_GEOMFROMTEXT(wkt)", "clickhouse": "N/A", "duckdb": "ST_GEOMFROMTEXT(wkt)", "databricks": "ST_GEOMFROMTEXT(wkt)"}},
|
|
584
|
+
{"name": "ST_ASTEXT", "category": "geo", "description": "Convert geometry to WKT",
|
|
585
|
+
"dialects": {"hive": "ST_ASTEXT(geom)", "mysql": "ST_ASTEXT(geom)", "oracle": "SDO_UTIL.TO_WKTGEOMETRY(geom)", "tsql": "geom.STAsText()", "postgres": "ST_ASTEXT(geom)", "spark": "ST_ASTEXT(geom)", "trino": "ST_ASTEXT(geom)", "snowflake": "ST_ASTEXT(geom)", "redshift": "ST_ASTEXT(geom)", "clickhouse": "N/A", "duckdb": "ST_ASTEXT(geom)", "databricks": "ST_ASTEXT(geom)"}},
|
|
586
|
+
{"name": "SLEEP", "category": "system", "description": "Pause execution for seconds",
|
|
587
|
+
"dialects": {"hive": "N/A", "mysql": "SLEEP(seconds)", "oracle": "DBMS_LOCK.SLEEP(seconds)", "tsql": "WAITFOR DELAY '00:00:seconds'", "postgres": "PG_SLEEP(seconds)", "spark": "N/A", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "sleep(seconds)", "duckdb": "N/A", "databricks": "N/A"}},
|
|
588
|
+
{"name": "CONNECTION_ID", "category": "system", "description": "Current connection ID",
|
|
589
|
+
"dialects": {"hive": "N/A", "mysql": "CONNECTION_ID()", "oracle": "SYS_CONTEXT('USERENV', 'SID')", "tsql": "@@SPID", "postgres": "PG_BACKEND_PID()", "spark": "N/A", "trino": "N/A", "snowflake": "CURRENT_SESSION()", "redshift": "PG_BACKEND_PID()", "clickhouse": "connectionId()", "duckdb": "N/A", "databricks": "N/A"}},
|
|
590
|
+
{"name": "LAST_INSERT_ID", "category": "system", "description": "Last auto-increment ID",
|
|
591
|
+
"dialects": {"hive": "N/A", "mysql": "LAST_INSERT_ID()", "oracle": "sequence.CURRVAL", "tsql": "SCOPE_IDENTITY()", "postgres": "LASTVAL()", "spark": "N/A", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "LAST_INSERT_ROWID()", "databricks": "N/A"}},
|
|
592
|
+
{"name": "ROW_COUNT", "category": "system", "description": "Rows affected by last statement",
|
|
593
|
+
"dialects": {"hive": "N/A", "mysql": "ROW_COUNT()", "oracle": "SQL%ROWCOUNT", "tsql": "@@ROWCOUNT", "postgres": "N/A (use GET DIAGNOSTICS)", "spark": "N/A", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "N/A"}},
|
|
594
|
+
{"name": "FOUND_ROWS", "category": "system", "description": "Total rows without LIMIT",
|
|
595
|
+
"dialects": {"hive": "N/A", "mysql": "FOUND_ROWS()", "oracle": "N/A", "tsql": "N/A", "postgres": "N/A", "spark": "N/A", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "N/A", "duckdb": "N/A", "databricks": "N/A"}},
|
|
596
|
+
{"name": "INET_ATON", "category": "conversion", "description": "IP address to integer",
|
|
597
|
+
"dialects": {"hive": "N/A", "mysql": "INET_ATON(ip)", "oracle": "N/A", "tsql": "N/A", "postgres": "inet(ip) - inet('0.0.0.0')", "spark": "N/A", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "IPv4StringToNum(ip)", "duckdb": "N/A", "databricks": "N/A"}},
|
|
598
|
+
{"name": "INET_NTOA", "category": "conversion", "description": "Integer to IP address",
|
|
599
|
+
"dialects": {"hive": "N/A", "mysql": "INET_NTOA(n)", "oracle": "N/A", "tsql": "N/A", "postgres": "inet('0.0.0.0') + n", "spark": "N/A", "trino": "N/A", "snowflake": "N/A", "redshift": "N/A", "clickhouse": "IPv4NumToString(n)", "duckdb": "N/A", "databricks": "N/A"}}
|
|
600
|
+
]
|
|
601
|
+
}
|