Skip to content

[SPARK-58312][PYTHON] Remove unnecessary type: ignore comments in pyspark.sql.udf and group#57482

Open
Spenserrrr wants to merge 1 commit into
apache:masterfrom
Spenserrrr:haotian-sun_data/typeignore2
Open

[SPARK-58312][PYTHON] Remove unnecessary type: ignore comments in pyspark.sql.udf and group#57482
Spenserrrr wants to merge 1 commit into
apache:masterfrom
Spenserrrr:haotian-sun_data/typeignore2

Conversation

@Spenserrrr

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Several # type: ignore comments in python/pyspark/sql/udf.py and python/pyspark/sql/group.py can be removed by fixing the underlying type issues:

  • In UDFRegistration.register, a UDF is built and wrapped by _create_udf, then immediately unwrapped via the ._unwrapped attribute. Building the UserDefinedFunction directly removes this round-trip and 2 [attr-defined] ignores.
  • In group.py, the @dfapi/@df_varargs_api decorated methods intentionally have docstring-only bodies and trigger 6 [empty-body] ignores. These are replaced by a single file-level disable-error-code directive, matching the style already used in dataframe.py, column.py, window.py, and table_arg.py.

Why are the changes needed?

To improve readability

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing tests. mypy --config-file python/mypy.ini python/pyspark passes at full scope.

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

No

@Spenserrrr

Copy link
Copy Markdown
Contributor Author

@gaogaotiantian

@Spenserrrr
Spenserrrr force-pushed the haotian-sun_data/typeignore2 branch from 7bb5e98 to 2b2f413 Compare July 24, 2026 01:10
@uros-b

uros-b commented Jul 24, 2026

Copy link
Copy Markdown
Member

LGTM, thank you @Spenserrrr! also, cc @HyukjinKwon @Yicong-Huang

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.

2 participants