You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ga...@apache.org on 2026/07/28 18:41:47 UTC
(spark) branch master updated: [SPARK-58312][PYTHON] Remove unnecessary type: ignore comments in pyspark.sql.group
This is an automated email from the ASF dual-hosted git repository.
gaogaotiantian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new b7d304f00169 [SPARK-58312][PYTHON] Remove unnecessary type: ignore comments in pyspark.sql.group
b7d304f00169 is described below
commit b7d304f001690510691110e2acc43872b39f22f2
Author: Spenser Sun <ha...@databricks.com>
AuthorDate: Tue Jul 28 11:41:31 2026 -0700
[SPARK-58312][PYTHON] Remove unnecessary type: ignore comments in pyspark.sql.group
### What changes were proposed in this pull request?
In `python/pyspark/sql/group.py`, the `dfapi`/`df_varargs_api` decorated methods (`count`, `mean`, `avg`, `max`, `min`, `sum`) intentionally have docstring-only bodies, which trigger 6 `# type: ignore[empty-body]` comments. These per-method ignores are replaced by a single file-level `# mypy: disable-error-code="empty-body"` directive, matching the style already used in `dataframe.py`, `column.py`, `window.py`, and `table_arg.py`.
Note: an earlier revision of this PR also touched `python/pyspark/sql/udf.py`. That part has been reverted per review feedback. This PR now only changes `group.py`.
### Why are the changes needed?
To reduce type-checker noise and improve readability, and to make `group.py` consistent with the sibling files that already suppress `empty-body` at the file level.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Existing tests. `mypy --namespace-packages --config-file python/mypy.ini python/pyspark` passes at full scope.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #57482 from Spenserrrr/haotian-sun_data/typeignore2.
Authored-by: Spenser Sun <ha...@databricks.com>
Signed-off-by: Tian Gao <ga...@hotmail.com>
---
python/pyspark/sql/group.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/python/pyspark/sql/group.py b/python/pyspark/sql/group.py
index 3c6f241f2948..221105d96783 100644
--- a/python/pyspark/sql/group.py
+++ b/python/pyspark/sql/group.py
@@ -15,6 +15,8 @@
# limitations under the License.
#
+# mypy: disable-error-code="empty-body"
+
import sys
from typing import Callable, List, Optional, TYPE_CHECKING, overload, Dict, Union, cast, Tuple
@@ -189,7 +191,7 @@ class GroupedData(PandasGroupedOpsMixin):
return DataFrame(jdf, self.session)
@dfapi
- def count(self) -> "DataFrame": # type: ignore[empty-body]
+ def count(self) -> "DataFrame":
"""Counts the number of records for each group.
.. versionadded:: 1.3.0
@@ -223,7 +225,7 @@ class GroupedData(PandasGroupedOpsMixin):
"""
@df_varargs_api
- def mean(self, *cols: str) -> DataFrame: # type: ignore[empty-body]
+ def mean(self, *cols: str) -> DataFrame:
"""Computes average values for each numeric columns for each group.
:func:`mean` is an alias for :func:`avg`.
@@ -240,7 +242,7 @@ class GroupedData(PandasGroupedOpsMixin):
"""
@df_varargs_api
- def avg(self, *cols: str) -> "DataFrame": # type: ignore[empty-body]
+ def avg(self, *cols: str) -> "DataFrame":
"""Computes average values for each numeric columns for each group.
:func:`mean` is an alias for :func:`avg`.
@@ -291,7 +293,7 @@ class GroupedData(PandasGroupedOpsMixin):
"""
@df_varargs_api
- def max(self, *cols: str) -> "DataFrame": # type: ignore[empty-body]
+ def max(self, *cols: str) -> "DataFrame":
"""Computes the max value for each numeric columns for each group.
.. versionadded:: 1.3.0
@@ -335,7 +337,7 @@ class GroupedData(PandasGroupedOpsMixin):
"""
@df_varargs_api
- def min(self, *cols: str) -> "DataFrame": # type: ignore[empty-body]
+ def min(self, *cols: str) -> "DataFrame":
"""Computes the min value for each numeric column for each group.
.. versionadded:: 1.3.0
@@ -384,7 +386,7 @@ class GroupedData(PandasGroupedOpsMixin):
"""
@df_varargs_api
- def sum(self, *cols: str) -> DataFrame: # type: ignore[empty-body]
+ def sum(self, *cols: str) -> DataFrame:
"""Computes the sum for each numeric columns for each group.
.. versionadded:: 1.3.0
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org