The full answer
Spark SQL is the Spark module for structured data. It lets you query data with SQL or the DataFrame API, works out the schema of the data, and runs every query through the Catalyst optimizer and Tungsten execution engine. "Core Spark" usually means the original RDD API: distributed collections of arbitrary objects processed with functions, with no schema and no query optimisation.
| Spark SQL (DataFrames, Datasets, SQL) | Core Spark (RDDs) | |
|---|---|---|
| Data model | Tables: rows with named, typed columns | Collections of any objects |
| How you express work | SQL or declarative DataFrame operations | Functions passed to map, filter, reduceByKey |
| Optimisation | Catalyst: pushdown, pruning, join strategy, adaptive execution | None: your functions run as written |
| Execution | Tungsten: compact binary rows, generated code | Java or Python objects |
| Data sources | Built-in readers for Parquet, ORC, JSON, CSV, Avro, JDBC, Delta, Iceberg, Hive tables | Text files, Hadoop input formats, your own code |
| Languages | SQL, Python, Scala, Java, R | Scala, Java, Python |
| Performance in Python | Close to Scala, since work runs in the JVM | Slower: data moves to Python workers |
| Where it's available | Everywhere, including Spark Connect and serverless | Not in Spark Connect |
What Spark SQL provides
- A SQL engine with ANSI SQL behaviour (on by default since Spark 4), window functions, common table expressions, and features such as
MERGEwith table formats that support it. - A catalog of databases, tables, views and functions (the Hive metastore, Unity Catalog or another catalog).
- JDBC and ODBC access through the Thrift server, so BI tools can query Spark.
- The basis for most of the rest of Spark: Structured Streaming, MLlib's DataFrame APIs and the pandas API on Spark all run on Spark SQL.
Example of the same job
# Spark SQL (DataFrame API)
from pyspark.sql import functions as F
(spark.read.parquet("/data/orders")
.filter(F.col("amount") > 0)
.groupBy("country").agg(F.sum("amount").alias("revenue")))
-- Spark SQL (SQL)
SELECT country, SUM(amount) AS revenue
FROM parquet.`/data/orders`
WHERE amount > 0
GROUP BY country;
# Core Spark (RDD)
(sc.textFile("/data/orders.csv")
.map(lambda line: line.split(","))
.filter(lambda f: float(f[2]) > 0)
.map(lambda f: (f[1], float(f[2])))
.reduceByKey(lambda a, b: a + b))
The RDD version has to parse the file by hand, can't skip columns or rows at the source, and is not optimised.
How they relate Spark SQL runs on the core engine: DataFrame plans are compiled into RDD operations underneath, using the same scheduler, executors and fault tolerance. Today almost all new work uses Spark SQL; the RDD API remains for low-level control and legacy code.
Last updated 16 October 2026
Sources