Repository navigation
[ZEPPELIN-6457] Extract shared Python ZeppelinContext helpers for PySpark and PyFlink - #5405
Merged
ParkGyeongTae merged 1 commit intoAug 9, 2026
Conversation
move-hoon
marked this pull request as ready for review
August 9, 2026 09:05
ParkGyeongTae
approved these changes
Aug 9, 2026
ParkGyeongTae
left a comment
Member
There was a problem hiding this comment.
LGTM — clean fix for the long-standing PySpark/PyFlink ZeppelinContext duplication TODO. Backend-specific show() logic and compat aliases are preserved, and there's test coverage for the alias contract. One non-blocking nit inline.
| super(IPySparkZeppelinContext, self).show(obj, **kwargs) | ||
|
|
||
| z = __zeppelin__ = IPySparkZeppelinContext(intp.getZeppelinContext(), gateway) | ||
| z = __zeppelin__ = PySparkZeppelinContext(intp.getZeppelinContext(), gateway) |
Member
There was a problem hiding this comment.
nit: PySparkZeppelinContext isn't imported here on purpose — IPythonInterpreter already execs zeppelin_context.py into this same kernel session first. Worth a one-line comment so it's not mistaken for a missing import.
| super(IPyFlinkZeppelinContext, self).show(obj, **kwargs) | ||
|
|
||
| z = __zeppelin__ = IPyFlinkZeppelinContext(intp.getZeppelinContext(), gateway) | ||
| z = __zeppelin__ = PyFlinkZeppelinContext(intp.getZeppelinContext(), gateway) |
Member
There was a problem hiding this comment.
nit: same as the PySpark side — PyFlinkZeppelinContext is only in scope because zeppelin_context.py was already exec'd into this kernel session.
Member
|
Merged into master (e1d96d6). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
PySpark and PyFlink currently define their
ZeppelinContextsubclasses separately in the classic Python and IPython bootstrap resources, even though the implementations are effectively the same for each backend.This PR moves the PySpark and PyFlink implementations into the shared
zeppelin_context.pyresource and reuses them from both bootstrap paths.Backend-specific behavior remains unchanged:
DataFrameobjects through_jdf.Tableobjects through_j_table.stream_typeargument.PyZeppelinContext.show().IPySparkZeppelinContextandIPyFlinkZeppelinContextremain available as compatibility aliases.No new dependencies are introduced.
What type of PR is it?
Refactoring
Todos
z.show(DataFrame)behaviorWhat is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6457
How should this be tested?
The following checks passed successfully:
./mvnw test \ -pl python \ -Dtest=PythonInterpreterTest#testBackendZeppelinContextsAvailable \ -DfailIfNoTests=false \ -Dmaven.gitcommitid.skip=trueResult: 1 test passed.
Results:
PySparkInterpreterTest#testPySparkpassed.z.show(DataFrame)was exercised successfully.Result: 12-module reactor build succeeded.
Result: 13-module reactor build succeeded.
The generated Spark and Flink interpreter JARs were also verified to contain the shared context resource and the corresponding classic and IPython bootstrap resources.
git diff --checkalso passes.Screenshots (if appropriate)
Not applicable. This PR does not change the user interface.
Questions