Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-47544][PYTHON] SparkSession builder method is incompatible with visual studio code intellisense #45700

Closed
wants to merge 4 commits into from

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented Mar 25, 2024

What changes were proposed in this pull request?

VS Code's intellisense is unable to detect the methods and properties of
SparkSession.builder. A video is worth a thousand words:
video.

Adjust the implementation for better compatibility with the IDE.

Why are the changes needed?

Compatibility with IDE tooling.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Built the wheel file locally and tested on local IDE.
See video.

Confirmed the same works for Pycharm.

Further confirmed that the Pydocs for these methods are unaffected.

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

No.

@nija-at nija-at changed the title [SPARK-47544][PYSPARK] SparkSession builder method is incompatible with vs code intellisense [SPARK-47544][PYSPARK] SparkSession builder method is incompatible with visual studio code intellisense Mar 25, 2024
@HyukjinKwon HyukjinKwon changed the title [SPARK-47544][PYSPARK] SparkSession builder method is incompatible with visual studio code intellisense [SPARK-47544][PYTHON] SparkSession builder method is incompatible with visual studio code intellisense Mar 26, 2024
@HyukjinKwon
Copy link
Member

Let's fix up the linter though:

python/pyspark/sql/session.py:502: error: Incompatible return value type (got "pyspark.sql.connect.session.SparkSession", expected "pyspark.sql.session.SparkSession")  [return-value]
python/pyspark/sql/session.py:507: error: Incompatible return value type (got "pyspark.sql.connect.session.SparkSession", expected "pyspark.sql.session.SparkSession")  [return-value]
python/pyspark/sql/session.py:563: error: Incompatible return value type (got "pyspark.sql.connect.session.SparkSession", expected "pyspark.sql.session.SparkSession")  [return-value]
python/pyspark/sql/session.py:581: error: Incompatible types in assignment (expression has type "classproperty", variable has type "Builder")  [assignment]
python/pyspark/sql/connect/session.py:240: error: Incompatible types in assignment (expression has type "classproperty", variable has type "Builder")  [assignment]
Found 5 errors in 2 files (checked 991 source files)

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you, @nija-at and @HyukjinKwon
Merged to master for Apache Spark 4.0.0.

sweisdb pushed a commit to sweisdb/spark that referenced this pull request Apr 1, 2024
…h visual studio code intellisense

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

VS Code's intellisense is unable to detect the methods and properties of
`SparkSession.builder`. A video is worth a thousand words:
[video](https://github.com/apache/spark/assets/16217941/e611e7e7-8760-4d9f-aa6c-9d4bd519d516).

Adjust the implementation for better compatibility with the IDE.

### Why are the changes needed?

Compatibility with IDE tooling.

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

No.

### How was this patch tested?

Built the wheel file locally and tested on local IDE.
See [video](https://github.com/apache/spark/assets/16217941/429b06dd-44a7-4d13-a551-c2b72c326c1e).

Confirmed the same works for Pycharm.

Further confirmed that the Pydocs for these methods are unaffected.

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

No.

Closes apache#45700 from nija-at/vscode-intellisense.

Authored-by: Niranjan Jayakar <nija@databricks.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
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.

3 participants