anishmehta24 opened a new pull request, #1741:
URL: https://github.com/apache/arrow-go/pull/1741

   ### Rationale for this change
   
   Fixes #1740.
   
   When the writer coerces a timestamp unit, the stored Arrow schema's time 
zone is dropped on read. `timestamp[s, tz=America/New_York]` is stored as 
milliseconds and reads back as `timestamp[ms, tz=UTC]`. Nanoseconds written 
with Parquet 1.0 read back as `timestamp[us, tz=UTC]`.
   
   ### What changes are included in this PR?
   
   `applyOriginalStorageMetadata` now restores the original time zone when the 
units differ, and keeps the unit that is stored in the file. This matches 
`ApplyOriginalStorageMetadata` in the C++ reader. When the units match, the 
original type is used as before.
   
   ### Are these changes tested?
   
   Yes. `TestRestoreTimestampTimeZoneWithCoercedUnit` writes `timestamp[s, 
tz]`, `timestamp[ms, tz]` and `timestamp[ns, tz]` with Parquet 1.0, then checks 
the type and values read back. The seconds and nanoseconds cases fail on main.
   
   ```sh
   go test -short -tags assert,test ./parquet/pqarrow/... ./parquet/file/... 
./parquet/schema/...
   go test -short -tags assert,test,noasm ./parquet/pqarrow/...
   golangci-lint run ./parquet/pqarrow/...
   ```
   
   ### Are there any user-facing changes?
   
   Yes. Timestamp columns whose unit was coerced on write now read back with 
their original time zone instead of UTC. The stored values and unit do not 
change.
   


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