This is an automated email from the ASF dual-hosted git repository.

gaogaotiantian pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new dd163c569c43 [SPARK-60145][PYTHON] Remove type: ignore[var-annotated] 
in pyspark.sql
dd163c569c43 is described below

commit dd163c569c437c434cd06a0b11e49fea16b18422
Author: soaring0616 <[email protected]>
AuthorDate: Sat Oct 10 23:52:56 2026 -0700

    [SPARK-60145][PYTHON] Remove type: ignore[var-annotated] in pyspark.sql
    
    ### 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)
    
    Closes #59351 from soaring0616/type-20261011.
    
    Authored-by: soaring0616 <[email protected]>
    Signed-off-by: Tian Gao <[email protected]>
    (cherry picked from commit 37913ef850bfde006cc9671a02039a29e350455f)
    Signed-off-by: Tian Gao <[email protected]>
---
 python/pyspark/sql/plot/core.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/pyspark/sql/plot/core.py b/python/pyspark/sql/plot/core.py
index dfa4998b95f1..8109d49c7bdc 100644
--- a/python/pyspark/sql/plot/core.py
+++ b/python/pyspark/sql/plot/core.py
@@ -103,7 +103,7 @@ class PySparkPlotAccessor:
         "pie": PySparkTopNPlotBase().get_top_n,
         "scatter": PySparkSampledPlotBase().get_sampled,
     }
-    _backends = {}  # type: ignore[var-annotated]
+    _backends: dict[str, ModuleType] = {}
 
     def __init__(self, data: "DataFrame"):
         self.data = data


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to