Apache Spark SQL SQL Formatter
Free online Apache Spark SQL formatter. Format Spark SQL queries with support for LATERAL VIEW, EXPLODE, MERGE INTO, Delta Lake syntax, and Hive-compatible DDL.
What is Apache Spark SQL?
Apache Spark SQL is the SQL interface for Apache Spark, enabling analysts and engineers to query structured and semi-structured data using familiar SQL syntax at scale. It can run on data stored in HDFS, S3, Delta Lake, Apache Hive, and many other data sources.
Spark SQL supports ANSI SQL plus Spark-specific extensions including LATERAL VIEW with table-generating functions (EXPLODE, POSEXPLODE), MERGE INTO for Delta Lake upserts, and Hive-compatible CREATE TABLE syntax with USING, PARTITIONED BY, and LOCATION options.
The Spark SQL formatter handles Spark's unique syntax — including LATERAL VIEW, EXPLODE(), Delta Lake MERGE INTO, and external table DDL — formatting complex data engineering queries into clean, maintainable SQL.
Frequently asked questions
Does the Spark SQL formatter handle LATERAL VIEW and EXPLODE?
Yes. Spark SQL's LATERAL VIEW with EXPLODE(), POSEXPLODE(), JSON_TUPLE(), and other table-generating functions are formatted with proper indentation as part of the FROM clause.
Will CREATE TABLE with USING and LOCATION be formatted?
Yes. Spark SQL's external table syntax (USING parquet, USING delta, LOCATION '/path') and PARTITIONED BY are formatted as structured DDL with each option on its own line.
Does it support window functions and analytical queries?
Yes. Spark SQL window functions with OVER(), PARTITION BY, ORDER BY, and ROWS/RANGE BETWEEN frame specifications are formatted with clear, readable structure.
How does it handle MERGE INTO for Delta Lake tables?
MERGE INTO statements are formatted with each WHEN clause on its own line, clearly showing matched/not-matched conditions and their corresponding UPDATE, INSERT, or DELETE actions.
Try Sequel
Query your database in plain English.
Connect your database and get instant answers without writing SQL. Free for up to 3 seats — no credit card required.
Get started free