#
# Autogenerated by Thrift Compiler (0.10.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py:dynamic
#

from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys

from thrift.transport import TTransport
from thrift.protocol.TBase import TBase, TFrozenBase, TExceptionBase, TTransport


class Type(TBase):
    """
    Types supported by Parquet.  These types are intended to be used in combination
    with the encodings to control the on disk storage format.
    For example INT16 is not included as a type since a good encoding of INT32
    would handle this.
    """
    BOOLEAN = 0
    INT32 = 1
    INT64 = 2
    INT96 = 3
    FLOAT = 4
    DOUBLE = 5
    BYTE_ARRAY = 6
    FIXED_LEN_BYTE_ARRAY = 7

    _VALUES_TO_NAMES = {
        0: "BOOLEAN",
        1: "INT32",
        2: "INT64",
        3: "INT96",
        4: "FLOAT",
        5: "DOUBLE",
        6: "BYTE_ARRAY",
        7: "FIXED_LEN_BYTE_ARRAY",
    }

    _NAMES_TO_VALUES = {
        "BOOLEAN": 0,
        "INT32": 1,
        "INT64": 2,
        "INT96": 3,
        "FLOAT": 4,
        "DOUBLE": 5,
        "BYTE_ARRAY": 6,
        "FIXED_LEN_BYTE_ARRAY": 7,
    }


class ConvertedType(TBase):
    """
    Common types used by frameworks(e.g. hive, pig) using parquet.  This helps map
    between types in those frameworks to the base types in parquet.  This is only
    metadata and not needed to read or write the data.
    """
    UTF8 = 0
    MAP = 1
    MAP_KEY_VALUE = 2
    LIST = 3
    ENUM = 4
    DECIMAL = 5
    DATE = 6
    TIME_MILLIS = 7
    TIME_MICROS = 8
    TIMESTAMP_MILLIS = 9
    TIMESTAMP_MICROS = 10
    UINT_8 = 11
    UINT_16 = 12
    UINT_32 = 13
    UINT_64 = 14
    INT_8 = 15
    INT_16 = 16
    INT_32 = 17
    INT_64 = 18
    JSON = 19
    BSON = 20
    INTERVAL = 21
    NULL = 25

    _VALUES_TO_NAMES = {
        0: "UTF8",
        1: "MAP",
        2: "MAP_KEY_VALUE",
        3: "LIST",
        4: "ENUM",
        5: "DECIMAL",
        6: "DATE",
        7: "TIME_MILLIS",
        8: "TIME_MICROS",
        9: "TIMESTAMP_MILLIS",
        10: "TIMESTAMP_MICROS",
        11: "UINT_8",
        12: "UINT_16",
        13: "UINT_32",
        14: "UINT_64",
        15: "INT_8",
        16: "INT_16",
        17: "INT_32",
        18: "INT_64",
        19: "JSON",
        20: "BSON",
        21: "INTERVAL",
        25: "NULL",
    }

    _NAMES_TO_VALUES = {
        "UTF8": 0,
        "MAP": 1,
        "MAP_KEY_VALUE": 2,
        "LIST": 3,
        "ENUM": 4,
        "DECIMAL": 5,
        "DATE": 6,
        "TIME_MILLIS": 7,
        "TIME_MICROS": 8,
        "TIMESTAMP_MILLIS": 9,
        "TIMESTAMP_MICROS": 10,
        "UINT_8": 11,
        "UINT_16": 12,
        "UINT_32": 13,
        "UINT_64": 14,
        "INT_8": 15,
        "INT_16": 16,
        "INT_32": 17,
        "INT_64": 18,
        "JSON": 19,
        "BSON": 20,
        "INTERVAL": 21,
        "NULL": 25,
    }


class FieldRepetitionType(TBase):
    """
    Representation of Schemas
    """
    REQUIRED = 0
    OPTIONAL = 1
    REPEATED = 2

    _VALUES_TO_NAMES = {
        0: "REQUIRED",
        1: "OPTIONAL",
        2: "REPEATED",
    }

    _NAMES_TO_VALUES = {
        "REQUIRED": 0,
        "OPTIONAL": 1,
        "REPEATED": 2,
    }


class Encoding(TBase):
    """
    Encodings supported by Parquet.  Not all encodings are valid for all types.  These
    enums are also used to specify the encoding of definition and repetition levels.
    See the accompanying doc for the details of the more complicated encodings.
    """
    PLAIN = 0
    PLAIN_DICTIONARY = 2
    RLE = 3
    BIT_PACKED = 4
    DELTA_BINARY_PACKED = 5
    DELTA_LENGTH_BYTE_ARRAY = 6
    DELTA_BYTE_ARRAY = 7
    RLE_DICTIONARY = 8

    _VALUES_TO_NAMES = {
        0: "PLAIN",
        2: "PLAIN_DICTIONARY",
        3: "RLE",
        4: "BIT_PACKED",
        5: "DELTA_BINARY_PACKED",
        6: "DELTA_LENGTH_BYTE_ARRAY",
        7: "DELTA_BYTE_ARRAY",
        8: "RLE_DICTIONARY",
    }

    _NAMES_TO_VALUES = {
        "PLAIN": 0,
        "PLAIN_DICTIONARY": 2,
        "RLE": 3,
        "BIT_PACKED": 4,
        "DELTA_BINARY_PACKED": 5,
        "DELTA_LENGTH_BYTE_ARRAY": 6,
        "DELTA_BYTE_ARRAY": 7,
        "RLE_DICTIONARY": 8,
    }


class CompressionCodec(TBase):
    """
    Supported compression algorithms.
    """
    UNCOMPRESSED = 0
    SNAPPY = 1
    GZIP = 2
    LZO = 3
    BROTLI = 4

    _VALUES_TO_NAMES = {
        0: "UNCOMPRESSED",
        1: "SNAPPY",
        2: "GZIP",
        3: "LZO",
        4: "BROTLI",
    }

    _NAMES_TO_VALUES = {
        "UNCOMPRESSED": 0,
        "SNAPPY": 1,
        "GZIP": 2,
        "LZO": 3,
        "BROTLI": 4,
    }


class PageType(TBase):
    DATA_PAGE = 0
    INDEX_PAGE = 1
    DICTIONARY_PAGE = 2
    DATA_PAGE_V2 = 3

    _VALUES_TO_NAMES = {
        0: "DATA_PAGE",
        1: "INDEX_PAGE",
        2: "DICTIONARY_PAGE",
        3: "DATA_PAGE_V2",
    }

    _NAMES_TO_VALUES = {
        "DATA_PAGE": 0,
        "INDEX_PAGE": 1,
        "DICTIONARY_PAGE": 2,
        "DATA_PAGE_V2": 3,
    }


class Statistics(TBase):
    """
    Statistics per row group and per page
    All fields are optional.

    Attributes:
     - max: min and max value of the column, encoded in PLAIN encoding
     - min
     - null_count: count of null value in the column
     - distinct_count: count of distinct values occurring
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'max', 'BINARY', None, ),  # 1
        (2, TType.STRING, 'min', 'BINARY', None, ),  # 2
        (3, TType.I64, 'null_count', None, None, ),  # 3
        (4, TType.I64, 'distinct_count', None, None, ),  # 4
    )

    def __init__(self, max=None, min=None, null_count=None, distinct_count=None,):
        self.max = max
        self.min = min
        self.null_count = null_count
        self.distinct_count = distinct_count

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class SchemaElement(TBase):
    """
    Represents a element inside a schema definition.
     - if it is a group (inner node) then type is undefined and num_children is defined
     - if it is a primitive type (leaf) then type is defined and num_children is undefined
    the nodes are listed in depth first traversal order.

    Attributes:
     - type: Data type for this field. Not set if the current element is a non-leaf node
     - type_length: If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the vales.
    Otherwise, if specified, this is the maximum bit length to store any of the values.
    (e.g. a low cardinality INT col could have this set to 3).  Note that this is
    in the schema, and therefore fixed for the entire file.
     - repetition_type: repetition of the field. The root of the schema does not have a repetition_type.
    All other nodes must have one
     - name: Name of the field in the schema
     - num_children: Nested fields.  Since thrift does not support nested fields,
    the nesting is flattened to a single list by a depth-first traversal.
    The children count is used to construct the nested relationship.
    This field is not set when the element is a primitive type
     - converted_type: When the schema is the result of a conversion from another model
    Used to record the original type to help with cross conversion.
     - scale: Used when this column contains decimal data.
    See the DECIMAL converted type for more details.
     - precision
     - field_id: When the original schema supports field ids, this will save the
    original field id in the parquet schema
    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'type', None, None, ),  # 1
        (2, TType.I32, 'type_length', None, None, ),  # 2
        (3, TType.I32, 'repetition_type', None, None, ),  # 3
        (4, TType.STRING, 'name', 'UTF8', None, ),  # 4
        (5, TType.I32, 'num_children', None, None, ),  # 5
        (6, TType.I32, 'converted_type', None, None, ),  # 6
        (7, TType.I32, 'scale', None, None, ),  # 7
        (8, TType.I32, 'precision', None, None, ),  # 8
        (9, TType.I32, 'field_id', None, None, ),  # 9
    )

    def __init__(self, type=None, type_length=None, repetition_type=None, name=None, num_children=None, converted_type=None, scale=None, precision=None, field_id=None,):
        self.type = type
        self.type_length = type_length
        self.repetition_type = repetition_type
        self.name = name
        self.num_children = num_children
        self.converted_type = converted_type
        self.scale = scale
        self.precision = precision
        self.field_id = field_id

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class DataPageHeader(TBase):
    """
    Data page header

    Attributes:
     - num_values: Number of values, including NULLs, in this data page. *
     - encoding: Encoding used for this data page *
     - definition_level_encoding: Encoding used for definition levels *
     - repetition_level_encoding: Encoding used for repetition levels *
     - statistics: Optional statistics for the data in this page*
    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'num_values', None, None, ),  # 1
        (2, TType.I32, 'encoding', None, None, ),  # 2
        (3, TType.I32, 'definition_level_encoding', None, None, ),  # 3
        (4, TType.I32, 'repetition_level_encoding', None, None, ),  # 4
        (5, TType.STRUCT, 'statistics', (Statistics, Statistics.thrift_spec), None, ),  # 5
    )

    def __init__(self, num_values=None, encoding=None, definition_level_encoding=None, repetition_level_encoding=None, statistics=None,):
        self.num_values = num_values
        self.encoding = encoding
        self.definition_level_encoding = definition_level_encoding
        self.repetition_level_encoding = repetition_level_encoding
        self.statistics = statistics

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class IndexPageHeader(TBase):

    thrift_spec = (
    )

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class DictionaryPageHeader(TBase):
    """
    TODO: *

    Attributes:
     - num_values: Number of values in the dictionary *
     - encoding: Encoding using this dictionary page *
     - is_sorted: If true, the entries in the dictionary are sorted in ascending order *
    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'num_values', None, None, ),  # 1
        (2, TType.I32, 'encoding', None, None, ),  # 2
        (3, TType.BOOL, 'is_sorted', None, None, ),  # 3
    )

    def __init__(self, num_values=None, encoding=None, is_sorted=None,):
        self.num_values = num_values
        self.encoding = encoding
        self.is_sorted = is_sorted

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class DataPageHeaderV2(TBase):
    """
    New page format alowing reading levels without decompressing the data
    Repetition and definition levels are uncompressed
    The remaining section containing the data is compressed if is_compressed is true


    Attributes:
     - num_values: Number of values, including NULLs, in this data page. *
     - num_nulls: Number of NULL values, in this data page.
    Number of non-null = num_values - num_nulls which is also the number of values in the data section *
     - num_rows: Number of rows in this data page. which means pages change on record boundaries (r = 0) *
     - encoding: Encoding used for data in this page *
     - definition_levels_byte_length: length of the repetition levels
     - repetition_levels_byte_length: length of the definition levels
     - is_compressed: whether the values are compressed.
    Which means the section of the page between
    definition_levels_byte_length + repetition_levels_byte_length + 1 and compressed_page_size (included)
    is compressed with the compression_codec.
    If missing it is considered compressed
     - statistics: optional statistics for this column chunk
    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'num_values', None, None, ),  # 1
        (2, TType.I32, 'num_nulls', None, None, ),  # 2
        (3, TType.I32, 'num_rows', None, None, ),  # 3
        (4, TType.I32, 'encoding', None, None, ),  # 4
        (5, TType.I32, 'definition_levels_byte_length', None, None, ),  # 5
        (6, TType.I32, 'repetition_levels_byte_length', None, None, ),  # 6
        (7, TType.BOOL, 'is_compressed', None, True, ),  # 7
        (8, TType.STRUCT, 'statistics', (Statistics, Statistics.thrift_spec), None, ),  # 8
    )

    def __init__(self, num_values=None, num_nulls=None, num_rows=None, encoding=None, definition_levels_byte_length=None, repetition_levels_byte_length=None, is_compressed=thrift_spec[7][4], statistics=None,):
        self.num_values = num_values
        self.num_nulls = num_nulls
        self.num_rows = num_rows
        self.encoding = encoding
        self.definition_levels_byte_length = definition_levels_byte_length
        self.repetition_levels_byte_length = repetition_levels_byte_length
        self.is_compressed = is_compressed
        self.statistics = statistics

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class PageHeader(TBase):
    """
    Attributes:
     - type: the type of the page: indicates which of the *_header fields is set *
     - uncompressed_page_size: Uncompressed page size in bytes (not including this header) *
     - compressed_page_size: Compressed page size in bytes (not including this header) *
     - crc: 32bit crc for the data below. This allows for disabling checksumming in HDFS
    if only a few pages needs to be read

     - data_page_header
     - index_page_header
     - dictionary_page_header
     - data_page_header_v2
    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'type', None, None, ),  # 1
        (2, TType.I32, 'uncompressed_page_size', None, None, ),  # 2
        (3, TType.I32, 'compressed_page_size', None, None, ),  # 3
        (4, TType.I32, 'crc', None, None, ),  # 4
        (5, TType.STRUCT, 'data_page_header', (DataPageHeader, DataPageHeader.thrift_spec), None, ),  # 5
        (6, TType.STRUCT, 'index_page_header', (IndexPageHeader, IndexPageHeader.thrift_spec), None, ),  # 6
        (7, TType.STRUCT, 'dictionary_page_header', (DictionaryPageHeader, DictionaryPageHeader.thrift_spec), None, ),  # 7
        (8, TType.STRUCT, 'data_page_header_v2', (DataPageHeaderV2, DataPageHeaderV2.thrift_spec), None, ),  # 8
    )

    def __init__(self, type=None, uncompressed_page_size=None, compressed_page_size=None, crc=None, data_page_header=None, index_page_header=None, dictionary_page_header=None, data_page_header_v2=None,):
        self.type = type
        self.uncompressed_page_size = uncompressed_page_size
        self.compressed_page_size = compressed_page_size
        self.crc = crc
        self.data_page_header = data_page_header
        self.index_page_header = index_page_header
        self.dictionary_page_header = dictionary_page_header
        self.data_page_header_v2 = data_page_header_v2

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class KeyValue(TBase):
    """
    Wrapper struct to store key values

    Attributes:
     - key
     - value
    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'key', 'UTF8', None, ),  # 1
        (2, TType.STRING, 'value', 'UTF8', None, ),  # 2
    )

    def __init__(self, key=None, value=None,):
        self.key = key
        self.value = value

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class SortingColumn(TBase):
    """
    Wrapper struct to specify sort order

    Attributes:
     - column_idx: The column index (in this row group) *
     - descending: If true, indicates this column is sorted in descending order. *
     - nulls_first: If true, nulls will come before non-null values, otherwise,
    nulls go at the end.
    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'column_idx', None, None, ),  # 1
        (2, TType.BOOL, 'descending', None, None, ),  # 2
        (3, TType.BOOL, 'nulls_first', None, None, ),  # 3
    )

    def __init__(self, column_idx=None, descending=None, nulls_first=None,):
        self.column_idx = column_idx
        self.descending = descending
        self.nulls_first = nulls_first

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class PageEncodingStats(TBase):
    """
    statistics of a given page type and encoding

    Attributes:
     - page_type: the page type (data/dic/...) *
     - encoding: encoding of the page *
     - count: number of pages of this type with this encoding *
    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'page_type', None, None, ),  # 1
        (2, TType.I32, 'encoding', None, None, ),  # 2
        (3, TType.I32, 'count', None, None, ),  # 3
    )

    def __init__(self, page_type=None, encoding=None, count=None,):
        self.page_type = page_type
        self.encoding = encoding
        self.count = count

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class ColumnMetaData(TBase):
    """
    Description for column metadata

    Attributes:
     - type: Type of this column *
     - encodings: Set of all encodings used for this column. The purpose is to validate
    whether we can decode those pages. *
     - path_in_schema: Path in schema *
     - codec: Compression codec *
     - num_values: Number of values in this column *
     - total_uncompressed_size: total byte size of all uncompressed pages in this column chunk (including the headers) *
     - total_compressed_size: total byte size of all compressed pages in this column chunk (including the headers) *
     - key_value_metadata: Optional key/value metadata *
     - data_page_offset: Byte offset from beginning of file to first data page *
     - index_page_offset: Byte offset from beginning of file to root index page *
     - dictionary_page_offset: Byte offset from the beginning of file to first (only) dictionary page *
     - statistics: optional statistics for this column chunk
     - encoding_stats: Set of all encodings used for pages in this column chunk.
    This information can be used to determine if all data pages are
    dictionary encoded for example *
    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'type', None, None, ),  # 1
        (2, TType.LIST, 'encodings', (TType.I32, None, False), None, ),  # 2
        (3, TType.LIST, 'path_in_schema', (TType.STRING, 'UTF8', False), None, ),  # 3
        (4, TType.I32, 'codec', None, None, ),  # 4
        (5, TType.I64, 'num_values', None, None, ),  # 5
        (6, TType.I64, 'total_uncompressed_size', None, None, ),  # 6
        (7, TType.I64, 'total_compressed_size', None, None, ),  # 7
        (8, TType.LIST, 'key_value_metadata', (TType.STRUCT, (KeyValue, KeyValue.thrift_spec), False), None, ),  # 8
        (9, TType.I64, 'data_page_offset', None, None, ),  # 9
        (10, TType.I64, 'index_page_offset', None, None, ),  # 10
        (11, TType.I64, 'dictionary_page_offset', None, None, ),  # 11
        (12, TType.STRUCT, 'statistics', (Statistics, Statistics.thrift_spec), None, ),  # 12
        (13, TType.LIST, 'encoding_stats', (TType.STRUCT, (PageEncodingStats, PageEncodingStats.thrift_spec), False), None, ),  # 13
    )

    def __init__(self, type=None, encodings=None, path_in_schema=None, codec=None, num_values=None, total_uncompressed_size=None, total_compressed_size=None, key_value_metadata=None, data_page_offset=None, index_page_offset=None, dictionary_page_offset=None, statistics=None, encoding_stats=None,):
        self.type = type
        self.encodings = encodings
        self.path_in_schema = path_in_schema
        self.codec = codec
        self.num_values = num_values
        self.total_uncompressed_size = total_uncompressed_size
        self.total_compressed_size = total_compressed_size
        self.key_value_metadata = key_value_metadata
        self.data_page_offset = data_page_offset
        self.index_page_offset = index_page_offset
        self.dictionary_page_offset = dictionary_page_offset
        self.statistics = statistics
        self.encoding_stats = encoding_stats

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class ColumnChunk(TBase):
    """
    Attributes:
     - file_path: File where column data is stored.  If not set, assumed to be same file as
    metadata.  This path is relative to the current file.

     - file_offset: Byte offset in file_path to the ColumnMetaData *
     - meta_data: Column metadata for this chunk. This is the same content as what is at
    file_path/file_offset.  Having it here has it replicated in the file
    metadata.

    """

    thrift_spec = (
        None,  # 0
        (1, TType.STRING, 'file_path', 'UTF8', None, ),  # 1
        (2, TType.I64, 'file_offset', None, None, ),  # 2
        (3, TType.STRUCT, 'meta_data', (ColumnMetaData, ColumnMetaData.thrift_spec), None, ),  # 3
    )

    def __init__(self, file_path=None, file_offset=None, meta_data=None,):
        self.file_path = file_path
        self.file_offset = file_offset
        self.meta_data = meta_data

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class RowGroup(TBase):
    """
    Attributes:
     - columns: Metadata for each column chunk in this row group.
    This list must have the same order as the SchemaElement list in FileMetaData.

     - total_byte_size: Total byte size of all the uncompressed column data in this row group *
     - num_rows: Number of rows in this row group *
     - sorting_columns: If set, specifies a sort ordering of the rows in this RowGroup.
    The sorting columns can be a subset of all the columns.
    """

    thrift_spec = (
        None,  # 0
        (1, TType.LIST, 'columns', (TType.STRUCT, (ColumnChunk, ColumnChunk.thrift_spec), False), None, ),  # 1
        (2, TType.I64, 'total_byte_size', None, None, ),  # 2
        (3, TType.I64, 'num_rows', None, None, ),  # 3
        (4, TType.LIST, 'sorting_columns', (TType.STRUCT, (SortingColumn, SortingColumn.thrift_spec), False), None, ),  # 4
    )

    def __init__(self, columns=None, total_byte_size=None, num_rows=None, sorting_columns=None,):
        self.columns = columns
        self.total_byte_size = total_byte_size
        self.num_rows = num_rows
        self.sorting_columns = sorting_columns

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class FileMetaData(TBase):
    """
    Description for file metadata

    Attributes:
     - version: Version of this file *
     - schema: Parquet schema for this file.  This schema contains metadata for all the columns.
    The schema is represented as a tree with a single root.  The nodes of the tree
    are flattened to a list by doing a depth-first traversal.
    The column metadata contains the path in the schema for that column which can be
    used to map columns to nodes in the schema.
    The first element is the root *
     - num_rows: Number of rows in this file *
     - row_groups: Row groups in this file *
     - key_value_metadata: Optional key/value metadata *
     - created_by: String for application that wrote this file.  This should be in the format
    <Application> version <App Version> (build <App Build Hash>).
    e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)

    """

    thrift_spec = (
        None,  # 0
        (1, TType.I32, 'version', None, None, ),  # 1
        (2, TType.LIST, 'schema', (TType.STRUCT, (SchemaElement, SchemaElement.thrift_spec), False), None, ),  # 2
        (3, TType.I64, 'num_rows', None, None, ),  # 3
        (4, TType.LIST, 'row_groups', (TType.STRUCT, (RowGroup, RowGroup.thrift_spec), False), None, ),  # 4
        (5, TType.LIST, 'key_value_metadata', (TType.STRUCT, (KeyValue, KeyValue.thrift_spec), False), None, ),  # 5
        (6, TType.STRING, 'created_by', 'UTF8', None, ),  # 6
    )

    def __init__(self, version=None, schema=None, num_rows=None, row_groups=None, key_value_metadata=None, created_by=None,):
        self.version = version
        self.schema = schema
        self.num_rows = num_rows
        self.row_groups = row_groups
        self.key_value_metadata = key_value_metadata
        self.created_by = created_by

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
