[ 
https://issues.apache.org/jira/browse/ARROW-14104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17432393#comment-17432393
 ] 

Joris Van den Bossche commented on ARROW-14104:
-----------------------------------------------

[~sgilmore] can you check the pyarrow version used in the pyarrow-5.0 
environment to be sure you are actually using pyarrow 5.0?  
({{pa.\_\_version\_\_}}, or eg {{conda list}})

I get the following output after downloading the files you provided:

{code:python}
In [1]: import pyarrow as pa

In [2]: import pyarrow.parquet as pq

In [3]: t1 = pq.read_table("../Downloads/exampleArrow4.parq")

In [4]: t1
Out[4]: 
pyarrow.Table
TimestampColumn: list<item: timestamp[us, tz=America/New_York]>
  child 0, item: timestamp[us, tz=America/New_York]

In [8]: t2
Out[8]: 
pyarrow.Table
TimestampColumn: list<item: timestamp[us, tz=America/New_York]>
  child 0, item: timestamp[us, tz=America/New_York]

In [9]: pa.__version__
Out[9]: '5.0.0'
{code}

If you are actually using pyarrow 5.0, can you give some more details about the 
environment? (other installed packages, eg conda/pip list, which operating 
system, python version, etc)

> Reading Lists of Timestamps from parquet files in Arrow 5.0.0 fails to 
> preserve the TimeZone - unlike in Arrow 4.0.0
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-14104
>                 URL: https://issues.apache.org/jira/browse/ARROW-14104
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++, Parquet, Python
>    Affects Versions: 5.0.0
>            Reporter: Sarah Gilmore
>            Priority: Minor
>         Attachments: exampleArrow4.parq, exampleArrow5.parq
>
>
> In Arrow 4.0.0 it is possible to round-trip the TimeZone property of 
> List<Timestamp> columns to and from parquet files: 
> {code:java}
> >>> import pyarrow as pa
> >>> import pyarrow.parquet as pq
> >>> import datetime 
> >>> column = pa.array([[datetime.datetime(2023, 9, 23, 11)]], 
> >>> pa.list_(pa.timestamp('us', 'America/New_York')));
> >>> t = pa.Table.from_arrays([column], names=['TimestampColumn']);
> >>> pq.write_table(t, "example.parq");
> >>> t2 = pq.read_table("example.parq");
> >>> t2
> pyarrow.Table
> Dates: list<item: timestamp[us, tz=America/New_York]>
>   child 0, item: timestamp[us, tz=America/New_York]
> {code}
> However, if you read the same parquet file in pyarrow 5.0.0, the TimeZone is 
> set to UTC:
> {code:java}
> >>> t3 = pq.read_table("example.parq");
> >>> t3
> pyarrow.Table
> Dates: list<item: timestamp[us, tz=UTC]>
>   child 0, item: timestamp[us, tz=UTC]
>  {code}
>  
> I noticed that the TimeZone is preserved in Arrow 5.0 when reading non-nested 
> timestamp columns. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to