Skip to content

[SPARK-51055][SS][CONNECT] Streaming foreachBatch should call init logic inside a try#49757

Closed
WweiL wants to merge 6 commits intoapache:masterfrom
WweiL:feb-worker-init-error-propagate
Closed

[SPARK-51055][SS][CONNECT] Streaming foreachBatch should call init logic inside a try#49757
WweiL wants to merge 6 commits intoapache:masterfrom
WweiL:feb-worker-init-error-propagate

Conversation

@WweiL
Copy link
Contributor

@WweiL WweiL commented Feb 1, 2025

What changes were proposed in this pull request?

So that any error can be propagated to the jvm. Especially the python version issue.

handle_worker_exception would write out a special int to the jvm, and wil be caught here:

val resFromPython = dataIn.readInt()
if (resFromPython != 0) {
val errMessage = PythonWorkerUtils.readUTF(dataIn)
throw streamingPythonRunnerInitializationFailure(resFromPython, errMessage)
}

Why are the changes needed?

Spark Connect improvements

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing unit test

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

No

Copy link
Contributor

@hvanhovell hvanhovell left a comment

Choose a reason for hiding this comment

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

LGTM

@HeartSaVioR
Copy link
Contributor

@WweiL Would you mind looking at the CI build? The failure seems to be relevant.

@WweiL
Copy link
Contributor Author

WweiL commented Feb 3, 2025

@HeartSaVioR Yes it indeed looks relevant, I'll take a look, thanks!

Copy link
Contributor

@jiateoh jiateoh left a comment

Choose a reason for hiding this comment

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

LGTM after the build fix, thanks!

@github-actions github-actions bot added the CORE label Feb 3, 2025
@github-actions github-actions bot removed the CORE label Feb 3, 2025
@WweiL
Copy link
Contributor Author

WweiL commented Feb 4, 2025

@HyukjinKwon can we merge this : ) TY!

@HyukjinKwon
Copy link
Member

Merged to master and branch-4.0.

HyukjinKwon pushed a commit that referenced this pull request Feb 4, 2025
…gic inside a try

### What changes were proposed in this pull request?

So that any error can be propagated to the jvm. Especially the python version issue.

`handle_worker_exception` would write out a special int to the jvm, and wil be caught here:
https://github.com/apache/spark/blob/c92021091502b15b6020e6e4cc9b148009450ba5/core/src/main/scala/org/apache/spark/api/python/StreamingPythonRunner.scala#L99-L103

### Why are the changes needed?

Spark Connect improvements

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Existing unit test

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

No

Closes #49757 from WweiL/feb-worker-init-error-propagate.

Authored-by: Wei Liu <wei.liu@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit 505c644)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 14, 2025
…gic inside a try

### What changes were proposed in this pull request?

So that any error can be propagated to the jvm. Especially the python version issue.

`handle_worker_exception` would write out a special int to the jvm, and wil be caught here:
https://github.com/apache/spark/blob/cd1f1b3b1884c165b077120820706b1816e111d8/core/src/main/scala/org/apache/spark/api/python/StreamingPythonRunner.scala#L99-L103

### Why are the changes needed?

Spark Connect improvements

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Existing unit test

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

No

Closes apache#49757 from WweiL/feb-worker-init-error-propagate.

Authored-by: Wei Liu <wei.liu@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit ec0931d)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants