Yicong-Huang opened a new pull request, #55746:
URL: https://github.com/apache/spark/pull/55746

   ### What changes were proposed in this pull request?
   
   Removes the dead `if LooseVersion(np.__version__) >= LooseVersion("1.21"):` 
guard in `python/pyspark/pandas/typedef/typehints.py` (in `as_spark_type`), and 
dedents the inner block that handles `numpy.typing.NDArray` types one level. 
The accompanying `# For NumPy typing, NumPy version should be 1.21+` comment is 
removed as well.
   
   ### Why are the changes needed?
   
   [SPARK-45179](https://issues.apache.org/jira/browse/SPARK-45179) 
(2023-09-15) bumped `_minimum_numpy_version` to `"1.21"` in `python/setup.py`, 
so this version guard is always true and is dead code.
   
   Note: The same dead guard pattern exists in 
`python/pyspark/pandas/tests/test_typedef.py:410-411`. It is left unchanged in 
this PR to keep the scope focused; happy to clean it up in a follow-up if 
reviewers prefer.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   - `pytest python/pyspark/pandas/tests/test_typedef.py` -- 12 passed.
   - Doctests in `python/pyspark/pandas/typedef/typehints.py` -- 3 of 4 pass 
(the unrelated `infer_return_type` doctest already fails on master with the 
same `CategoricalDtype` formatting diff).
   - Smoke test confirming `as_spark_type(npt.NDArray[np.int32])` -> 
`ArrayType(IntegerType(), True)` and `as_spark_type(np.ndarray)` -> 
`ArrayType(StringType(), True)`.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.


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