sam-lunt commented on PR #35494:
URL: https://github.com/apache/arrow/pull/35494#issuecomment-1539233161

   I see that the unit tests failed, so I'd be inclined to agree that this 
change isn't quite right, haha.
   
   That said, I do think there is an issue with the current implementation, 
since `date64` doesn't survive a round trip from Arrow to Parquet and back:
   ``` py
   import datetime
   import sys
   import pandas as pd
   import pyarrow as pa
   import pyarrow.parquet as paq
   
   print(f"{sys.version=}")
   print(f"{pa.__version__=}")
   print()
   
   schema = pa.schema(
       [
           ("date32", pa.date32()),
           ("date64", pa.date64()),
       ]
   )
   
   print("schema:", schema, "", sep="\n")
   
   df = pd.DataFrame(
       {
           "date32": datetime.date(2020, 3, 15),
           "date64": datetime.date(2020, 3, 15),
       },
       index=pd.RangeIndex(1),
   )
   
   rb = pa.RecordBatch.from_pandas(df, schema=schema)
   print("rb.schema:", rb.schema, "", sep="\n")
   
   w = paq.ParquetWriter("test.parquet", version="2.6", schema=schema)
   w.write(rb)
   w.close()
   
   f = paq.ParquetFile("test.parquet")
   t = f.read()
   print("t.schema:", t.schema, sep="\n")
   ```
   
   On my machine (running x86_64 Linux), I see the following output:
   ```
   sys.version='3.11.3 (main, Apr  5 2023, 15:52:25) [GCC 12.2.1 20230201]'
   pa.__version__='10.0.1'
   
   schema:
   date32: date32[day]
   date64: date64[ms]
   
   rb.schema:
   date32: date32[day]
   date64: date64[ms]
   -- schema metadata --
   pandas: '{"index_columns": [], "column_indexes": [{"name": null, "field_n' + 
412
   
   t.schema:
   date32: date32[day]
   date64: date32[day]
   ```


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