Skip to content

fix: pysparkvalue error - #144

Merged
medb merged 1 commit into
GoogleCloudDataproc:mainfrom
ZhiweiLinnn:zwl-branch
Oct 1, 2025
Merged

fix: pysparkvalue error#144
medb merged 1 commit into
GoogleCloudDataproc:mainfrom
ZhiweiLinnn:zwl-branch

Conversation

@ZhiweiLinnn

@ZhiweiLinnn ZhiweiLinnn commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

The session name is not available immediately after session creation started, the code should wait until it become available
verifed: https://screencast.googleplex.com/cast/NTAxNDYzNTk0OTMyNjMzNnwxYmU5ZjliZC1iMQ

@google-cla

google-cla Bot commented Sep 26, 2025

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ZhiweiLinnn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily addresses a PySparkValueError by ensuring that the Spark Connect session URL is correctly prefixed with sc://. This change is implemented in the session management logic to prevent connection errors. Additionally, a related unit test has been enhanced to support dynamic subnetwork configuration based on environment variables, improving test coverage for network-specific setups.

Highlights

  • PySparkValueError Fix: Resolved an issue where PySparkValueError occurred because the Spark Connect URL was missing the required sc:// prefix.
  • Session Name Update: Modified the _get_exiting_active_session method in session.py to prepend sc:// to the session_name to ensure correct URL formatting for Spark Connect.
  • Test Enhancement: Updated a unit test in test_session.py to conditionally include a subnetwork URI in the expected session request if the DATAPROC_SPARK_CONNECT_SUBNET environment variable is configured, improving test coverage for network-specific setups.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request aims to fix a PySparkValueError by prepending sc:// to the session_name. However, this change is incorrect as session_name is used as a Google Cloud resource name for Dataproc API calls, not as a Spark Connect URL. This will break the logic for reusing existing sessions. The change in the test file is acceptable as it makes the test more robust to different environments.

Comment thread google/cloud/dataproc_spark_connect/session.py Outdated
@ZhiweiLinnn

Copy link
Copy Markdown
Contributor Author

@fangyh20 @medb Can both of you help review?

@ZhiweiLinnn
ZhiweiLinnn force-pushed the zwl-branch branch 3 times, most recently from 0489bb4 to cd77c16 Compare September 29, 2025 22:45
@medb medb changed the title fix pysparkvalue error fix: pysparkvalue error Sep 30, 2025
@ZhiweiLinnn
ZhiweiLinnn force-pushed the zwl-branch branch 4 times, most recently from 32b57c9 to bfb8c71 Compare September 30, 2025 20:24
Comment thread google/cloud/dataproc_spark_connect/session.py Outdated
@ZhiweiLinnn
ZhiweiLinnn force-pushed the zwl-branch branch 11 times, most recently from 7234f65 to a38c614 Compare October 1, 2025 00:00
@medb
medb merged commit 436d97e into GoogleCloudDataproc:main Oct 1, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants