You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "vito-lin-dev (via GitHub)" <gi...@apache.org> on 2026/10/11 08:34:05 UTC
[PR] [SPARK-XXXXX][PYTHON][ML] Replace type: ignore[union-attr] in pyspark… [spark]
vito-lin-dev opened a new pull request, #59377:
URL: https://github.com/apache/spark/pull/59377
### What changes were proposed in this pull request?
Remove five `type: ignore[union-attr]` comments in `pyspark.ml` by narrowing types or correcting annotations:
- `ml/torch/torch_run_process_wrapper.py`: `task.stdin` / `task.stdout` are created with `subprocess.PIPE` and are never `None`; narrow with an `assert`.
- `ml/connect/io_utils.py`: narrow `sparkContext._gateway` with an `assert`.
- `ml/wrapper.py`: check `_gateway is not None` before calling `detach`, instead of relying on the surrounding `except`.
- `ml/connect/tuning.py`: `param_map` comes from `Sequence[ParamMap]`, so annotate it as `ParamMap` instead of `Any`.
- `ml/connect/base.py`: `Estimator.fit` only accepts a single `ParamMap` and never returns a list, but its return type was declared as `Union[M, List[M]]`. Correct it to `M`. This was the root cause of the ignore in `tuning.py`.
### Why are the changes needed?
`type: ignore` hides real type errors. These five were covering either an un-narrowed `Optional` or an incorrect annotation. Replacing them lets mypy check the code, and fixes a misleading return type on `Estimator.fit`.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
`dev/lint-python --mypy` passes.
### Was this patch authored or co-authored using generative AI tooling?
Co-authored by Claude. Author reviewed every line, ran the tests, and verified the coverage results locally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-60173][PYTHON][TEST] Replace type: ignore[union-attr] in pyspark.ml [spark]
Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #59377: [SPARK-60173][PYTHON][TEST] Replace type: ignore[union-attr] in pyspark.ml
URL: https://github.com/apache/spark/pull/59377
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-60173][PYTHON][TEST] Replace type: ignore[union-attr] in pyspark.ml [spark]
Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #59377:
URL: https://github.com/apache/spark/pull/59377#issuecomment-6286914324
**Merge Summary:**
- merged into master https://github.com/apache/spark/commit/c5bec12e27b5001d8bdefcff8a6f1fa08bfa6a59
- merged into branch-4.x https://github.com/apache/spark/commit/a6d12ae3196142e79a876fdde7f85f5b1f79f5cf
*Posted by `merge_spark_pr.py`*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org