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

Yicong Huang reassigned SPARK-59824:
------------------------------------

    Assignee: Tengfei Huang

> 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
>    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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to