zhengruifeng opened a new pull request, #42920:
URL: https://github.com/apache/spark/pull/42920

   ### What changes were proposed in this pull request?
   1, in PyArrow 13.0.0, the behavior of `Table#to_pandas` and 
`ChunkedArray#to_pandas` changed, set the `coerce_temporal_nanoseconds=True` 
according to 
[1](https://arrow.apache.org/docs/python/generated/pyarrow.Table.html#pyarrow.Table.to_pandas)
 and 
[2](https://arrow.apache.org/docs/python/generated/pyarrow.ChunkedArray.html#pyarrow.ChunkedArray.to_pandas)
   
   2, there is another undocumented breaking change in data type conversion 
[`TimestampType#to_pandas_dtype`](https://arrow.apache.org/docs/python/generated/pyarrow.TimestampType.html#pyarrow.TimestampType.to_pandas_dtype):
   
   12.0.1:
   ```
   In [1]: import pyarrow as pa
   
   In [2]: pa.timestamp("us", tz=None).to_pandas_dtype()
   Out[2]: dtype('<M8[ns]')
   
   In [3]: pa.timestamp("ns", tz=None).to_pandas_dtype()
   Out[3]: dtype('<M8[ns]')
   
   In [4]: pa.timestamp("us", tz="UTC").to_pandas_dtype()
   Out[4]: datetime64[ns, UTC]
   
   In [5]: pa.timestamp("ns", tz="UTC").to_pandas_dtype()
   Out[5]: datetime64[ns, UTC]
   ```
   
   13.0.0:
   ```
   In [1]: import pyarrow as pa
   
   In [2]: pa.timestamp("us", tz=None).to_pandas_dtype()
   Out[2]: dtype('<M8[us]')
   
   In [3]: pa.timestamp("ns", tz=None).to_pandas_dtype()
   Out[3]: dtype('<M8[ns]')
   
   In [4]: pa.timestamp("us", tz="UTC").to_pandas_dtype()
   Out[4]: datetime64[us, UTC]
   
   In [5]: pa.timestamp("ns", tz="UTC").to_pandas_dtype()
   Out[5]: datetime64[ns, UTC]
   ```
   
   
   ### Why are the changes needed?
   Make PySpark compatible with PyArrow 13.0.0
   
   
   ### Does this PR introduce _any_ user-facing change?
   NO
   
   
   ### How was this patch tested?
   CI
   
   
   ### 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