<?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=Native_execution_engine_(Spark)</id>
	<title>Native execution engine (Spark) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Native_execution_engine_(Spark)"/>
	<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Native_execution_engine_(Spark)&amp;action=history"/>
	<updated>2026-12-06T00:07:43Z</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=Native_execution_engine_(Spark)&amp;diff=161&amp;oldid=prev</id>
		<title>Open Lakehouse Wiki sync: Sync from open-lakehouse/wiki@7c9abaa</title>
		<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Native_execution_engine_(Spark)&amp;diff=161&amp;oldid=prev"/>
		<updated>2026-11-25T00:52:45Z</updated>

		<summary type="html">&lt;p&gt;Sync from open-lakehouse/wiki@7c9abaa&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            = Native execution engine (Spark)&lt;br /&gt;
| also_known_as   = Native engine, native accelerator, vectorized native execution&lt;br /&gt;
| field           = Query execution performance&lt;br /&gt;
| key_parts       = Plan conversion from Spark physical plans, vectorized columnar operators in C++ or Rust, off-heap memory, columnar shuffle, fallback to JVM operators&lt;br /&gt;
| implementations = [[Apache Gluten]] (with [[Velox]] or ClickHouse), [[Apache DataFusion Comet]], Photon (Databricks, proprietary)&lt;br /&gt;
| related         = [[Apache Spark]], [[Project Tungsten]], [[Whole-stage code generation]], [[GPU acceleration in Spark]]&lt;br /&gt;
}}&lt;br /&gt;
{{Verified|2026-11-23|the Apache Spark 4.3.0 release (2026-10-30) and the v4.3.0 source tag (SQLConf, WholeStageCodegenExec), the Apache Gluten README and configuration guide (release 1.7.0), the Apache DataFusion Comet README, operator guide and Comet versus Gluten comparison (release 1.2.0), the Databricks Photon documentation, the Crossref record of the SIGMOD 2022 Photon paper, and the NVIDIA cuDF plugin for Apache Spark README}}&lt;br /&gt;
&lt;br /&gt;
In [[Apache Spark]], a &amp;#039;&amp;#039;&amp;#039;native execution engine&amp;#039;&amp;#039;&amp;#039; is a component that runs the physical operators of a Spark SQL or DataFrame query as vectorized, columnar code compiled to machine code (usually C++ or Rust) instead of as Java bytecode generated by Spark&amp;#039;s whole-stage code generation in the Java virtual machine (JVM). Spark still parses, optimizes and schedules the query; the native engine replaces only the execution of the operators it supports and hands the rest back to Spark. Open source examples are [[Apache Gluten]] and [[Apache DataFusion Comet]]; Databricks Photon is a proprietary example.&amp;lt;ref name=&amp;quot;glreadme&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/gluten/blob/main/README.md |title=Apache Gluten README |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;cmreadme&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/datafusion-comet/blob/1.2.0/README.md |title=Apache DataFusion Comet README (1.2.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== What is a native execution engine? ==&lt;br /&gt;
Apache Spark&amp;#039;s own engine runs in the JVM. Since Spark 2.0.0, whole-stage code generation, part of [[Project Tungsten]], compiles chains of operators into one generated Java function per stage; it is on by default through &amp;lt;code&amp;gt;spark.sql.codegen.wholeStage&amp;lt;/code&amp;gt; in Spark 4.3.0.&amp;lt;ref name=&amp;quot;sqlconf&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala |title=SQLConf.scala (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;wscg&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/core/src/main/scala/org/apache/spark/sql/execution/WholeStageCodegenExec.scala |title=WholeStageCodegenExec.scala (v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A native execution engine for Spark takes the physical plan that Spark has already chosen, converts the supported part of it into a plan for a native library, and runs that part outside the JVM on columnar batches. Apache Gluten converts the plan to Substrait and passes it through the Java Native Interface (JNI) to [[Velox]] or ClickHouse.&amp;lt;ref name=&amp;quot;glreadme&amp;quot; /&amp;gt; Apache DataFusion Comet serializes it in its own Protocol Buffers format and runs it with Apache DataFusion, written in Rust.&amp;lt;ref name=&amp;quot;cmp&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/datafusion-comet/blob/1.2.0/docs/source/about/gluten_comparison.md |title=Comparison of Comet and Gluten |publisher=Apache DataFusion Comet |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How does a native engine plug into Apache Spark? ==&lt;br /&gt;
Open source native engines attach to Apache Spark through its public extension points. Both Gluten and Comet are enabled with the &amp;lt;code&amp;gt;spark.plugins&amp;lt;/code&amp;gt; setting, turn on Spark off-heap memory (&amp;lt;code&amp;gt;spark.memory.offHeap.enabled&amp;lt;/code&amp;gt;, which is false by default), and replace &amp;lt;code&amp;gt;spark.shuffle.manager&amp;lt;/code&amp;gt; with a columnar shuffle manager so that data stays columnar between stages.&amp;lt;ref name=&amp;quot;glreadme&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;cmreadme&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;sparkconf&amp;quot;&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-23}}&amp;lt;/ref&amp;gt; Application code, SQL and DataFrame queries do not change.&lt;br /&gt;
&lt;br /&gt;
== What runs natively and what falls back? ==&lt;br /&gt;
A native execution engine for Spark runs only the operators and expressions it supports. Everything else falls back to Spark&amp;#039;s JVM operators, and the engine inserts conversions between its columnar format and Spark&amp;#039;s row format at each boundary. Gluten calls these ColumnarToRow and RowToColumnar transitions.&amp;lt;ref name=&amp;quot;glreadme&amp;quot; /&amp;gt; Comet falls back at the level of a query stage: if a stage contains an unsupported operator, the stage runs in Spark.&amp;lt;ref name=&amp;quot;cmops&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/datafusion-comet/blob/1.2.0/docs/source/user-guide/latest/operators.md |title=Spark Operator Support (1.2.0) |publisher=Apache DataFusion Comet |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; Photon also falls back to the Spark runtime for operations it does not support.&amp;lt;ref name=&amp;quot;photondocs&amp;quot;&amp;gt;{{Cite web |url=https://docs.databricks.com/aws/en/compute/photon |title=What is Photon? |publisher=Databricks |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; Because each transition has a cost, the share of a plan that runs natively matters as much as the speed of the native operators.&lt;br /&gt;
&lt;br /&gt;
== What about Photon? ==&lt;br /&gt;
Photon is the vectorized query engine built by Databricks. Databricks describes Photon as a proprietary part of the Databricks Runtime that is not part of open source Apache Spark and is not distributed with it.&amp;lt;ref name=&amp;quot;photonoss&amp;quot;&amp;gt;{{Cite web |url=https://answers.databricks.com/performance-features-new-spark-photon-relevant-oss-spark |title=What performance features are new in Spark 4.x, and is Photon relevant to OSS Spark? |publisher=Databricks |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; Databricks described it in the paper &amp;quot;Photon: A Fast Query Engine for Lakehouse Systems&amp;quot;, published in the proceedings of the ACM SIGMOD 2022 conference (June 2022).&amp;lt;ref name=&amp;quot;paper&amp;quot;&amp;gt;{{Cite web |url=https://doi.org/10.1145/3514221.3526054 |title=Photon: A Fast Query Engine for Lakehouse Systems (SIGMOD &amp;#039;22) |publisher=Association for Computing Machinery |date=2022-06-10 |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; The Databricks documentation states that Photon replaces the JVM-based Spark SQL execution engine with a native C++ runtime for supported operations, keeps Spark&amp;#039;s Catalyst optimizer for planning, and is compatible with Apache Spark APIs.&amp;lt;ref name=&amp;quot;photondocs&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Native engines compared ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! !! Apache Spark (JVM, Tungsten codegen) !! Apache Gluten (Velox backend) !! Apache Gluten (ClickHouse backend) !! Apache DataFusion Comet !! Photon&lt;br /&gt;
|-&lt;br /&gt;
! Language of the execution code&lt;br /&gt;
| Scala and Java; generated Java code in the JVM&amp;lt;ref name=&amp;quot;wscg&amp;quot; /&amp;gt; || C++ ([[Velox]]), with a Scala/Java plugin layer&amp;lt;ref name=&amp;quot;glreadme&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;velox&amp;quot;&amp;gt;{{Cite web |url=https://github.com/facebookincubator/velox/blob/main/README.md |title=Velox README |publisher=Meta (GitHub) |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; || C++ (ClickHouse built as the library &amp;lt;code&amp;gt;libch.so&amp;lt;/code&amp;gt;)&amp;lt;ref name=&amp;quot;glch&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/gluten/blob/main/docs/backends/clickhouse/get-started/ClickHouse.md |title=ClickHouse Backend |publisher=Apache Gluten |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; || Rust (Apache DataFusion), with a Scala/Java plugin layer&amp;lt;ref name=&amp;quot;cmp&amp;quot; /&amp;gt; || C++&amp;lt;ref name=&amp;quot;photondocs&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! License / open source&lt;br /&gt;
| Apache License 2.0&amp;lt;ref name=&amp;quot;sparklic&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/LICENSE |title=LICENSE (apache/spark v4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; || Apache License 2.0 (Gluten); Velox is also Apache License 2.0&amp;lt;ref name=&amp;quot;velox&amp;quot; /&amp;gt; || Apache License 2.0 (Gluten) || Apache License 2.0&amp;lt;ref name=&amp;quot;cmreadme&amp;quot; /&amp;gt; || Proprietary; not open source&amp;lt;ref name=&amp;quot;photonoss&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! Foundation status&lt;br /&gt;
| ASF top-level project&amp;lt;ref name=&amp;quot;sparkhome&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/ |title=Apache Spark |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; || ASF top-level project since 2026-02-18&amp;lt;ref name=&amp;quot;incubator&amp;quot;&amp;gt;{{Cite web |url=https://incubator.apache.org/projects/gluten.html |title=Apache Gluten Project Incubation Status |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; || Same project as Gluten (Velox backend) || Sub-project of Apache DataFusion; a proposal to become top-level project &amp;quot;Apache Comet&amp;quot; is pending&amp;lt;ref name=&amp;quot;cmtlp&amp;quot;&amp;gt;{{Cite web |url=https://datafusion.apache.org/comet/about/top_level_project_proposal.html |title=Proposal to Establish Apache Comet as a Top-Level Project |publisher=Apache DataFusion Comet |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; || None (Databricks product)&lt;br /&gt;
|-&lt;br /&gt;
! How it is enabled&lt;br /&gt;
| Default; &amp;lt;code&amp;gt;spark.sql.codegen.wholeStage=true&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;sqlconf&amp;quot; /&amp;gt; || &amp;lt;code&amp;gt;spark.plugins=org.apache.gluten.GlutenPlugin&amp;lt;/code&amp;gt;, off-heap memory, &amp;lt;code&amp;gt;ColumnarShuffleManager&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;glreadme&amp;quot; /&amp;gt; || Same plugin plus &amp;lt;code&amp;gt;spark.gluten.sql.columnar.libpath&amp;lt;/code&amp;gt; pointing at &amp;lt;code&amp;gt;libch.so&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;glch&amp;quot; /&amp;gt; || &amp;lt;code&amp;gt;spark.plugins=org.apache.spark.CometPlugin&amp;lt;/code&amp;gt;, off-heap memory, &amp;lt;code&amp;gt;CometShuffleManager&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;cmreadme&amp;quot; /&amp;gt; || Databricks compute setting; default on SQL warehouses&amp;lt;ref name=&amp;quot;photondocs&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! Fallback behaviour&lt;br /&gt;
| Not applicable; operators that do not support code generation run without it || Per operator, to vanilla Spark, with ColumnarToRow and RowToColumnar transitions&amp;lt;ref name=&amp;quot;glreadme&amp;quot; /&amp;gt; || Same mechanism as the Velox backend&amp;lt;ref name=&amp;quot;glreadme&amp;quot; /&amp;gt; || Per query stage, to Spark&amp;lt;ref name=&amp;quot;cmops&amp;quot; /&amp;gt; || To the Spark runtime for unsupported operations&amp;lt;ref name=&amp;quot;photondocs&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! Primary source&lt;br /&gt;
| [https://spark.apache.org/docs/4.3.0/ Spark 4.3.0 documentation] || [https://gluten.apache.org gluten.apache.org] || [https://github.com/apache/gluten/blob/main/docs/backends/clickhouse/get-started/ClickHouse.md Gluten ClickHouse backend guide] || [https://datafusion.apache.org/comet datafusion.apache.org/comet] || [https://docs.databricks.com/aws/en/compute/photon Databricks documentation]; SIGMOD 2022 paper&amp;lt;ref name=&amp;quot;paper&amp;quot; /&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== What a native execution engine is not ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Not Project Tungsten.&amp;#039;&amp;#039;&amp;#039; [[Project Tungsten]] made Spark&amp;#039;s JVM execution faster with binary rows, managed memory and generated Java code; it does not leave the JVM. Native engines replace those JVM operators.&amp;lt;ref name=&amp;quot;wscg&amp;quot; /&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Not GPU acceleration.&amp;#039;&amp;#039;&amp;#039; GPU plugins, such as the NVIDIA cuDF plugin for Apache Spark (formerly the RAPIDS Accelerator for Apache Spark), also replace Spark operators, but run them on GPUs through the cuDF libraries.&amp;lt;ref name=&amp;quot;cudf&amp;quot;&amp;gt;{{Cite web |url=https://github.com/NVIDIA/spark-rapids/blob/main/README.md |title=NVIDIA cuDF plugin for Apache Spark README |publisher=NVIDIA (GitHub) |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; See [[GPU acceleration in Spark]].&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Not a separate query engine.&amp;#039;&amp;#039;&amp;#039; A native execution engine for Spark has no SQL parser or scheduler of its own in this setup; Spark plans and distributes the work.&amp;lt;ref name=&amp;quot;glreadme&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Apache Gluten]]&lt;br /&gt;
* [[Apache DataFusion Comet]]&lt;br /&gt;
* [[Velox]]&lt;br /&gt;
* [[Project Tungsten]]&lt;br /&gt;
* [[Whole-stage code generation]]&lt;br /&gt;
* [[GPU acceleration in Spark]]&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;br /&gt;
[[Category:Query engines]]&lt;/div&gt;</summary>
		<author><name>Open Lakehouse Wiki sync</name></author>
	</entry>
</feed>