You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yicong Huang (Jira)" <ji...@apache.org> on 2026/10/09 08:44:00 UTC

[jira] [Updated] (SPARK-59824) Guard against oversized rows during pickle Python UDF input serialization

     [ https://issues.apache.org/jira/browse/SPARK-59824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yicong Huang updated SPARK-59824:
---------------------------------
    Component/s: SQL

> Guard against oversized rows during pickle Python UDF input serialization
> -------------------------------------------------------------------------
>
>                 Key: SPARK-59824
>                 URL: https://issues.apache.org/jira/browse/SPARK-59824
>             Project: Spark
>          Issue Type: Task
>          Components: PySpark, SQL
>    Affects Versions: 4.2.0
>            Reporter: Tengfei Huang
>            Assignee: Tengfei Huang
>            Priority: Major
>              Labels: pull-request-available
>
> h3. Problem
> For non-Arrow Python UDFs, Spark evaluates the UDF input expressions and serializes the projected row using Java conversion followed by pickle serialization.
> A single row can contain a very large string or binary value. Because batching cannot split an individual row, converting and pickling it may create several large in-memory copies and cause an executor OOM before the row reaches the Python worker.
> Existing batch-size limits do not protect against this case.
> h3. Proposed change
> Add an optional row-size guard for pickle-based Python UDFs.
> The guard should:
>  * Run after UDF input expressions are projected, so computed values such as {{{}cast{}}}, {{{}concat{}}}, and {{substring}} are measured.
>  * Run before Java conversion and pickle serialization.
>  * Estimate the payload size of supported top-level variable-width arguments, initially strings and binary values.
>  * Fail with a structured error when the estimated size exceeds a configurable threshold based on executor heap.
>  * Introduce no per-row overhead when disabled or when the projected schema has no supported variable-width arguments.
> Nested arrays, maps, and structs are intentionally excluded initially to avoid a recursive traversal of every input value.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org