tadeja opened a new issue, #55767:
URL: https://github.com/apache/arrow/issues/55767

   ### Describe the enhancement requested
   
   #55264 (issue #55263) intentionally avoids generics to keep the first stage 
simpler. As a result, some methods inherited from private base classes return 
unions on every subclass:
   
   `_PandasConvertible.to_pandas()` in `python/pyarrow-stubs/__lib/array.pyi` 
returns `pd.Series | pd.DataFrame` for arrays and tables (post-#55264)
   Consider making `_PandasConvertible` generic over its return type to narrow 
it without duplicated signatures or or per-class overloads.
   
   2. `_Tabular` column access in `python/pyarrow-stubs/__lib/table.pyi`
   (`__getitem__`, `column`, `columns`, `itercolumns`) returns `Array | 
ChunkedArray` variants on both `RecordBatch` and `Table`.
   Consider a `_Tabular[_ColumnT]` with `_ColumnT = TypeVar("_ColumnT", Array, 
ChunkedArray)` to narrow these.
   
   3. Review the rest of `python/pyarrow-stubs/` for similar private base 
classes where an internal `Generic[...]` would narrow inherited return types.
   
   Note: public classes preferably remain non-generic.
   Also consider adding `assert_type` tests in `python/pyarrow-stubs-tests/`
   
   ### Component(s)
   
   Python


-- 
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]

Reply via email to