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

Brij Raj Kishore updated SPARK-59872:
-------------------------------------
    Description: 
Follow-up to [SPARK-43847|https://issues.apache.org/jira/browse/SPARK-43847] 
([PR #56174|https://github.com/apache/spark/pull/56174]).

h3. Problem

{{_read_descriptor_set_file()}} in {{pyspark.sql.protobuf.functions}} currently 
maps only {{FileNotFoundError}} to the structured 
{{PROTOBUF_DESCRIPTOR_FILE_NOT_FOUND}} error condition. Other {{OSError}} 
subclasses ({{PermissionError}}, {{IsADirectoryError}}, etc.) propagate as raw 
Python exceptions, inconsistent with Spark's structured error approach.

h3. Solution

Add a new {{PROTOBUF_DESCRIPTOR_FILE_READ_FAILED}} error condition and map 
remaining {{OSError}} subclasses to a structured {{PySparkRuntimeError}}, 
consistent with the approach taken for {{FileNotFoundError}} in SPARK-43847.

Note: the Scala side currently maps these cases to 
{{CANNOT_PARSE_PROTOBUF_DESCRIPTOR}}, which nchammas noted is not ideal — a 
dedicated Python-specific error condition is more accurate.


  was:
Follow-up to SPARK-43847 (PR #56174).

_read_descriptor_set_file() in pyspark.sql.protobuf.functions currently maps
only FileNotFoundError to the structured PROTOBUF_DESCRIPTOR_FILE_NOT_FOUND
error condition. Other OSError subclasses (PermissionError, IsADirectoryError,
etc.) propagate as raw Python exceptions.

This ticket adds a new PROTOBUF_DESCRIPTOR_FILE_READ_FAILED error condition
and maps those remaining cases to a structured PySparkRuntimeError, consistent
with the approach taken for FileNotFoundError.

The Scala side currently maps these to CANNOT_PARSE_PROTOBUF_DESCRIPTOR, which
nchammas noted is not ideal — a Python-specific error condition is more
accurate.


> [PYTHON] Raise structured PySparkRuntimeError for PermissionError and other 
> OSError subclasses when reading Protobuf descriptor file
> ------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-59872
>                 URL: https://issues.apache.org/jira/browse/SPARK-59872
>             Project: Spark
>          Issue Type: Improvement
>          Components: PySpark
>    Affects Versions: 4.4.0
>            Reporter: Brij Raj Kishore
>            Priority: Minor
>
> Follow-up to [SPARK-43847|https://issues.apache.org/jira/browse/SPARK-43847] 
> ([PR #56174|https://github.com/apache/spark/pull/56174]).
> h3. Problem
> {{_read_descriptor_set_file()}} in {{pyspark.sql.protobuf.functions}} 
> currently maps only {{FileNotFoundError}} to the structured 
> {{PROTOBUF_DESCRIPTOR_FILE_NOT_FOUND}} error condition. Other {{OSError}} 
> subclasses ({{PermissionError}}, {{IsADirectoryError}}, etc.) propagate as 
> raw Python exceptions, inconsistent with Spark's structured error approach.
> h3. Solution
> Add a new {{PROTOBUF_DESCRIPTOR_FILE_READ_FAILED}} error condition and map 
> remaining {{OSError}} subclasses to a structured {{PySparkRuntimeError}}, 
> consistent with the approach taken for {{FileNotFoundError}} in SPARK-43847.
> Note: the Scala side currently maps these cases to 
> {{CANNOT_PARSE_PROTOBUF_DESCRIPTOR}}, which nchammas noted is not ideal — a 
> dedicated Python-specific error condition is more accurate.



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