[SPARK-54993][PYTHON] Add type hints to NameTypeHolder and IndexNameTypeHolder classes#55807
Closed
adith-os wants to merge 1 commit into
Closed
[SPARK-54993][PYTHON] Add type hints to NameTypeHolder and IndexNameTypeHolder classes#55807adith-os wants to merge 1 commit into
adith-os wants to merge 1 commit into
Conversation
…ypeHolder classes
Contributor
gaogaotiantian
approved these changes
May 12, 2026
zhengruifeng
approved these changes
May 13, 2026
zhengruifeng
pushed a commit
that referenced
this pull request
May 13, 2026
…ypeHolder classes ### What changes were proposed in this pull request? This PR adds proper type annotations to the NameTypeHolder and IndexNameTypeHolder classes in python/pyspark/pandas/typedef/typehints.py ### Why are the changes needed? This is a subtask of [ SPARK-54953](https://issues.apache.org/jira/browse/SPARK-54953) (upgrading mypy to latest version). Changes improve type checking. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Errors on typehints.py before Changes (delete `# type: ignore[assignment]`): ``` starting mypy annotations test... annotations failed mypy checks: python/pyspark/pandas/typedef/typehints.py:729: error: Incompatible types in assignment (expression has type "ExtensionDtype", variable has type "None") [assignment] python/pyspark/pandas/typedef/typehints.py:896: error: Incompatible types in assignment (expression has type "ExtensionDtype", variable has type "None") [assignment] python/pyspark/pandas/typedef/typehints.py:900: error: Incompatible types in assignment (expression has type "type[Any] | Any", variable has type "None") [assignment] python/pyspark/pandas/typedef/typehints.py:917: error: Incompatible types in assignment (expression has type "ExtensionDtype", variable has type "None") [assignment] python/pyspark/pandas/typedef/typehints.py:920: error: Incompatible types in assignment (expression has type "type[Any] | Any", variable has type "None") [assignment] ``` After changes: Verified with mypy that typehints.py has no type errors ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Github Copilot GPT 5.2-Codex Closes #55807 from adith-os/SPARK-54993-improve-typehints. Authored-by: adith-os <194981725+adith-os@users.noreply.github.com> Signed-off-by: Ruifeng Zheng <ruifengz@foxmail.com> (cherry picked from commit 7d245ea) Signed-off-by: Ruifeng Zheng <ruifengz@foxmail.com>
Contributor
|
merged to master/4.x |
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 changes were proposed in this pull request?
This PR adds proper type annotations to the NameTypeHolder and IndexNameTypeHolder classes in python/pyspark/pandas/typedef/typehints.py
Why are the changes needed?
This is a subtask of SPARK-54953 (upgrading mypy to latest version). Changes improve type checking.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Errors on typehints.py before Changes (delete
# type: ignore[assignment]):After changes:
Verified with mypy that typehints.py has no type errors
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Github Copilot GPT 5.2-Codex