Yicong-Huang commented on code in PR #53778: URL: https://github.com/apache/spark/pull/53778#discussion_r2692144035
########## python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_cast.py: ########## @@ -0,0 +1,856 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +""" +Tests for PyArrow's pa.Array.cast() method with default arguments. + +This test suite is part of SPARK-54936 to monitor upstream PyArrow behavior. +It tests all combinations of source type -> target type to ensure PySpark's +assumptions about PyArrow's casting behavior remain valid across versions. + +## Type Conversion Matrix (pa.Array.cast with default safe=True) + +### Comprehensive Type Coverage: +- **Integers**: int8, int16, int32, int64, uint8, uint16, uint32, uint64 +- **Floats**: float16, float32, float64 +- **Strings**: string, large_string +- **Binary**: binary, large_binary +- **Decimals**: decimal128, decimal256 +- **Dates**: date32, date64 +- **Timestamps**: timestamp[s/ms/us/ns] +- **Durations**: duration[s/ms/us/ns] +- **Times**: time32[s/ms], time64[us/ns] +- **Lists**: list, large_list, fixed_size_list +- **Complex**: struct, map +- **NumPy**: np.int8-64, np.uint8-64, np.float16/32/64 +- **Pandas**: pd.Int64Dtype(), pd.Float64Dtype(), pd.ArrowDtype() + +### Conversion Matrix: Review Comment: The matrix was generated manually in comment for reference. Now I have changed it to print out the matrix at the end, after running all tests. -- 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]
