Skip to content

[SPARK-60145][PYTHON] Remove type: ignore[var-annotated] in pyspark.sql - #59347

Closed
soaring0616 wants to merge 1 commit into
apache:masterfrom
soaring0616:typeignore-var-annotated
Closed

soaring0616 wants to merge 1 commit into
apache:masterfrom
soaring0616:typeignore-var-annotated

Conversation

@soaring0616

Copy link
Copy Markdown

What changes were proposed in this pull request?

Replace type: ignore[var-annotated] on PySparkPlotAccessor._backends with an explicit dict[str, ModuleType] annotation.

Why are the changes needed?

mypy cannot infer the type of an empty dict literal, so the suppression hid the real type. The value type matches the return type of _get_plot_backend.

Does this PR introduce any user-facing change?

No

How was this patch tested?

  • dev/lint-python --ruff passes.
  • dev/lint-python --mypy: no errors in python/pyspark/sql/plot/core.py. There are 3 remaining "FieldDescriptor" has no attribute "label" errors in python/pyspark/sql/connect/client/core.py also occur on an unmodified master in my environment, so they are unrelated to this change.
  • python/run-tests --testnames pyspark.sql.tests.plot.test_frame_plot passes.

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

Generated by Claude-code (Sonnet 5.5)

Replace `type: ignore[var-annotated]` on `PySparkPlotAccessor._backends` with an explicit `dict[str, ModuleType]` annotation.

mypy cannot infer the type of an empty dict literal, so the suppression hid the real type. The value type matches the return type of `_get_plot_backend`.

No.

- `dev/lint-python --ruff` passes.
- `dev/lint-python --mypy`: no errors in `python/pyspark/sql/plot/core.py`.
   There are 3 remaining `"FieldDescriptor" has no attribute "label"` errors in `python/pyspark/sql/connect/client/core.py` also occur on an unmodified master in my environment, so they are unrelated to this change.
- `python/run-tests --testnames pyspark.sql.tests.plot.test_frame_plot` passes.

Generated by Claude-code (Sonnet 5.5)
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.

1 participant