Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Apache Spark Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-apache-spark-knowledge-patch)
---
name: apache-spark-knowledge-patch
description: Apache Spark
version: "4.3.0"
license: MIT
metadata:
author: Nevaberry
---
# Apache Spark compatibility guidance
Load this skill when migrating Spark applications, investigating changed behavior,
or working with SQL, DataFrames, streaming, connectors, Python APIs, or deployment settings.
Use the topic references for detailed, attributed guidance and examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Spark Connect, ML, and Declarative Pipelines](references/connect-ml-and-pipelines.md) | Connect sessions and clients; ML models and evaluation; GraphX; Declarative Pipelines and Auto CDC |
| [Data sources, catalogs, and file formats](references/data-sources-and-formats.md) | JDBC mappings; catalogs and Data Source V2; Hive; Parquet, ORC, Avro, Protobuf, JSON, CSV, and XML |
| [Dependencies, runtimes, and packaging](references/dependencies-and-packaging.md) | Language requirements; bundled libraries; builds, artifacts, containers, and release tooling |
| [Deployment, security, and observability](references/deployment-security-observability.md) | Kubernetes, YARN, Standalone, Mesos, and EC2; security, metrics, event logs, and UI |
| [Migration and runtime behavior](references/migration-and-runtime.md) | RDDs, shuffle, retries, serialization, compression, scheduling, and configuration |
| [PySpark, Arrow, and pandas API on Spark](references/python-and-pandas.md) | Python APIs and schemas; Arrow exchange; UDFs and UDTFs; pandas API on Spark |
| [SQL and DataFrame behavior](references/sql-and-dataframes.md) | SQL resolution and scripting; joins, aggregates, windows, types, casts, and DataFrames |
| [Structured Streaming and state](references/streaming-and-state.md) | Triggers, Real-Time Mode, state stores, checkpoints, recovery, and streaming sources |
## Breaking changes and deprecations
### Python runtime requirements
Spark 4.3 drops Python 3.10 support and raises the minimum NumPy version to `1.23.2`.
### PyPy support
For Spark 4.2: Spark 4.2 drops official PyPy support. Run PySpark on CPython.
### Spark ML imports with Spark Connect
For Spark 4.0.0: Use the standard `pyspark.ml` namespace for supported Spark ML operations in a Connect session. The `pyspark.ml.connect` namespace is deprecated. [SPARK-50812](https://issues.apache.org/jira/browse/SPARK-50812), [SPARK-50828](https://issues.apache.org/jira/browse/SPARK-50828)
### PySpark wildcard imports
For Spark 4.0: `from pyspark.sql.functions import *` now exports only functions. Import DataFrame, Column, and schema types from their defining modules.
```python
from pyspark.sql import Column, DataFrame
from pyspark.sql.types import StructType
```
### Removed blacklist configuration aliases
For Spark 4.1: Spark ignores configuration aliases matching `*.blacklist.*`. Replace them with their corresponding configuration keys introduced in Spark 3.1.0.
### Derby JDBC data source
For Spark 4.2: Spark deprecates support for the Derby JDBC data source.
### Data source task metric merging
For Spark 4.2: `CustomTaskMetric.mergeWith` sums the two metric values by default. Connector authors must override it for metrics such as maxima, averages, ratios, or gauges that need a different merge rule.
### Missing streaming checkpoint metadata
For Spark 4.2: Restarting a query with missing checkpoint metadata fails with `STREAMING_CHECKPOINT_MISSING_METADATA_FILE` when an offset or commit log contains data. Restore the metadata file or use a new checkpoint location.
Set `spark.sql.streaming.checkpoint.verifyMetadataExists.enabled=false` to restore automatic query ID generation in this case, which can duplicate data in exactly-once sinks.
### State commits with foreachBatch
For Spark 4.1.0: Spark raises an error if a stateful micro-batch ends without committing its state stores. A `foreachBatch` callback must fully consume the batch output so the stores can commit.
### Iterator returns from mapInPandas
A `mapInPandas` callback must return an iterator of pandas DataFrames. If the callback builds a list of output batches, return `iter(output_batches)` or yield the batches.
### Python data source Arrow schema validation
For Spark 4.2: Python data sources must return Arrow column types that match their declared schema. A column type mismatch raises `DATA_SOURCE_RETURN_SCHEMA_MISMATCH`.
### Nullable integers in pandas UDF batches
For Spark 4.2: A pandas UDF receives a nullable integer column as pandas `Int8`, `Int16`, `Int32`, or `Int64` when the batch contains nulls. Update UDF code that expected `float64` for those batches.
### Dropping missing labels in pandas API on Spark
For Spark 4.2: `DataFrame.drop` and `Series.drop` now raise `KeyError` if any requested label is missing. Pass `errors="ignore"` to drop the labels that exist.
### Duplicate CTE names
For Spark 4.2: Within one `WITH` clause, CTE names differing only in case now fail at parse time with `DUPLICATED_CTE_NAMES`, regardless of `spark.sql.caseSensitive`. Rename the conflicting CTEs.
### SQL UDF parameter name collisions
For Spark 4.2: A bare reference in a SQL UDF body resolves to the parameterless built-in when a parameter shares its name with `current_user`, `current_date`, `current_time`, `current_timestamp`, `user`, `session_user`, or `grouping__id`. Rename the parameter or set `spark.sql.legacy.allowUdfParameterToShadowParameterlessFunction=true` to restore parameter precedence.
## Defaults and compatibility switches
### Arrow for PySpark data exchange
For Spark 4.2: PySpark uses Arrow by default for columnar data exchange with the JVM. Set `spark.sql.execution.arrow.pyspark.enabled=false` to use the previous row-based exchange.
### Arrow optimization for regular Python UDFs and UDTFs
For Spark 4.2: Regular Python UDFs and UDTFs are Arrow-optimized by default. Set `spark.sql.execution.pythonUDF.arrow.enabled=false` for UDFs or `spark.sql.execution.pythonUDTF.arrow.enabled=false` for UDTFs to restore the previous execution defaults independently.
### ANSI mode in pandas API on Spark
For Spark 4.1: Pandas API on Spark supports ANSI mode by default with `compute.ansi_mode_support=True`. The `compute.fail_on_ansi_mode` safeguard takes effect only when `compute.ansi_mode_support` is `False`.
### Built-in and session namespaces
For Spark 4.2: The virtual `system` catalog exposes built-in and `SparkSessionExtensions` functions through `system.builtin`, and temporary views, temporary functions, and session variables through `system.session`. Two-part references such as `builtin.f()` and `session.f()` now search the corresponding system namespace before the current catalog.
Use an explicit catalog prefix such as `spark_catalog.session.x` to reach a persistent object, or set `spark.sql.legacy.persistentCatalogFirst=true` to restore current-catalog precedence.
### SQL name-resolution path
For Spark 4.2: Set `spark.sql.path.enabled=true` to enable `SET PATH` and path-based resolution of unqualified routines, tables, views, and session variables. Configure the default with `spark.sql.defaultPath` and inspect the active path with `SELECT current_path()`.
With the flag at its default of `false`, Spark uses a fixed path and rejects `SET PATH` with `UNSUPPORTED_FEATURE.SET_PATH_WHEN_DISABLED`.
### Standalone Master REST API
For Spark 4.1: The Standalone Master provides its REST API by default. Set `spark.master.rest.enabled=false` to disable it.
### Kubernetes driver pod addressing
`spark.kubernetes.executor.useDriverPodIP` now defaults to `true`.
### Spark UI security defaults
The Spark UI sends a Content-Security-Policy header by default through `spark.ui.contentSecurityPolicy.enabled`. The default for `spark.ui.xXssProtection` is now `0`.
### Kubernetes container privilege escalation
Spark defaults `allowPrivilegeEscalation` to `false` for both driver and executor containers.
## SQL and DataFrame capabilities
### Nanosecond timestamp types (preview)
Set `spark.sql.timestampNanosTypes.enabled=true` to use `TIMESTAMP_NTZ(p)` and `TIMESTAMP_LTZ(p)` with precision 7 through 9. The preview includes `timestamp_nanos`, `unix_nanos`, `current_timestamp(p)`, and support in Parquet, ORC, JSON, CSV, XML, Avro, JDBC, Arrow, and Spark Connect.
```sql
SET spark.sql.timestampNanosTypes.enabled=true;
SELECT CAST('2026-10-30 12:34:56.123456789' AS TIMESTAMP_NTZ(9));
```
### SQL ASOF joins
Set `spark.sql.join.asofJoin.enabled=true` to use `ASOF JOIN ... MATCH_CONDITION` for point-in-time matches, such as joining each event to the latest observation available at its time. The flag defaults to `false`. [ASOF join syntax](https://issues.apache.org/jira/browse/SPARK-58122)
### BIN BY relation operator
Set `spark.sql.binByRelationOperator.enabled=true` to use `BIN BY` to align range-typed rows to fixed bin boundaries. The flag defaults to `false`. [BIN BY](https://issues.apache.org/jira/browse/SPARK-57133)
### JSON_TABLE
Use the `JSON_TABLE` table-valued function to turn JSON into relational rows and columns. [JSON_TABLE](https://issues.apache.org/jira/browse/SPARK-58366)
### ANSI UNNEST
Use `UNNEST` in `FROM` to expand a collection into rows, as in `SELECT n FROM UNNEST(array(1, 2)) AS t(n);`.
### Table-name time travel
For tables that support time travel, SQL accepts table-name `@` syntax for both version-based and timestamp-based snapshot selection. [Version syntax](https://issues.apache.org/jira/browse/SPARK-57421) · [Timestamp syntax](https://issues.apache.org/jira/browse/SPARK-58012)
### Cumulative counter deltas
Use the `counter_diff` window function to convert cumulative counter readings to deltas.
### Combining DataFrame projections
Use `df.select("id").zip(df.select("value"))` to combine column projections. `DataFrame.zip` also works over Spark Connect.
## Streaming, Connect, and Declarative Pipelines
### Stateful Structured Streaming Real-Time Mode
Real-Time Mode now supports streaming aggregations, `dropDuplicates`, Scala and Java `transformWithState`, and asynchronous progress tracking. Provision enough task slots for the stages that run concurrently, since Spark rejects the stage group if it cannot schedule the group together.
### SCD Type 2 Auto CDC
SCD Type 2 retains each key’s history in rows bounded by `__START_AT` and `__END_AT` and requires a target catalog that supports Data Source V2 row-level operations. Set `stored_as_scd_type=2` in Python or Spark Connect, with `track_history_column_list` to choose which columns trigger a new version.
### SQL Auto CDC flows
Define flows with `CREATE FLOW ... AS AUTO CDC INTO`. For Type 2 history, add `STORED AS SCD TYPE 2` and optionally `TRACK HISTORY ON` to select the tracked columns. [Declarative Pipelines](https://spark.apache.org/releases/spark-release-4-3-0.html#declarative-pipelines)
### Auto CDC per-flow configuration
Pass `spark_confs` to `create_auto_cdc_flow` to supply Spark settings for the flow.
### Spark Connect JDBC compatibility
The driver supports `ARRAY`, `MAP`, and `STRUCT` results, plus primary-key, foreign-key, and type metadata through `DatabaseMetaData`. Client failures surface as `SQLException`, with SQLSTATE class `08` for connection errors.
### Data Source V2 metadata in the Thrift Server
Set `spark.sql.thriftServer.catalogMetadata.enabled=true` to make JDBC metadata operations on the Thrift Server aware of Data Source V2 catalogs.