Skip to content

[SPARK-57452][DOCS] Add missing 4.2 behavior changes to migration guides#56553

Open
cloud-fan wants to merge 4 commits into
apache:masterfrom
cloud-fan:SPARK-57452-migration-guide
Open

[SPARK-57452][DOCS] Add missing 4.2 behavior changes to migration guides#56553
cloud-fan wants to merge 4 commits into
apache:masterfrom
cloud-fan:SPARK-57452-migration-guide

Conversation

@cloud-fan

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

An audit of Spark 4.2 commits (SPARK-57452) found a number of user-facing behavior changes that were not documented in the migration guides. This PR adds entries for the subset of those changes that require a user to take action to migrate, across three guides:

PySpark (python/docs/source/migration_guide/pyspark_upgrade.rst):

  • PyPy is no longer officially supported.
  • Minimum pandas version for Spark Connect raised to 2.2.0.
  • createDataFrame from a NumPy ndarray now requires PyArrow and may infer a different schema.
  • Pandas UDFs receive nullable integer columns as a pandas nullable Int dtype instead of float64.
  • Observation.get raises on metric collection failure instead of returning an empty dictionary.
  • DataFrame.drop / Series.drop (pandas API on Spark) raise KeyError if any label is missing.
  • Python Data Sources fail with DATA_SOURCE_RETURN_SCHEMA_MISMATCH on schema mismatch.
  • Python streaming data sources fail when reported offsets do not advance.

SQL (docs/sql-migration-guide.md):

  • Duplicate CTE names within a WITH clause are detected case-insensitively.
  • NATURAL JOIN honors spark.sql.caseSensitive when choosing join columns.
  • Built-in parameterless functions take precedence over same-named UDFs.
  • SET CATALOG <name> resolves a bare name as a session variable first.

Structured Streaming (docs/streaming/ss-migration-guide.md):

  • Restarting from a checkpoint with missing required metadata now fails by default.

Behavior changes that are purely cosmetic/UI, internal, additive, or correctness fixes requiring no user action were intentionally excluded.

Why are the changes needed?

Without these entries, users upgrading to Spark 4.2 can hit silent result changes, new errors on previously-valid input, or dependency/environment requirements with no documented guidance on how to migrate.

Does this PR introduce any user-facing change?

No. This is a documentation-only change.

How was this patch tested?

Documentation-only change; verified by review of the rendered Markdown/reStructuredText.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8)

Adds migration-guide entries for behavior changes that shipped in Spark
4.2 but were missing from the migration guides, covering only changes
that require user action to migrate.

Co-authored-by: Isaac
@cloud-fan

Copy link
Copy Markdown
Contributor Author

cc @huaxingao @dongjoon-hyun

* In Spark 4.2, regular Python UDFs are Arrow-optimized by default. The configuration ``spark.sql.execution.pythonUDF.arrow.enabled`` now defaults to true. To restore the legacy behavior for Python UDF execution, set ``spark.sql.execution.pythonUDF.arrow.enabled`` to ``false``.
* In Spark 4.2, regular Python UDTFs are Arrow-optimized by default. The configuration ``spark.sql.execution.pythonUDTF.arrow.enabled`` now defaults to true. To restore the legacy behavior for Python UDTF execution, set ``spark.sql.execution.pythonUDTF.arrow.enabled`` to ``false``.
* In Spark 4.2, PyPy is no longer officially supported. Run PySpark on CPython instead.
* In Spark 4.2, the minimum supported version of pandas for Spark Connect has been raised to 2.2.0. Upgrade pandas to 2.2.0 or later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this or pyspark already have a doc page for version bumps? cc @HyukjinKwon @gaogaotiantian

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is about a SQL UDF parameter shadowing a parameterless
built-in, not a registered UDF named like a built-in. Describe the
affected functions and the legacy restore config.

Co-authored-by: Isaac
SPARK-55314 changed Observation.get to propagate the underlying error
on metric collection failure for both Scala (SparkRuntimeException) and
Python (PySparkException), via the shared sql/api Observation. It is a
cross-language Dataset API change, not PySpark-only, so it belongs in
the SQL migration guide.

Co-authored-by: Isaac
- Drop the pandas 2.2.0 minimum entry: it shipped in Spark 4.1
  (SPARK-52840) and is PySpark-wide, not Connect-only, so it does not
  belong in the 4.2 guide.
- SET CATALOG: use a string literal (not quoting) to force literal
  interpretation; backtick-quoted names follow the same resolution path.
- Python Data Source: only the Arrow column-type check is new in 4.2
  (SPARK-55583); count/name mismatches already raised the error.
- Streaming offset entry: narrow to SimpleDataSourceStreamReader and the
  SIMPLE_STREAM_READER_OFFSET_DID_NOT_ADVANCE error.
- Streaming checkpoint: name the error and add the restore config
  spark.sql.streaming.checkpoint.verifyMetadataExists.enabled (SPARK-55058).
- CTE: note it is parse-time, DUPLICATED_CTE_NAMES, and independent of
  spark.sql.caseSensitive. Minor wording fixes for numpy/pandas-UDF/drop.

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants