Vamsi-klu opened a new pull request, #58191:
URL: https://github.com/apache/spark/pull/58191

   ### What changes were proposed in this pull request?
   
   `_SimpleStreamReaderWrapper.read` in 
`python/pyspark/sql/datasource_internal.py` overrode 
`DataSourceStreamReader.read` with a narrower parameter type 
(`SimpleInputPartition`) and a leftover `# type: ignore[override]`.
   
   This PR matches the ABC signature `read(self, partition: InputPartition)` 
and asserts the runtime type the wrapper itself produces in `partitions()`. The 
return type stays `Iterator[Tuple]`.
   
   Closed WIP apache/spark#54791 only renamed the parameter and kept 
`SimpleInputPartition`, so isolated mypy still reported `[override]`.
   
   ### Why are the changes needed?
   
   https://issues.apache.org/jira/browse/SPARK-55805
   
   JIRA still says "Clarify the type hints for data source writer." Writer and 
batch-reader ignores are already gone. The leftover ignore is this private 
stream-reader wrapper. `python/mypy.ini` sets `warn_unused_ignores = True`, so 
a real override is required.
   
   mypy treats method parameters as contravariant. A subclass may accept a 
wider type than the ABC, not a narrower one.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. The wrapper is private. Production callers already pass `partitions()` 
output. The only behavior change is a clearer assert if a 
non-`SimpleInputPartition` is passed.
   
   ### How was this patch tested?
   
   Lint only, as planned:
   
   - `ruff check python/pyspark/sql/datasource_internal.py`
   - `ruff format --check python/pyspark/sql/datasource_internal.py`
   - `mypy --follow-imports=silent --config-file python/mypy.ini 
python/pyspark/sql/datasource.py python/pyspark/sql/datasource_internal.py`
   
   Existing streaming wrapper tests cover `latestOffset` / cache, not this 
signature. They were left alone.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Cursor Grok 4.6
   
   cc @HyukjinKwon
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to