<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=RDD</id>
	<title>RDD - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=RDD"/>
	<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=RDD&amp;action=history"/>
	<updated>2026-12-06T00:08:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://openlakehouse.io/w/index.php?title=RDD&amp;diff=102&amp;oldid=prev</id>
		<title>Open Lakehouse Wiki sync: Sync from open-lakehouse/wiki@f2492a3</title>
		<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=RDD&amp;diff=102&amp;oldid=prev"/>
		<updated>2026-11-23T00:34:54Z</updated>

		<summary type="html">&lt;p&gt;Sync from open-lakehouse/wiki@f2492a3&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox concept&lt;br /&gt;
| name            = RDD&lt;br /&gt;
| also_known_as   = Resilient distributed dataset&lt;br /&gt;
| field           = Distributed data processing&lt;br /&gt;
| key_parts       = Partitions, lineage of transformations, lazy transformations and actions, storage levels for persistence&lt;br /&gt;
| implementations = [[Apache Spark]]&lt;br /&gt;
| related         = [[DataFrame]], [[Dataset (Spark)]], [[Partition]], [[Spark Connect]], [[GraphX]], [[Spark Streaming (DStreams)]]&lt;br /&gt;
}}&lt;br /&gt;
{{Verified|2026-11-22|the v4.3.0 tag of apache/spark (docs/rdd-programming-guide.md, docs/quick-start.md, docs/spark-connect-overview.md, core/src/main/scala/org/apache/spark/rdd/RDD.scala, python/pyspark/core/rdd.py, python/pyspark/sql/connect/dataframe.py), the Spark 4.0.0 to 4.3.0 release notes and the NSDI 2012 RDD paper}}&lt;br /&gt;
{{Status|active |note=The RDD API is not deprecated in any Spark release up to 4.3.0; only some individual methods are. It is not supported by [[Spark Connect]]. |ref=&amp;lt;ref name=&amp;quot;connect&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/spark-connect-overview.html |title=Spark Connect Overview (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
In [[Apache Spark]], a &amp;#039;&amp;#039;&amp;#039;resilient distributed dataset&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;RDD&amp;#039;&amp;#039;&amp;#039;) is an immutable collection of elements split into partitions across the nodes of a cluster, which can be processed in parallel and is rebuilt from its lineage when a partition is lost.&amp;lt;ref name=&amp;quot;guide&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/rdd-programming-guide.html |title=RDD Programming Guide (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; The RDD was Spark&amp;#039;s main programming interface before Spark 2.0; since then the Spark documentation recommends the [[Dataset (Spark)|Dataset]] and [[DataFrame]] APIs, which run through the Catalyst optimizer, while stating that the RDD interface is still supported.&amp;lt;ref name=&amp;quot;quick&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/quick-start.html |title=Quick Start (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; RDDs still underlie older libraries such as [[GraphX]] and [[Spark Streaming (DStreams)]], but they are not available to [[Spark Connect]] clients.&amp;lt;ref name=&amp;quot;connect&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
The RDD API is not deprecated. The &amp;lt;code&amp;gt;RDD&amp;lt;/code&amp;gt; class at the v4.3.0 tag of Spark carries no deprecation annotation, and the Spark 4.0.0 to 4.3.0 release notes list no deprecation of the RDD API.&amp;lt;ref name=&amp;quot;rddscala&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/core/src/main/scala/org/apache/spark/rdd/RDD.scala |title=RDD.scala (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;r400&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/releases/spark-release-4-0-0.html |title=Spark Release 4.0.0 |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; Only single methods are deprecated; for example, PySpark&amp;#039;s &amp;lt;code&amp;gt;mapPartitionsWithSplit&amp;lt;/code&amp;gt; is deprecated in favor of &amp;lt;code&amp;gt;mapPartitionsWithIndex&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;pyrdd&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/python/pyspark/core/rdd.py |title=python/pyspark/core/rdd.py (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The practical limit is Spark Connect. The Spark Connect documentation lists &amp;lt;code&amp;gt;SparkContext&amp;lt;/code&amp;gt; and RDD as unsupported for both Python and Scala clients.&amp;lt;ref name=&amp;quot;connect&amp;quot; /&amp;gt; In the PySpark Connect client, &amp;lt;code&amp;gt;DataFrame.rdd&amp;lt;/code&amp;gt; raises a not-implemented error.&amp;lt;ref&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/python/pyspark/sql/connect/dataframe.py |title=python/pyspark/sql/connect/dataframe.py (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; Code that uses RDDs therefore needs a classic Spark application, which is the default: &amp;lt;code&amp;gt;spark.api.mode&amp;lt;/code&amp;gt; defaults to &amp;lt;code&amp;gt;classic&amp;lt;/code&amp;gt; in Spark 4.3.0.&amp;lt;ref&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/configuration.html |title=Spark Configuration (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
An RDD is created from a file in a Hadoop-supported file system, from a collection in the driver program, or by transforming another RDD.&amp;lt;ref name=&amp;quot;guide&amp;quot; /&amp;gt; The design was described in the 2012 paper &amp;#039;&amp;#039;Resilient Distributed Datasets: A Fault-Tolerant Abstraction for In-Memory Cluster Computing&amp;#039;&amp;#039; by Matei Zaharia and others at the University of California, Berkeley.&amp;lt;ref name=&amp;quot;paper&amp;quot;&amp;gt;{{Cite web |url=https://www.usenix.org/conference/nsdi12/technical-sessions/presentation/zaharia |title=Resilient Distributed Datasets: A Fault-Tolerant Abstraction for In-Memory Cluster Computing |publisher=USENIX (NSDI 2012) |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RDDs support two kinds of operations. &amp;#039;&amp;#039;&amp;#039;Transformations&amp;#039;&amp;#039;&amp;#039;, such as &amp;lt;code&amp;gt;map&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, return a new RDD. &amp;#039;&amp;#039;&amp;#039;Actions&amp;#039;&amp;#039;&amp;#039;, such as &amp;lt;code&amp;gt;reduce&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;collect&amp;lt;/code&amp;gt;, return a value to the driver. Transformations are lazy: Spark records them and computes nothing until an action needs a result.&amp;lt;ref name=&amp;quot;guide&amp;quot; /&amp;gt; Each RDD is divided into [[partition]]s, and the executors process one partition per task.&lt;br /&gt;
&lt;br /&gt;
Fault tolerance comes from &amp;#039;&amp;#039;&amp;#039;lineage&amp;#039;&amp;#039;&amp;#039;, the record of the transformations that built an RDD. If a partition is lost, Spark recomputes it from that record instead of restoring a replica.&amp;lt;ref name=&amp;quot;guide&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;paper&amp;quot; /&amp;gt; An RDD can be kept for reuse with &amp;lt;code&amp;gt;persist()&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cache()&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;cache()&amp;lt;/code&amp;gt; uses the default storage level &amp;lt;code&amp;gt;MEMORY_ONLY&amp;lt;/code&amp;gt;, and other storage levels keep the data serialized, on disk or replicated.&amp;lt;ref name=&amp;quot;guide&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RDD compared with DataFrame and Dataset ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! !! RDD !! DataFrame !! Dataset&lt;br /&gt;
|-&lt;br /&gt;
! Element type&lt;br /&gt;
| Any JVM or Python object, opaque to Spark&lt;br /&gt;
| Rows with a schema of named, typed columns&lt;br /&gt;
| Typed JVM objects with an encoder (Scala and Java only)&lt;br /&gt;
|-&lt;br /&gt;
! Optimization&lt;br /&gt;
| None by Spark SQL; the user&amp;#039;s functions run as written&lt;br /&gt;
| Spark SQL uses the schema to optimize the query&lt;br /&gt;
| Spark SQL uses the schema to optimize the query&lt;br /&gt;
|-&lt;br /&gt;
! Languages&lt;br /&gt;
| Scala, Java, Python&lt;br /&gt;
| Scala, Java, Python, R&lt;br /&gt;
| Scala, Java&lt;br /&gt;
|-&lt;br /&gt;
! Spark Connect&lt;br /&gt;
| Not supported&lt;br /&gt;
| Supported&lt;br /&gt;
| Supported in the Scala client&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Spark quick start recommends the Dataset over the RDD because it is strongly typed like an RDD but has better performance.&amp;lt;ref name=&amp;quot;quick&amp;quot; /&amp;gt; The Spark SQL guide describes the Dataset, added in Spark 1.6, as combining the benefits of RDDs (strong typing and lambda functions) with Spark SQL&amp;#039;s optimized execution engine, and a DataFrame as a Dataset organized into named columns. Python and R have no Dataset API but use DataFrames.&amp;lt;ref&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/sql-programming-guide.html |title=Spark SQL, DataFrames and Datasets Guide (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;connect&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Where RDDs still appear ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Older libraries.&amp;#039;&amp;#039;&amp;#039; [[GraphX]] represents graphs as RDDs, and a DStream in [[Spark Streaming (DStreams)]] is a sequence of RDDs.&amp;lt;ref&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/streaming-programming-guide.html |title=Spark Streaming Programming Guide (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt; The RDD-based machine learning package, [[spark.mllib (RDD-based API)]], is in maintenance mode.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Low-level control.&amp;#039;&amp;#039;&amp;#039; The RDD API gives direct control over partitioning and over functions applied to each element, which some programs use for work that does not fit a tabular schema.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Execution internals.&amp;#039;&amp;#039;&amp;#039; DataFrame and SQL queries also end up as RDDs: in Spark 4.3.0, executing a physical plan node (&amp;lt;code&amp;gt;SparkPlan.execute()&amp;lt;/code&amp;gt;) returns an RDD of internal rows.&amp;lt;ref&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkPlan.scala |title=SparkPlan.scala (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-22}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
A word count with the RDD API in PySpark, in classic mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pyspark.sql import SparkSession&lt;br /&gt;
&lt;br /&gt;
spark = SparkSession.builder.master(&amp;quot;local[*]&amp;quot;).getOrCreate()&lt;br /&gt;
sc = spark.sparkContext&lt;br /&gt;
&lt;br /&gt;
lines = sc.parallelize([&amp;quot;a b&amp;quot;, &amp;quot;b c&amp;quot;, &amp;quot;c&amp;quot;])&lt;br /&gt;
counts = (lines.flatMap(lambda line: line.split())&lt;br /&gt;
               .map(lambda word: (word, 1))&lt;br /&gt;
               .reduceByKey(lambda a, b: a + b))&lt;br /&gt;
&lt;br /&gt;
print(sorted(counts.collect()))  # [(&amp;#039;a&amp;#039;, 1), (&amp;#039;b&amp;#039;, 2), (&amp;#039;c&amp;#039;, 2)]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The same result with the DataFrame API also runs through Spark Connect:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pyspark.sql import functions as F&lt;br /&gt;
&lt;br /&gt;
df = spark.createDataFrame([(&amp;quot;a b&amp;quot;,), (&amp;quot;b c&amp;quot;,), (&amp;quot;c&amp;quot;,)], [&amp;quot;line&amp;quot;])&lt;br /&gt;
df.select(F.explode(F.split(&amp;quot;line&amp;quot;, &amp;quot; &amp;quot;)).alias(&amp;quot;word&amp;quot;)).groupBy(&amp;quot;word&amp;quot;).count().show()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Apache Spark]]&lt;br /&gt;
* [[Spark Connect]]&lt;br /&gt;
* [[Partition]]&lt;br /&gt;
* [[Executor]]&lt;br /&gt;
* [[GraphX]]&lt;br /&gt;
* [[spark.mllib (RDD-based API)]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Navbox open lakehouse}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Concepts]]&lt;br /&gt;
[[Category:Glossary terms]]&lt;br /&gt;
[[Category:Apache Spark]]&lt;/div&gt;</summary>
		<author><name>Open Lakehouse Wiki sync</name></author>
	</entry>
</feed>