Skip to the page
Tecyfy

PySpark

Writing and tuning PySpark and Spark code for large data.

PySparkHow to read a Spark physical plan, line by lineRead a Spark physical plan from the bottom up: scans and filters first, then each Exchange, which is a shuffle and the end of a stage, then the joins and aggregates above it. A real plan from Spark 4.2 explained line by line, what the stars and numbers mean, and why explain() before a run is not the plan that ran.28 October 2026 · 8 min readPySparkSpark cluster mode vs client mode: where the driver runsIn client mode, the Spark driver runs inside the spark-submit process on the machine you submit from; in cluster mode, the cluster starts it on one of its own nodes. That one choice decides whether closing your laptop kills the job, where the logs go and how driver memory is set. When to use each, on YARN, Kubernetes and standalone, and what Databricks and Spark Connect do instead.27 October 2026 · 7 min readPySparkpandas vs Polars vs PySpark: which to use for your data sizepandas works in memory with a mostly single-threaded core, Polars runs lazy queries on every core and, since Polars 2.0, streams them in batches by default, and PySpark spreads work over a cluster. How to choose by the size of your data and where it lives, the same job written in all 3, and what changed in pandas 3 and Polars 2.26 October 2026 · 8 min readPySparkSpark out of memory: read the error, then fix the right thingA Spark job that runs out of memory fails with one of 4 errors, and each needs a different fix: Java heap space on an executor, Container killed by YARN, maxResultSize on the driver, or a driver heap error after collect(). Find which you have, then change the one setting or line of code that matches.25 October 2026 · 9 min readPySparkSpark 4.2 Auto CDC: SCD type 1 without writing MERGEApache Spark 4.2 adds Auto CDC to Spark Declarative Pipelines: create_auto_cdc_flow applies a change feed to a table, in the right order even when events arrive late, with deletes handled. What it does, the code, what is not in 4.2 yet (SQL and SCD type 2), and how it differs from AUTO CDC on Databricks.22 October 2026 · 7 min readPySparkApache Spark 4.2 features: what's new and what breaksSpark 4.2.0, released on 14 July 2026, adds geospatial types, change data capture with a CHANGES clause, Auto CDC in declarative pipelines, metric views, a NEAREST BY join and Arrow-optimized Python UDFs by default. What each one does, the code, and the 10 changes to check before you upgrade.22 October 2026 · 8 min readPySparkSpark VARIANT vs JSON Strings: A Benchmark on 2 Million EventsHow the VARIANT type in Apache Spark 4 stores JSON, how to read it with variant_get, and what it is really worth: measured against get_json_object, from_json and a Python UDF on 2 million events, with the file sizes.30 June 2025 · 7 min readPySparkSpark SQL Pipe Syntax (|>): A Practical Guide with ExamplesSpark 4.0 added SQL pipe syntax: a query written as steps joined by |>, read top to bottom. Every step with a query we ran, the three mistakes that cause errors, and whether it changes performance.29 June 2025 · 8 min readPySparkWhat’s New in Apache Spark 4.0.0: ANSI SQL, Spark Connect, Python and StreamingApache Spark 4.0.0, released in May 2025, turns on ANSI SQL by default, requires Java 17, makes Spark Connect practical and adds pipe syntax, VARIANT and SQL functions. What changed and what to check before upgrading.3 June 2025 · 9 min readPySparkPySpark Joins: Broadcast, Sort-Merge and Shuffled Hash, and How Spark ChoosesHow Spark joins two DataFrames: broadcast hash joins, sort-merge joins and shuffled hash joins, how Spark chooses between them, the join hints, what adaptive query execution changes at run time, and how to read the plan. Plans from PySpark 4.2.25 March 2025 · 8 min readPySparkData Skew in PySpark: How to Find It and Fix ItWhy one Spark task runs long after the rest, how to find the hot keys, and four fixes that work: adaptive query execution's skew join, broadcast joins, salting and handling placeholder keys. Every example run on PySpark 4.2.10 February 2025 · 8 min read
All articles