#
# Autogenerated by Thrift Compiler (0.16.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py:new_style,no_utf8strings
#

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


from thrift.transport import TTransport
all_structs = []


class TPrimitiveType(object):
    INVALID_TYPE = 0
    NULL_TYPE = 1
    BOOLEAN = 2
    TINYINT = 3
    SMALLINT = 4
    INT = 5
    BIGINT = 6
    FLOAT = 7
    DOUBLE = 8
    DATE = 9
    DATETIME = 10
    TIMESTAMP = 11
    STRING = 12
    BINARY = 13
    DECIMAL = 14
    CHAR = 15
    VARCHAR = 16
    FIXED_UDA_INTERMEDIATE = 17

    _VALUES_TO_NAMES = {
        0: "INVALID_TYPE",
        1: "NULL_TYPE",
        2: "BOOLEAN",
        3: "TINYINT",
        4: "SMALLINT",
        5: "INT",
        6: "BIGINT",
        7: "FLOAT",
        8: "DOUBLE",
        9: "DATE",
        10: "DATETIME",
        11: "TIMESTAMP",
        12: "STRING",
        13: "BINARY",
        14: "DECIMAL",
        15: "CHAR",
        16: "VARCHAR",
        17: "FIXED_UDA_INTERMEDIATE",
    }

    _NAMES_TO_VALUES = {
        "INVALID_TYPE": 0,
        "NULL_TYPE": 1,
        "BOOLEAN": 2,
        "TINYINT": 3,
        "SMALLINT": 4,
        "INT": 5,
        "BIGINT": 6,
        "FLOAT": 7,
        "DOUBLE": 8,
        "DATE": 9,
        "DATETIME": 10,
        "TIMESTAMP": 11,
        "STRING": 12,
        "BINARY": 13,
        "DECIMAL": 14,
        "CHAR": 15,
        "VARCHAR": 16,
        "FIXED_UDA_INTERMEDIATE": 17,
    }


class TTypeNodeType(object):
    SCALAR = 0
    ARRAY = 1
    MAP = 2
    STRUCT = 3

    _VALUES_TO_NAMES = {
        0: "SCALAR",
        1: "ARRAY",
        2: "MAP",
        3: "STRUCT",
    }

    _NAMES_TO_VALUES = {
        "SCALAR": 0,
        "ARRAY": 1,
        "MAP": 2,
        "STRUCT": 3,
    }


class TStmtType(object):
    QUERY = 0
    DDL = 1
    DML = 2
    EXPLAIN = 3
    LOAD = 4
    SET = 5
    ADMIN_FN = 6
    TESTCASE = 7
    CONVERT = 8
    UNKNOWN = 9
    KILL = 10

    _VALUES_TO_NAMES = {
        0: "QUERY",
        1: "DDL",
        2: "DML",
        3: "EXPLAIN",
        4: "LOAD",
        5: "SET",
        6: "ADMIN_FN",
        7: "TESTCASE",
        8: "CONVERT",
        9: "UNKNOWN",
        10: "KILL",
    }

    _NAMES_TO_VALUES = {
        "QUERY": 0,
        "DDL": 1,
        "DML": 2,
        "EXPLAIN": 3,
        "LOAD": 4,
        "SET": 5,
        "ADMIN_FN": 6,
        "TESTCASE": 7,
        "CONVERT": 8,
        "UNKNOWN": 9,
        "KILL": 10,
    }


class TIcebergOperation(object):
    INSERT = 0
    DELETE = 1
    UPDATE = 2
    OPTIMIZE = 3
    MERGE = 4

    _VALUES_TO_NAMES = {
        0: "INSERT",
        1: "DELETE",
        2: "UPDATE",
        3: "OPTIMIZE",
        4: "MERGE",
    }

    _NAMES_TO_VALUES = {
        "INSERT": 0,
        "DELETE": 1,
        "UPDATE": 2,
        "OPTIMIZE": 3,
        "MERGE": 4,
    }


class TExplainLevel(object):
    MINIMAL = 0
    STANDARD = 1
    EXTENDED = 2
    VERBOSE = 3

    _VALUES_TO_NAMES = {
        0: "MINIMAL",
        1: "STANDARD",
        2: "EXTENDED",
        3: "VERBOSE",
    }

    _NAMES_TO_VALUES = {
        "MINIMAL": 0,
        "STANDARD": 1,
        "EXTENDED": 2,
        "VERBOSE": 3,
    }


class TRuntimeFilterMode(object):
    OFF = 0
    LOCAL = 1
    GLOBAL = 2

    _VALUES_TO_NAMES = {
        0: "OFF",
        1: "LOCAL",
        2: "GLOBAL",
    }

    _NAMES_TO_VALUES = {
        "OFF": 0,
        "LOCAL": 1,
        "GLOBAL": 2,
    }


class TPrefetchMode(object):
    NONE = 0
    HT_BUCKET = 1

    _VALUES_TO_NAMES = {
        0: "NONE",
        1: "HT_BUCKET",
    }

    _NAMES_TO_VALUES = {
        "NONE": 0,
        "HT_BUCKET": 1,
    }


class TFunctionCategory(object):
    SCALAR = 0
    AGGREGATE = 1
    ANALYTIC = 2

    _VALUES_TO_NAMES = {
        0: "SCALAR",
        1: "AGGREGATE",
        2: "ANALYTIC",
    }

    _NAMES_TO_VALUES = {
        "SCALAR": 0,
        "AGGREGATE": 1,
        "ANALYTIC": 2,
    }


class TFunctionBinaryType(object):
    BUILTIN = 0
    JAVA = 1
    NATIVE = 2
    IR = 3

    _VALUES_TO_NAMES = {
        0: "BUILTIN",
        1: "JAVA",
        2: "NATIVE",
        3: "IR",
    }

    _NAMES_TO_VALUES = {
        "BUILTIN": 0,
        "JAVA": 1,
        "NATIVE": 2,
        "IR": 3,
    }


class TSortingOrder(object):
    LEXICAL = 0
    ZORDER = 1

    _VALUES_TO_NAMES = {
        0: "LEXICAL",
        1: "ZORDER",
    }

    _NAMES_TO_VALUES = {
        "LEXICAL": 0,
        "ZORDER": 1,
    }


class TScalarType(object):
    """
    Attributes:
     - type
     - len
     - precision
     - scale

    """


    def __init__(self, type=None, len=None, precision=None, scale=None,):
        self.type = type
        self.len = len
        self.precision = precision
        self.scale = scale

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.I32:
                    self.type = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.len = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.precision = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I32:
                    self.scale = iprot.readI32()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TScalarType')
        if self.type is not None:
            oprot.writeFieldBegin('type', TType.I32, 1)
            oprot.writeI32(self.type)
            oprot.writeFieldEnd()
        if self.len is not None:
            oprot.writeFieldBegin('len', TType.I32, 2)
            oprot.writeI32(self.len)
            oprot.writeFieldEnd()
        if self.precision is not None:
            oprot.writeFieldBegin('precision', TType.I32, 3)
            oprot.writeI32(self.precision)
            oprot.writeFieldEnd()
        if self.scale is not None:
            oprot.writeFieldBegin('scale', TType.I32, 4)
            oprot.writeI32(self.scale)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.type is None:
            raise TProtocolException(message='Required field type is unset!')
        return

    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 TStructField(object):
    """
    Attributes:
     - name
     - comment
     - field_id

    """


    def __init__(self, name=None, comment=None, field_id=None,):
        self.name = name
        self.comment = comment
        self.field_id = field_id

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.name = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.comment = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.field_id = iprot.readI32()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TStructField')
        if self.name is not None:
            oprot.writeFieldBegin('name', TType.STRING, 1)
            oprot.writeString(self.name)
            oprot.writeFieldEnd()
        if self.comment is not None:
            oprot.writeFieldBegin('comment', TType.STRING, 2)
            oprot.writeString(self.comment)
            oprot.writeFieldEnd()
        if self.field_id is not None:
            oprot.writeFieldBegin('field_id', TType.I32, 3)
            oprot.writeI32(self.field_id)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.name is None:
            raise TProtocolException(message='Required field name is unset!')
        return

    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 TTypeNode(object):
    """
    Attributes:
     - type
     - scalar_type
     - struct_fields

    """


    def __init__(self, type=None, scalar_type=None, struct_fields=None,):
        self.type = type
        self.scalar_type = scalar_type
        self.struct_fields = struct_fields

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.I32:
                    self.type = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.scalar_type = TScalarType()
                    self.scalar_type.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.LIST:
                    self.struct_fields = []
                    (_etype3, _size0) = iprot.readListBegin()
                    for _i4 in range(_size0):
                        _elem5 = TStructField()
                        _elem5.read(iprot)
                        self.struct_fields.append(_elem5)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TTypeNode')
        if self.type is not None:
            oprot.writeFieldBegin('type', TType.I32, 1)
            oprot.writeI32(self.type)
            oprot.writeFieldEnd()
        if self.scalar_type is not None:
            oprot.writeFieldBegin('scalar_type', TType.STRUCT, 2)
            self.scalar_type.write(oprot)
            oprot.writeFieldEnd()
        if self.struct_fields is not None:
            oprot.writeFieldBegin('struct_fields', TType.LIST, 3)
            oprot.writeListBegin(TType.STRUCT, len(self.struct_fields))
            for iter6 in self.struct_fields:
                iter6.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.type is None:
            raise TProtocolException(message='Required field type is unset!')
        return

    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 TColumnType(object):
    """
    Attributes:
     - types

    """


    def __init__(self, types=None,):
        self.types = types

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.LIST:
                    self.types = []
                    (_etype10, _size7) = iprot.readListBegin()
                    for _i11 in range(_size7):
                        _elem12 = TTypeNode()
                        _elem12.read(iprot)
                        self.types.append(_elem12)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TColumnType')
        if self.types is not None:
            oprot.writeFieldBegin('types', TType.LIST, 1)
            oprot.writeListBegin(TType.STRUCT, len(self.types))
            for iter13 in self.types:
                iter13.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    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 TNetworkAddress(object):
    """
    Attributes:
     - hostname
     - port
     - uds_address

    """


    def __init__(self, hostname=None, port=None, uds_address=None,):
        self.hostname = hostname
        self.port = port
        self.uds_address = uds_address

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.hostname = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.port = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.uds_address = iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TNetworkAddress')
        if self.hostname is not None:
            oprot.writeFieldBegin('hostname', TType.STRING, 1)
            oprot.writeString(self.hostname)
            oprot.writeFieldEnd()
        if self.port is not None:
            oprot.writeFieldBegin('port', TType.I32, 2)
            oprot.writeI32(self.port)
            oprot.writeFieldEnd()
        if self.uds_address is not None:
            oprot.writeFieldBegin('uds_address', TType.STRING, 3)
            oprot.writeString(self.uds_address)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.hostname is None:
            raise TProtocolException(message='Required field hostname is unset!')
        if self.port is None:
            raise TProtocolException(message='Required field port is unset!')
        return

    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 TAddressesList(object):
    """
    Attributes:
     - addresses

    """


    def __init__(self, addresses=None,):
        self.addresses = addresses

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.LIST:
                    self.addresses = []
                    (_etype17, _size14) = iprot.readListBegin()
                    for _i18 in range(_size14):
                        _elem19 = TNetworkAddress()
                        _elem19.read(iprot)
                        self.addresses.append(_elem19)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TAddressesList')
        if self.addresses is not None:
            oprot.writeFieldBegin('addresses', TType.LIST, 1)
            oprot.writeListBegin(TType.STRUCT, len(self.addresses))
            for iter20 in self.addresses:
                iter20.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.addresses is None:
            raise TProtocolException(message='Required field addresses is unset!')
        return

    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 TUniqueId(object):
    """
    Attributes:
     - hi
     - lo

    """


    def __init__(self, hi=None, lo=None,):
        self.hi = hi
        self.lo = lo

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.I64:
                    self.hi = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I64:
                    self.lo = iprot.readI64()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TUniqueId')
        if self.hi is not None:
            oprot.writeFieldBegin('hi', TType.I64, 1)
            oprot.writeI64(self.hi)
            oprot.writeFieldEnd()
        if self.lo is not None:
            oprot.writeFieldBegin('lo', TType.I64, 2)
            oprot.writeI64(self.lo)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.hi is None:
            raise TProtocolException(message='Required field hi is unset!')
        if self.lo is None:
            raise TProtocolException(message='Required field lo is unset!')
        return

    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 TFunctionName(object):
    """
    Attributes:
     - db_name
     - function_name

    """


    def __init__(self, db_name=None, function_name=None,):
        self.db_name = db_name
        self.function_name = function_name

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.db_name = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.function_name = iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TFunctionName')
        if self.db_name is not None:
            oprot.writeFieldBegin('db_name', TType.STRING, 1)
            oprot.writeString(self.db_name)
            oprot.writeFieldEnd()
        if self.function_name is not None:
            oprot.writeFieldBegin('function_name', TType.STRING, 2)
            oprot.writeString(self.function_name)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.function_name is None:
            raise TProtocolException(message='Required field function_name is unset!')
        return

    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 TScalarFunction(object):
    """
    Attributes:
     - symbol
     - prepare_fn_symbol
     - close_fn_symbol

    """


    def __init__(self, symbol=None, prepare_fn_symbol=None, close_fn_symbol=None,):
        self.symbol = symbol
        self.prepare_fn_symbol = prepare_fn_symbol
        self.close_fn_symbol = close_fn_symbol

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.prepare_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.close_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TScalarFunction')
        if self.symbol is not None:
            oprot.writeFieldBegin('symbol', TType.STRING, 1)
            oprot.writeString(self.symbol)
            oprot.writeFieldEnd()
        if self.prepare_fn_symbol is not None:
            oprot.writeFieldBegin('prepare_fn_symbol', TType.STRING, 2)
            oprot.writeString(self.prepare_fn_symbol)
            oprot.writeFieldEnd()
        if self.close_fn_symbol is not None:
            oprot.writeFieldBegin('close_fn_symbol', TType.STRING, 3)
            oprot.writeString(self.close_fn_symbol)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.symbol is None:
            raise TProtocolException(message='Required field symbol is unset!')
        return

    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 TAggregateFunction(object):
    """
    Attributes:
     - intermediate_type
     - is_analytic_only_fn
     - update_fn_symbol
     - init_fn_symbol
     - serialize_fn_symbol
     - merge_fn_symbol
     - finalize_fn_symbol
     - get_value_fn_symbol
     - remove_fn_symbol
     - ignores_distinct

    """


    def __init__(self, intermediate_type=None, is_analytic_only_fn=None, update_fn_symbol=None, init_fn_symbol=None, serialize_fn_symbol=None, merge_fn_symbol=None, finalize_fn_symbol=None, get_value_fn_symbol=None, remove_fn_symbol=None, ignores_distinct=None,):
        self.intermediate_type = intermediate_type
        self.is_analytic_only_fn = is_analytic_only_fn
        self.update_fn_symbol = update_fn_symbol
        self.init_fn_symbol = init_fn_symbol
        self.serialize_fn_symbol = serialize_fn_symbol
        self.merge_fn_symbol = merge_fn_symbol
        self.finalize_fn_symbol = finalize_fn_symbol
        self.get_value_fn_symbol = get_value_fn_symbol
        self.remove_fn_symbol = remove_fn_symbol
        self.ignores_distinct = ignores_distinct

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRUCT:
                    self.intermediate_type = TColumnType()
                    self.intermediate_type.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BOOL:
                    self.is_analytic_only_fn = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.update_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRING:
                    self.init_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRING:
                    self.serialize_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.STRING:
                    self.merge_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.STRING:
                    self.finalize_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 8:
                if ftype == TType.STRING:
                    self.get_value_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 9:
                if ftype == TType.STRING:
                    self.remove_fn_symbol = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 10:
                if ftype == TType.BOOL:
                    self.ignores_distinct = iprot.readBool()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TAggregateFunction')
        if self.intermediate_type is not None:
            oprot.writeFieldBegin('intermediate_type', TType.STRUCT, 1)
            self.intermediate_type.write(oprot)
            oprot.writeFieldEnd()
        if self.is_analytic_only_fn is not None:
            oprot.writeFieldBegin('is_analytic_only_fn', TType.BOOL, 2)
            oprot.writeBool(self.is_analytic_only_fn)
            oprot.writeFieldEnd()
        if self.update_fn_symbol is not None:
            oprot.writeFieldBegin('update_fn_symbol', TType.STRING, 3)
            oprot.writeString(self.update_fn_symbol)
            oprot.writeFieldEnd()
        if self.init_fn_symbol is not None:
            oprot.writeFieldBegin('init_fn_symbol', TType.STRING, 4)
            oprot.writeString(self.init_fn_symbol)
            oprot.writeFieldEnd()
        if self.serialize_fn_symbol is not None:
            oprot.writeFieldBegin('serialize_fn_symbol', TType.STRING, 5)
            oprot.writeString(self.serialize_fn_symbol)
            oprot.writeFieldEnd()
        if self.merge_fn_symbol is not None:
            oprot.writeFieldBegin('merge_fn_symbol', TType.STRING, 6)
            oprot.writeString(self.merge_fn_symbol)
            oprot.writeFieldEnd()
        if self.finalize_fn_symbol is not None:
            oprot.writeFieldBegin('finalize_fn_symbol', TType.STRING, 7)
            oprot.writeString(self.finalize_fn_symbol)
            oprot.writeFieldEnd()
        if self.get_value_fn_symbol is not None:
            oprot.writeFieldBegin('get_value_fn_symbol', TType.STRING, 8)
            oprot.writeString(self.get_value_fn_symbol)
            oprot.writeFieldEnd()
        if self.remove_fn_symbol is not None:
            oprot.writeFieldBegin('remove_fn_symbol', TType.STRING, 9)
            oprot.writeString(self.remove_fn_symbol)
            oprot.writeFieldEnd()
        if self.ignores_distinct is not None:
            oprot.writeFieldBegin('ignores_distinct', TType.BOOL, 10)
            oprot.writeBool(self.ignores_distinct)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.intermediate_type is None:
            raise TProtocolException(message='Required field intermediate_type is unset!')
        if self.is_analytic_only_fn is None:
            raise TProtocolException(message='Required field is_analytic_only_fn is unset!')
        if self.update_fn_symbol is None:
            raise TProtocolException(message='Required field update_fn_symbol is unset!')
        if self.init_fn_symbol is None:
            raise TProtocolException(message='Required field init_fn_symbol is unset!')
        return

    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 TFunction(object):
    """
    Attributes:
     - name
     - binary_type
     - arg_types
     - ret_type
     - has_var_args
     - comment
     - signature
     - hdfs_location
     - scalar_fn
     - aggregate_fn
     - is_persistent
     - last_modified_time

    """


    def __init__(self, name=None, binary_type=None, arg_types=None, ret_type=None, has_var_args=None, comment=None, signature=None, hdfs_location=None, scalar_fn=None, aggregate_fn=None, is_persistent=None, last_modified_time=None,):
        self.name = name
        self.binary_type = binary_type
        self.arg_types = arg_types
        self.ret_type = ret_type
        self.has_var_args = has_var_args
        self.comment = comment
        self.signature = signature
        self.hdfs_location = hdfs_location
        self.scalar_fn = scalar_fn
        self.aggregate_fn = aggregate_fn
        self.is_persistent = is_persistent
        self.last_modified_time = last_modified_time

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRUCT:
                    self.name = TFunctionName()
                    self.name.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.binary_type = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.LIST:
                    self.arg_types = []
                    (_etype24, _size21) = iprot.readListBegin()
                    for _i25 in range(_size21):
                        _elem26 = TColumnType()
                        _elem26.read(iprot)
                        self.arg_types.append(_elem26)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRUCT:
                    self.ret_type = TColumnType()
                    self.ret_type.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.BOOL:
                    self.has_var_args = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.STRING:
                    self.comment = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.STRING:
                    self.signature = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 8:
                if ftype == TType.STRING:
                    self.hdfs_location = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 9:
                if ftype == TType.STRUCT:
                    self.scalar_fn = TScalarFunction()
                    self.scalar_fn.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 10:
                if ftype == TType.STRUCT:
                    self.aggregate_fn = TAggregateFunction()
                    self.aggregate_fn.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 11:
                if ftype == TType.BOOL:
                    self.is_persistent = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 12:
                if ftype == TType.I64:
                    self.last_modified_time = iprot.readI64()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('TFunction')
        if self.name is not None:
            oprot.writeFieldBegin('name', TType.STRUCT, 1)
            self.name.write(oprot)
            oprot.writeFieldEnd()
        if self.binary_type is not None:
            oprot.writeFieldBegin('binary_type', TType.I32, 2)
            oprot.writeI32(self.binary_type)
            oprot.writeFieldEnd()
        if self.arg_types is not None:
            oprot.writeFieldBegin('arg_types', TType.LIST, 3)
            oprot.writeListBegin(TType.STRUCT, len(self.arg_types))
            for iter27 in self.arg_types:
                iter27.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.ret_type is not None:
            oprot.writeFieldBegin('ret_type', TType.STRUCT, 4)
            self.ret_type.write(oprot)
            oprot.writeFieldEnd()
        if self.has_var_args is not None:
            oprot.writeFieldBegin('has_var_args', TType.BOOL, 5)
            oprot.writeBool(self.has_var_args)
            oprot.writeFieldEnd()
        if self.comment is not None:
            oprot.writeFieldBegin('comment', TType.STRING, 6)
            oprot.writeString(self.comment)
            oprot.writeFieldEnd()
        if self.signature is not None:
            oprot.writeFieldBegin('signature', TType.STRING, 7)
            oprot.writeString(self.signature)
            oprot.writeFieldEnd()
        if self.hdfs_location is not None:
            oprot.writeFieldBegin('hdfs_location', TType.STRING, 8)
            oprot.writeString(self.hdfs_location)
            oprot.writeFieldEnd()
        if self.scalar_fn is not None:
            oprot.writeFieldBegin('scalar_fn', TType.STRUCT, 9)
            self.scalar_fn.write(oprot)
            oprot.writeFieldEnd()
        if self.aggregate_fn is not None:
            oprot.writeFieldBegin('aggregate_fn', TType.STRUCT, 10)
            self.aggregate_fn.write(oprot)
            oprot.writeFieldEnd()
        if self.is_persistent is not None:
            oprot.writeFieldBegin('is_persistent', TType.BOOL, 11)
            oprot.writeBool(self.is_persistent)
            oprot.writeFieldEnd()
        if self.last_modified_time is not None:
            oprot.writeFieldBegin('last_modified_time', TType.I64, 12)
            oprot.writeI64(self.last_modified_time)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.name is None:
            raise TProtocolException(message='Required field name is unset!')
        return

    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)
all_structs.append(TScalarType)
TScalarType.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'type', None, None, ),  # 1
    (2, TType.I32, 'len', None, None, ),  # 2
    (3, TType.I32, 'precision', None, None, ),  # 3
    (4, TType.I32, 'scale', None, None, ),  # 4
)
all_structs.append(TStructField)
TStructField.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'name', None, None, ),  # 1
    (2, TType.STRING, 'comment', None, None, ),  # 2
    (3, TType.I32, 'field_id', None, None, ),  # 3
)
all_structs.append(TTypeNode)
TTypeNode.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'type', None, None, ),  # 1
    (2, TType.STRUCT, 'scalar_type', [TScalarType, None], None, ),  # 2
    (3, TType.LIST, 'struct_fields', (TType.STRUCT, [TStructField, None], False), None, ),  # 3
)
all_structs.append(TColumnType)
TColumnType.thrift_spec = (
    None,  # 0
    (1, TType.LIST, 'types', (TType.STRUCT, [TTypeNode, None], False), None, ),  # 1
)
all_structs.append(TNetworkAddress)
TNetworkAddress.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'hostname', None, None, ),  # 1
    (2, TType.I32, 'port', None, None, ),  # 2
    (3, TType.STRING, 'uds_address', None, None, ),  # 3
)
all_structs.append(TAddressesList)
TAddressesList.thrift_spec = (
    None,  # 0
    (1, TType.LIST, 'addresses', (TType.STRUCT, [TNetworkAddress, None], False), None, ),  # 1
)
all_structs.append(TUniqueId)
TUniqueId.thrift_spec = (
    None,  # 0
    (1, TType.I64, 'hi', None, None, ),  # 1
    (2, TType.I64, 'lo', None, None, ),  # 2
)
all_structs.append(TFunctionName)
TFunctionName.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'db_name', None, None, ),  # 1
    (2, TType.STRING, 'function_name', None, None, ),  # 2
)
all_structs.append(TScalarFunction)
TScalarFunction.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'symbol', None, None, ),  # 1
    (2, TType.STRING, 'prepare_fn_symbol', None, None, ),  # 2
    (3, TType.STRING, 'close_fn_symbol', None, None, ),  # 3
)
all_structs.append(TAggregateFunction)
TAggregateFunction.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'intermediate_type', [TColumnType, None], None, ),  # 1
    (2, TType.BOOL, 'is_analytic_only_fn', None, None, ),  # 2
    (3, TType.STRING, 'update_fn_symbol', None, None, ),  # 3
    (4, TType.STRING, 'init_fn_symbol', None, None, ),  # 4
    (5, TType.STRING, 'serialize_fn_symbol', None, None, ),  # 5
    (6, TType.STRING, 'merge_fn_symbol', None, None, ),  # 6
    (7, TType.STRING, 'finalize_fn_symbol', None, None, ),  # 7
    (8, TType.STRING, 'get_value_fn_symbol', None, None, ),  # 8
    (9, TType.STRING, 'remove_fn_symbol', None, None, ),  # 9
    (10, TType.BOOL, 'ignores_distinct', None, None, ),  # 10
)
all_structs.append(TFunction)
TFunction.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'name', [TFunctionName, None], None, ),  # 1
    (2, TType.I32, 'binary_type', None, None, ),  # 2
    (3, TType.LIST, 'arg_types', (TType.STRUCT, [TColumnType, None], False), None, ),  # 3
    (4, TType.STRUCT, 'ret_type', [TColumnType, None], None, ),  # 4
    (5, TType.BOOL, 'has_var_args', None, None, ),  # 5
    (6, TType.STRING, 'comment', None, None, ),  # 6
    (7, TType.STRING, 'signature', None, None, ),  # 7
    (8, TType.STRING, 'hdfs_location', None, None, ),  # 8
    (9, TType.STRUCT, 'scalar_fn', [TScalarFunction, None], None, ),  # 9
    (10, TType.STRUCT, 'aggregate_fn', [TAggregateFunction, None], None, ),  # 10
    (11, TType.BOOL, 'is_persistent', None, None, ),  # 11
    (12, TType.I64, 'last_modified_time', None, None, ),  # 12
)
fix_spec(all_structs)
del all_structs
