SELECT
Description
Spark supports a
SELECT
statement and conforms to the ANSI SQL standard. Queries are used to retrieve result sets from one or more tables. (Spark SQL Language Reference SELECT)
This grammar is partially supported in Snowflake. Translation pending for these CREATE VIEW elements:
Grammar Syntax
Sample Source Patterns
GROUP BY
The WITH { CUBE | ROLLUP }
syntax is transformed to its CUBE(expr1, ...)
or ROLLUP(expr1, ...)
equivalent
Input Code:
Output Code:
Hints
Snowflake performs automatic optimization of JOINs and partitioning, meaning that hints are unnecessary, they are preserved as comments in the output code.
Input Code:
Output Code:
CTE
The AS
keyword is optional in Spark/Databricks, however in Snowflake is required so it is added.
Input Code:
Output Code:
LIMIT
LIMIT ALL
is removed as it is not needed in Snowflake, LIMIT with a literal value is preserved as-is.
Input Code:
Output Code:
ORDER BY
This clause is fully supported in Snowflake
WHERE
This clause is fully supported in Snowflake
HAVING
This clause is fully supported in Snowflake
FROM table_relation
This clause is fully supported in Snowflake
FROM inline_table
This clause is fully supported in Snowflake
UNION [ALL | DISTINCT]
This clause is fully supported in Snowflake
INTERSECT (no keywords)
This clause is fully supported in Snowflake
EXCEPT (no keywords)
This clause is fully supported in Snowflake
Last updated