How to retrieve idAdjustedUTC flag value for a TIMESTAMP column in a parquet file?

Tags: , , , ,

I have a parquet file with a number of columns of type converted_type (legacy): TIMESTAMP_MICROS. I want to check if the flag isAjustedToUTC is true. I can get it this way:

import pyarrow.parquet as pq
import re   
arrow = pq.ParquetFile("/Parquet/File/Path/filename.parquet")
timestamp_string = str(arrow.metadata.row_group(0).column(79).statistics.logical_type)"isAdjustedToUTC=(.*), timeUnit",timestamp_string).group(1)

This gives me either true or false as string. Is there another way to retrieve the value of isAdjustedToUTC without using a regex?


As far as I can tell it’s not possible. logical_type is of type pyarrow._parquet.ParquetLogicalType which doesn’t expose directly it’s underlying members.

The only available fields are:

>> ['__class__',

You could use the to_json function, but it’s as dirty as the option you’ve suggested:

import json
>> true

Source: stackoverflow