SnowConvert AI - Hive - SELECT¶
Applies to
Hive SQL
Spark SQL
Databricks SQL
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)
Warning
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¶
Note
This clause is fully supported in Snowflake
WHERE¶
Note
This clause is fully supported in Snowflake
HAVING¶
Note
This clause is fully supported in Snowflake
FROM table_relation¶
Note
This clause is fully supported in Snowflake
FROM inline_table¶
Note
This clause is fully supported in Snowflake
UNION [ALL | DISTINCT]¶
Note
This clause is fully supported in Snowflake
INTERSECT (no keywords)¶
Note
This clause is fully supported in Snowflake
EXCEPT (no keywords)¶
Note
This clause is fully supported in Snowflake