Skip to content
Back to skills

Apache Spark Knowledge Patch

ASecurity

Apache Spark

  • 25 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 5, 2026
developmentpythonjavasqlkubernetesapidatabasesecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill apache-spark-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Apache Spark Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Apache Spark Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-apache-spark-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-apache-spark-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: apache-spark-knowledge-patch
description: Apache Spark
version: "4.3.0"
license: MIT
metadata:
  author: Nevaberry
---


# Apache Spark Knowledge Patch

Use this skill when migrating Spark applications, diagnosing changed behavior,
configuring deployments, or working with SQL, DataFrames, streaming, data sources,
Python, Spark Connect, and ML APIs. Load the relevant topic reference for detailed
constraints, examples, and behavior attributed to its source batch.

## Reference index

| Reference | Topics |
| --- | --- |
| [Migration and configuration](references/migration-and-configuration.md) | Removed interfaces, configuration changes, runtime dependencies, builds, release tooling |
| [SQL and DataFrames](references/sql-and-dataframes.md) | Namespaces, views, SQL routines, joins, aggregates, types, encoders, writes |
| [Data sources and connectors](references/data-sources-and-connectors.md) | Files, JDBC mappings, Hive, Thrift Server, V2 catalogs, Kafka, format compatibility |
| [Python and pandas](references/python-and-pandas.md) | Runtime requirements, Arrow, UDFs, Python sources, PySpark, pandas API on Spark |
| [Streaming and state](references/streaming-and-state.md) | Checkpoints, state stores, triggers, DStreams, Declarative Pipelines, Auto CDC |
| [Connect, ML, and extensions](references/connect-ml-and-extensions.md) | Connect sessions, JDBC clients, ML models, SparkR, GraphX, plugins |
| [Operations, security, and observability](references/operations-security-and-observability.md) | Deployment, scheduling, shuffle, submission, authentication, logs, metrics, UI |

## 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

Spark 4.2 drops official PyPy support. Run PySpark on CPython.

### Derby JDBC data source

Spark deprecates support for the Derby JDBC data source.

### Removed blacklist configuration aliases

Spark ignores configuration aliases matching `*.blacklist.*`. Replace them with their corresponding configuration keys introduced in Spark 3.1.0.

### Local shuffle output buffer

Use `spark.shuffle.localDisk.file.output.buffer` to configure the local disk shuffle output buffer. Spark deprecates the earlier `spark.shuffle.unsafe.file.output.buffer` key.

### Spark ML imports with Spark Connect

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 exception identifiers

Use `PySparkException.getCondition()` to retrieve the structured error identifier. `getErrorClass()` is deprecated. [SPARK-50915](https://issues.apache.org/jira/browse/SPARK-50915)

## SQL name resolution and compatibility

### Built-in and session namespaces

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

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`.

### Duplicate CTE names

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

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.

## Python and Arrow execution

### Arrow for PySpark data exchange

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

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.

### Safe Arrow conversion by default

PyArrow now raises errors on unsafe conversions such as integer overflow, floating-point truncation, and loss of precision during PySpark DataFrame creation and return-value serialization for Arrow-enabled UDFs and pandas UDFs. Set `spark.sql.execution.pandas.convertToArrowArraySafely=false` to restore the previous behavior.

### ANSI mode in pandas API on Spark

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`.

### 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.

## Streaming recovery and stateful pipelines

### Missing streaming checkpoint metadata

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

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.

### Leftover state when starting a streaming query

Spark rejects the start of a new streaming query if the checkpoint already contains a nonempty state directory. Use a fresh checkpoint directory for a new query. [SPARK-53103](https://issues.apache.org/jira/browse/SPARK-53103)

### 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)

## File reads and JDBC mappings

### SQL file-read settings and hard failures

SQL table reads use `spark.sql.files.ignoreCorruptFiles` and `spark.sql.files.ignoreMissingFiles` in place of the corresponding `spark.files.*` settings. `org.apache.hadoop.security.AccessControlException` and `org.apache.hadoop.hdfs.BlockMissingException` fail the task even when `ignoreCorruptFiles` is enabled.

### PostgreSQL JDBC timestamp mapping

JDBC reads PostgreSQL `TIMESTAMP WITH TIME ZONE` as Spark `TimestampType` regardless of `preferTimestampNTZ`, and writes `TimestampType` as `TIMESTAMP WITH TIME ZONE`. Set `spark.sql.legacy.postgres.datetimeMapping.enabled=true` to restore the earlier mappings.

### MySQL JDBC timestamp mapping

JDBC reads MySQL `TIMESTAMP` as Spark `TimestampType` regardless of `preferTimestampNTZ`, and writes Spark `TimestampNTZType` as MySQL `DATETIME`. Set `spark.sql.legacy.mysql.timestampNTZMapping.enabled=true` to restore the earlier mappings.

## SQL and DataFrame quick reference

### Filtering window results with `QUALIFY`

Use `QUALIFY` to filter rows by a window function in the same query, as in `SELECT id FROM range(3) QUALIFY row_number() OVER (ORDER BY id) = 1`.

### DataFrame IN subqueries

Pass a single-column DataFrame to `Column.isin` to use it as an `IN` subquery. For example, `df.where(df.id.isin(other.select("id")))` filters `df` to IDs found in `other`.

### 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)

### VARIANT transformations

SQL adds `variant_set`, `variant_insert`, `variant_delete`, `variant_array_append`, and `variant_strip_nulls` for transforming nested `VARIANT` values. The set, insert, and array-append operations also have `try_variant_*` forms.

### Combining DataFrame projections

Use `df.select("id").zip(df.select("value"))` to combine column projections. `DataFrame.zip` also works over Spark Connect.

## Deployment and security defaults

### 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`.

### Standalone REST submission restrictions

Use `spark.master.rest.allowedAppResourcePatterns` to restrict application resources accepted by the Standalone Master REST server. The server also limits request body size.

### Kubernetes container privilege escalation

Spark defaults `allowPrivilegeEscalation` to `false` for both driver and executor containers.

### Fractional task CPUs

`spark.task.cpus` accepts fractional values, as in `--conf spark.task.cpus=0.5`.

## Spark Connect workflows

### Spark Connect session and operation inspection

The Spark Connect REST API can list and inspect sessions and operations. Use the exposed operation IDs to correlate requests end to end.

### Reusing a local Spark Connect server

Launch local PySpark with `SPARK_LOCAL_CONNECT_REUSE=1` to reuse a persistent local Connect server across runs.

### 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.

Files in this skill

  • SKILL.md10.5 KB
  • coverage.json1.3 KB
  • references/connect-ml-and-extensions.md3.3 KB
  • references/data-sources-and-connectors.md5.2 KB
  • references/migration-and-configuration.md13.5 KB
  • references/operations-security-and-observability.md5.4 KB
  • references/python-and-pandas.md6.9 KB
  • references/sql-and-dataframes.md5.6 KB
  • references/streaming-and-state.md3.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.