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

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

import sys

from thrift.transport import TTransport
all_structs = []


class TSProtocolVersion(object):
    IOTDB_SERVICE_PROTOCOL_V1 = 0

    _VALUES_TO_NAMES = {
        0: "IOTDB_SERVICE_PROTOCOL_V1",
    }

    _NAMES_TO_VALUES = {
        "IOTDB_SERVICE_PROTOCOL_V1": 0,
    }


class TSStatusType(object):
    """
    Attributes:
     - code
     - message

    """


    def __init__(self, code=None, message=None,):
        self.code = code
        self.message = message

    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.code = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else 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('TSStatusType')
        if self.code is not None:
            oprot.writeFieldBegin('code', TType.I32, 1)
            oprot.writeI32(self.code)
            oprot.writeFieldEnd()
        if self.message is not None:
            oprot.writeFieldBegin('message', TType.STRING, 2)
            oprot.writeString(self.message.encode('utf-8') if sys.version_info[0] == 2 else self.message)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.code is None:
            raise TProtocolException(message='Required field code is unset!')
        if self.message is None:
            raise TProtocolException(message='Required field message 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 TSStatus(object):
    """
    Attributes:
     - statusType
     - infoMessages
     - sqlState

    """


    def __init__(self, statusType=None, infoMessages=None, sqlState=None,):
        self.statusType = statusType
        self.infoMessages = infoMessages
        self.sqlState = sqlState

    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.statusType = TSStatusType()
                    self.statusType.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.infoMessages = []
                    (_etype3, _size0) = iprot.readListBegin()
                    for _i4 in range(_size0):
                        _elem5 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.infoMessages.append(_elem5)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.sqlState = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else 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('TSStatus')
        if self.statusType is not None:
            oprot.writeFieldBegin('statusType', TType.STRUCT, 1)
            self.statusType.write(oprot)
            oprot.writeFieldEnd()
        if self.infoMessages is not None:
            oprot.writeFieldBegin('infoMessages', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.infoMessages))
            for iter6 in self.infoMessages:
                oprot.writeString(iter6.encode('utf-8') if sys.version_info[0] == 2 else iter6)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.sqlState is not None:
            oprot.writeFieldBegin('sqlState', TType.STRING, 3)
            oprot.writeString(self.sqlState.encode('utf-8') if sys.version_info[0] == 2 else self.sqlState)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.statusType is None:
            raise TProtocolException(message='Required field statusType 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 TSHandleIdentifier(object):
    """
    Attributes:
     - guid
     - secret
     - queryId

    """


    def __init__(self, guid=None, secret=None, queryId=None,):
        self.guid = guid
        self.secret = secret
        self.queryId = queryId

    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.guid = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.secret = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I64:
                    self.queryId = 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('TSHandleIdentifier')
        if self.guid is not None:
            oprot.writeFieldBegin('guid', TType.STRING, 1)
            oprot.writeBinary(self.guid)
            oprot.writeFieldEnd()
        if self.secret is not None:
            oprot.writeFieldBegin('secret', TType.STRING, 2)
            oprot.writeBinary(self.secret)
            oprot.writeFieldEnd()
        if self.queryId is not None:
            oprot.writeFieldBegin('queryId', TType.I64, 3)
            oprot.writeI64(self.queryId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.guid is None:
            raise TProtocolException(message='Required field guid is unset!')
        if self.secret is None:
            raise TProtocolException(message='Required field secret is unset!')
        if self.queryId is None:
            raise TProtocolException(message='Required field queryId 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 TSOperationHandle(object):
    """
    Attributes:
     - operationId
     - hasResultSet

    """


    def __init__(self, operationId=None, hasResultSet=None,):
        self.operationId = operationId
        self.hasResultSet = hasResultSet

    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.operationId = TSHandleIdentifier()
                    self.operationId.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BOOL:
                    self.hasResultSet = 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('TSOperationHandle')
        if self.operationId is not None:
            oprot.writeFieldBegin('operationId', TType.STRUCT, 1)
            self.operationId.write(oprot)
            oprot.writeFieldEnd()
        if self.hasResultSet is not None:
            oprot.writeFieldBegin('hasResultSet', TType.BOOL, 2)
            oprot.writeBool(self.hasResultSet)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.operationId is None:
            raise TProtocolException(message='Required field operationId is unset!')
        if self.hasResultSet is None:
            raise TProtocolException(message='Required field hasResultSet 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 TSExecuteStatementResp(object):
    """
    Attributes:
     - status
     - operationHandle
     - columns
     - operationType
     - ignoreTimeStamp
     - dataTypeList

    """


    def __init__(self, status=None, operationHandle=None, columns=None, operationType=None, ignoreTimeStamp=None, dataTypeList=None,):
        self.status = status
        self.operationHandle = operationHandle
        self.columns = columns
        self.operationType = operationType
        self.ignoreTimeStamp = ignoreTimeStamp
        self.dataTypeList = dataTypeList

    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.status = TSStatus()
                    self.status.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.operationHandle = TSOperationHandle()
                    self.operationHandle.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.LIST:
                    self.columns = []
                    (_etype10, _size7) = iprot.readListBegin()
                    for _i11 in range(_size7):
                        _elem12 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.columns.append(_elem12)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRING:
                    self.operationType = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.BOOL:
                    self.ignoreTimeStamp = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.LIST:
                    self.dataTypeList = []
                    (_etype16, _size13) = iprot.readListBegin()
                    for _i17 in range(_size13):
                        _elem18 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.dataTypeList.append(_elem18)
                    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('TSExecuteStatementResp')
        if self.status is not None:
            oprot.writeFieldBegin('status', TType.STRUCT, 1)
            self.status.write(oprot)
            oprot.writeFieldEnd()
        if self.operationHandle is not None:
            oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2)
            self.operationHandle.write(oprot)
            oprot.writeFieldEnd()
        if self.columns is not None:
            oprot.writeFieldBegin('columns', TType.LIST, 3)
            oprot.writeListBegin(TType.STRING, len(self.columns))
            for iter19 in self.columns:
                oprot.writeString(iter19.encode('utf-8') if sys.version_info[0] == 2 else iter19)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.operationType is not None:
            oprot.writeFieldBegin('operationType', TType.STRING, 4)
            oprot.writeString(self.operationType.encode('utf-8') if sys.version_info[0] == 2 else self.operationType)
            oprot.writeFieldEnd()
        if self.ignoreTimeStamp is not None:
            oprot.writeFieldBegin('ignoreTimeStamp', TType.BOOL, 5)
            oprot.writeBool(self.ignoreTimeStamp)
            oprot.writeFieldEnd()
        if self.dataTypeList is not None:
            oprot.writeFieldBegin('dataTypeList', TType.LIST, 6)
            oprot.writeListBegin(TType.STRING, len(self.dataTypeList))
            for iter20 in self.dataTypeList:
                oprot.writeString(iter20.encode('utf-8') if sys.version_info[0] == 2 else iter20)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.status is None:
            raise TProtocolException(message='Required field status 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 TS_SessionHandle(object):
    """
    Attributes:
     - sessionId

    """


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

    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.sessionId = TSHandleIdentifier()
                    self.sessionId.read(iprot)
                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('TS_SessionHandle')
        if self.sessionId is not None:
            oprot.writeFieldBegin('sessionId', TType.STRUCT, 1)
            self.sessionId.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.sessionId is None:
            raise TProtocolException(message='Required field sessionId 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 TSOpenSessionResp(object):
    """
    Attributes:
     - status
     - serverProtocolVersion
     - sessionHandle
     - configuration

    """


    def __init__(self, status=None, serverProtocolVersion=0, sessionHandle=None, configuration=None,):
        self.status = status
        self.serverProtocolVersion = serverProtocolVersion
        self.sessionHandle = sessionHandle
        self.configuration = configuration

    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.status = TSStatus()
                    self.status.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.serverProtocolVersion = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.sessionHandle = TS_SessionHandle()
                    self.sessionHandle.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.MAP:
                    self.configuration = {}
                    (_ktype22, _vtype23, _size21) = iprot.readMapBegin()
                    for _i25 in range(_size21):
                        _key26 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        _val27 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.configuration[_key26] = _val27
                    iprot.readMapEnd()
                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('TSOpenSessionResp')
        if self.status is not None:
            oprot.writeFieldBegin('status', TType.STRUCT, 1)
            self.status.write(oprot)
            oprot.writeFieldEnd()
        if self.serverProtocolVersion is not None:
            oprot.writeFieldBegin('serverProtocolVersion', TType.I32, 2)
            oprot.writeI32(self.serverProtocolVersion)
            oprot.writeFieldEnd()
        if self.sessionHandle is not None:
            oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 3)
            self.sessionHandle.write(oprot)
            oprot.writeFieldEnd()
        if self.configuration is not None:
            oprot.writeFieldBegin('configuration', TType.MAP, 4)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration))
            for kiter28, viter29 in self.configuration.items():
                oprot.writeString(kiter28.encode('utf-8') if sys.version_info[0] == 2 else kiter28)
                oprot.writeString(viter29.encode('utf-8') if sys.version_info[0] == 2 else viter29)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.status is None:
            raise TProtocolException(message='Required field status is unset!')
        if self.serverProtocolVersion is None:
            raise TProtocolException(message='Required field serverProtocolVersion 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 TSOpenSessionReq(object):
    """
    Attributes:
     - client_protocol
     - username
     - password
     - configuration

    """


    def __init__(self, client_protocol=0, username=None, password=None, configuration=None,):
        self.client_protocol = client_protocol
        self.username = username
        self.password = password
        self.configuration = configuration

    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.client_protocol = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.password = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.MAP:
                    self.configuration = {}
                    (_ktype31, _vtype32, _size30) = iprot.readMapBegin()
                    for _i34 in range(_size30):
                        _key35 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        _val36 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.configuration[_key35] = _val36
                    iprot.readMapEnd()
                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('TSOpenSessionReq')
        if self.client_protocol is not None:
            oprot.writeFieldBegin('client_protocol', TType.I32, 1)
            oprot.writeI32(self.client_protocol)
            oprot.writeFieldEnd()
        if self.username is not None:
            oprot.writeFieldBegin('username', TType.STRING, 2)
            oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username)
            oprot.writeFieldEnd()
        if self.password is not None:
            oprot.writeFieldBegin('password', TType.STRING, 3)
            oprot.writeString(self.password.encode('utf-8') if sys.version_info[0] == 2 else self.password)
            oprot.writeFieldEnd()
        if self.configuration is not None:
            oprot.writeFieldBegin('configuration', TType.MAP, 4)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration))
            for kiter37, viter38 in self.configuration.items():
                oprot.writeString(kiter37.encode('utf-8') if sys.version_info[0] == 2 else kiter37)
                oprot.writeString(viter38.encode('utf-8') if sys.version_info[0] == 2 else viter38)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.client_protocol is None:
            raise TProtocolException(message='Required field client_protocol 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 TSCloseSessionReq(object):
    """
    Attributes:
     - sessionHandle

    """


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

    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.sessionHandle = TS_SessionHandle()
                    self.sessionHandle.read(iprot)
                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('TSCloseSessionReq')
        if self.sessionHandle is not None:
            oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1)
            self.sessionHandle.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.sessionHandle is None:
            raise TProtocolException(message='Required field sessionHandle 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 TSExecuteStatementReq(object):
    """
    Attributes:
     - sessionHandle
     - statement
     - statementId

    """


    def __init__(self, sessionHandle=None, statement=None, statementId=None,):
        self.sessionHandle = sessionHandle
        self.statement = statement
        self.statementId = statementId

    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.sessionHandle = TS_SessionHandle()
                    self.sessionHandle.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.statement = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I64:
                    self.statementId = 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('TSExecuteStatementReq')
        if self.sessionHandle is not None:
            oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1)
            self.sessionHandle.write(oprot)
            oprot.writeFieldEnd()
        if self.statement is not None:
            oprot.writeFieldBegin('statement', TType.STRING, 2)
            oprot.writeString(self.statement.encode('utf-8') if sys.version_info[0] == 2 else self.statement)
            oprot.writeFieldEnd()
        if self.statementId is not None:
            oprot.writeFieldBegin('statementId', TType.I64, 3)
            oprot.writeI64(self.statementId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.sessionHandle is None:
            raise TProtocolException(message='Required field sessionHandle is unset!')
        if self.statement is None:
            raise TProtocolException(message='Required field statement is unset!')
        if self.statementId is None:
            raise TProtocolException(message='Required field statementId 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 TSExecuteBatchStatementResp(object):
    """
    Attributes:
     - status
     - result

    """


    def __init__(self, status=None, result=None,):
        self.status = status
        self.result = result

    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.status = TSStatus()
                    self.status.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.result = []
                    (_etype42, _size39) = iprot.readListBegin()
                    for _i43 in range(_size39):
                        _elem44 = iprot.readI32()
                        self.result.append(_elem44)
                    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('TSExecuteBatchStatementResp')
        if self.status is not None:
            oprot.writeFieldBegin('status', TType.STRUCT, 1)
            self.status.write(oprot)
            oprot.writeFieldEnd()
        if self.result is not None:
            oprot.writeFieldBegin('result', TType.LIST, 2)
            oprot.writeListBegin(TType.I32, len(self.result))
            for iter45 in self.result:
                oprot.writeI32(iter45)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.status is None:
            raise TProtocolException(message='Required field status 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 TSExecuteBatchStatementReq(object):
    """
    Attributes:
     - sessionHandle
     - statements

    """


    def __init__(self, sessionHandle=None, statements=None,):
        self.sessionHandle = sessionHandle
        self.statements = statements

    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.sessionHandle = TS_SessionHandle()
                    self.sessionHandle.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.statements = []
                    (_etype49, _size46) = iprot.readListBegin()
                    for _i50 in range(_size46):
                        _elem51 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.statements.append(_elem51)
                    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('TSExecuteBatchStatementReq')
        if self.sessionHandle is not None:
            oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1)
            self.sessionHandle.write(oprot)
            oprot.writeFieldEnd()
        if self.statements is not None:
            oprot.writeFieldBegin('statements', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.statements))
            for iter52 in self.statements:
                oprot.writeString(iter52.encode('utf-8') if sys.version_info[0] == 2 else iter52)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.sessionHandle is None:
            raise TProtocolException(message='Required field sessionHandle is unset!')
        if self.statements is None:
            raise TProtocolException(message='Required field statements 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 TSGetOperationStatusReq(object):
    """
    Attributes:
     - operationHandle

    """


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

    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.operationHandle = TSOperationHandle()
                    self.operationHandle.read(iprot)
                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('TSGetOperationStatusReq')
        if self.operationHandle is not None:
            oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1)
            self.operationHandle.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.operationHandle is None:
            raise TProtocolException(message='Required field operationHandle 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 TSCancelOperationReq(object):
    """
    Attributes:
     - operationHandle

    """


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

    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.operationHandle = TSOperationHandle()
                    self.operationHandle.read(iprot)
                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('TSCancelOperationReq')
        if self.operationHandle is not None:
            oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1)
            self.operationHandle.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.operationHandle is None:
            raise TProtocolException(message='Required field operationHandle 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 TSCloseOperationReq(object):
    """
    Attributes:
     - operationHandle
     - queryId
     - stmtId

    """


    def __init__(self, operationHandle=None, queryId=None, stmtId=None,):
        self.operationHandle = operationHandle
        self.queryId = queryId
        self.stmtId = stmtId

    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.operationHandle = TSOperationHandle()
                    self.operationHandle.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I64:
                    self.queryId = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I64:
                    self.stmtId = 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('TSCloseOperationReq')
        if self.operationHandle is not None:
            oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1)
            self.operationHandle.write(oprot)
            oprot.writeFieldEnd()
        if self.queryId is not None:
            oprot.writeFieldBegin('queryId', TType.I64, 2)
            oprot.writeI64(self.queryId)
            oprot.writeFieldEnd()
        if self.stmtId is not None:
            oprot.writeFieldBegin('stmtId', TType.I64, 3)
            oprot.writeI64(self.stmtId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.operationHandle is None:
            raise TProtocolException(message='Required field operationHandle is unset!')
        if self.queryId is None:
            raise TProtocolException(message='Required field queryId 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 TSQueryDataSet(object):
    """
    Attributes:
     - values
     - rowCount

    """


    def __init__(self, values=None, rowCount=None,):
        self.values = values
        self.rowCount = rowCount

    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.values = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.rowCount = 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('TSQueryDataSet')
        if self.values is not None:
            oprot.writeFieldBegin('values', TType.STRING, 1)
            oprot.writeBinary(self.values)
            oprot.writeFieldEnd()
        if self.rowCount is not None:
            oprot.writeFieldBegin('rowCount', TType.I32, 2)
            oprot.writeI32(self.rowCount)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.values is None:
            raise TProtocolException(message='Required field values is unset!')
        if self.rowCount is None:
            raise TProtocolException(message='Required field rowCount 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 TSFetchResultsReq(object):
    """
    Attributes:
     - statement
     - fetch_size
     - queryId

    """


    def __init__(self, statement=None, fetch_size=None, queryId=None,):
        self.statement = statement
        self.fetch_size = fetch_size
        self.queryId = queryId

    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.statement = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.fetch_size = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I64:
                    self.queryId = 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('TSFetchResultsReq')
        if self.statement is not None:
            oprot.writeFieldBegin('statement', TType.STRING, 1)
            oprot.writeString(self.statement.encode('utf-8') if sys.version_info[0] == 2 else self.statement)
            oprot.writeFieldEnd()
        if self.fetch_size is not None:
            oprot.writeFieldBegin('fetch_size', TType.I32, 2)
            oprot.writeI32(self.fetch_size)
            oprot.writeFieldEnd()
        if self.queryId is not None:
            oprot.writeFieldBegin('queryId', TType.I64, 3)
            oprot.writeI64(self.queryId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.statement is None:
            raise TProtocolException(message='Required field statement is unset!')
        if self.fetch_size is None:
            raise TProtocolException(message='Required field fetch_size is unset!')
        if self.queryId is None:
            raise TProtocolException(message='Required field queryId 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 TSFetchResultsResp(object):
    """
    Attributes:
     - status
     - hasResultSet
     - queryDataSet

    """


    def __init__(self, status=None, hasResultSet=None, queryDataSet=None,):
        self.status = status
        self.hasResultSet = hasResultSet
        self.queryDataSet = queryDataSet

    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.status = TSStatus()
                    self.status.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BOOL:
                    self.hasResultSet = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.queryDataSet = TSQueryDataSet()
                    self.queryDataSet.read(iprot)
                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('TSFetchResultsResp')
        if self.status is not None:
            oprot.writeFieldBegin('status', TType.STRUCT, 1)
            self.status.write(oprot)
            oprot.writeFieldEnd()
        if self.hasResultSet is not None:
            oprot.writeFieldBegin('hasResultSet', TType.BOOL, 2)
            oprot.writeBool(self.hasResultSet)
            oprot.writeFieldEnd()
        if self.queryDataSet is not None:
            oprot.writeFieldBegin('queryDataSet', TType.STRUCT, 3)
            self.queryDataSet.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.status is None:
            raise TProtocolException(message='Required field status is unset!')
        if self.hasResultSet is None:
            raise TProtocolException(message='Required field hasResultSet 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 TSFetchMetadataResp(object):
    """
    Attributes:
     - status
     - metadataInJson
     - columnsList
     - timeseriesNum
     - dataType
     - timeseriesList
     - storageGroups
     - devices
     - nodesList
     - nodeTimeseriesNum
     - childPaths
     - version

    """


    def __init__(self, status=None, metadataInJson=None, columnsList=None, timeseriesNum=None, dataType=None, timeseriesList=None, storageGroups=None, devices=None, nodesList=None, nodeTimeseriesNum=None, childPaths=None, version=None,):
        self.status = status
        self.metadataInJson = metadataInJson
        self.columnsList = columnsList
        self.timeseriesNum = timeseriesNum
        self.dataType = dataType
        self.timeseriesList = timeseriesList
        self.storageGroups = storageGroups
        self.devices = devices
        self.nodesList = nodesList
        self.nodeTimeseriesNum = nodeTimeseriesNum
        self.childPaths = childPaths
        self.version = version

    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.status = TSStatus()
                    self.status.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.metadataInJson = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.LIST:
                    self.columnsList = []
                    (_etype56, _size53) = iprot.readListBegin()
                    for _i57 in range(_size53):
                        _elem58 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.columnsList.append(_elem58)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I32:
                    self.timeseriesNum = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRING:
                    self.dataType = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.LIST:
                    self.timeseriesList = []
                    (_etype62, _size59) = iprot.readListBegin()
                    for _i63 in range(_size59):
                        _elem64 = []
                        (_etype68, _size65) = iprot.readListBegin()
                        for _i69 in range(_size65):
                            _elem70 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                            _elem64.append(_elem70)
                        iprot.readListEnd()
                        self.timeseriesList.append(_elem64)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.SET:
                    self.storageGroups = set()
                    (_etype74, _size71) = iprot.readSetBegin()
                    for _i75 in range(_size71):
                        _elem76 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.storageGroups.add(_elem76)
                    iprot.readSetEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 8:
                if ftype == TType.SET:
                    self.devices = set()
                    (_etype80, _size77) = iprot.readSetBegin()
                    for _i81 in range(_size77):
                        _elem82 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.devices.add(_elem82)
                    iprot.readSetEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 9:
                if ftype == TType.LIST:
                    self.nodesList = []
                    (_etype86, _size83) = iprot.readListBegin()
                    for _i87 in range(_size83):
                        _elem88 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.nodesList.append(_elem88)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 10:
                if ftype == TType.MAP:
                    self.nodeTimeseriesNum = {}
                    (_ktype90, _vtype91, _size89) = iprot.readMapBegin()
                    for _i93 in range(_size89):
                        _key94 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        _val95 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.nodeTimeseriesNum[_key94] = _val95
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 11:
                if ftype == TType.SET:
                    self.childPaths = set()
                    (_etype99, _size96) = iprot.readSetBegin()
                    for _i100 in range(_size96):
                        _elem101 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.childPaths.add(_elem101)
                    iprot.readSetEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 12:
                if ftype == TType.STRING:
                    self.version = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else 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('TSFetchMetadataResp')
        if self.status is not None:
            oprot.writeFieldBegin('status', TType.STRUCT, 1)
            self.status.write(oprot)
            oprot.writeFieldEnd()
        if self.metadataInJson is not None:
            oprot.writeFieldBegin('metadataInJson', TType.STRING, 2)
            oprot.writeString(self.metadataInJson.encode('utf-8') if sys.version_info[0] == 2 else self.metadataInJson)
            oprot.writeFieldEnd()
        if self.columnsList is not None:
            oprot.writeFieldBegin('columnsList', TType.LIST, 3)
            oprot.writeListBegin(TType.STRING, len(self.columnsList))
            for iter102 in self.columnsList:
                oprot.writeString(iter102.encode('utf-8') if sys.version_info[0] == 2 else iter102)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.timeseriesNum is not None:
            oprot.writeFieldBegin('timeseriesNum', TType.I32, 4)
            oprot.writeI32(self.timeseriesNum)
            oprot.writeFieldEnd()
        if self.dataType is not None:
            oprot.writeFieldBegin('dataType', TType.STRING, 5)
            oprot.writeString(self.dataType.encode('utf-8') if sys.version_info[0] == 2 else self.dataType)
            oprot.writeFieldEnd()
        if self.timeseriesList is not None:
            oprot.writeFieldBegin('timeseriesList', TType.LIST, 6)
            oprot.writeListBegin(TType.LIST, len(self.timeseriesList))
            for iter103 in self.timeseriesList:
                oprot.writeListBegin(TType.STRING, len(iter103))
                for iter104 in iter103:
                    oprot.writeString(iter104.encode('utf-8') if sys.version_info[0] == 2 else iter104)
                oprot.writeListEnd()
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.storageGroups is not None:
            oprot.writeFieldBegin('storageGroups', TType.SET, 7)
            oprot.writeSetBegin(TType.STRING, len(self.storageGroups))
            for iter105 in self.storageGroups:
                oprot.writeString(iter105.encode('utf-8') if sys.version_info[0] == 2 else iter105)
            oprot.writeSetEnd()
            oprot.writeFieldEnd()
        if self.devices is not None:
            oprot.writeFieldBegin('devices', TType.SET, 8)
            oprot.writeSetBegin(TType.STRING, len(self.devices))
            for iter106 in self.devices:
                oprot.writeString(iter106.encode('utf-8') if sys.version_info[0] == 2 else iter106)
            oprot.writeSetEnd()
            oprot.writeFieldEnd()
        if self.nodesList is not None:
            oprot.writeFieldBegin('nodesList', TType.LIST, 9)
            oprot.writeListBegin(TType.STRING, len(self.nodesList))
            for iter107 in self.nodesList:
                oprot.writeString(iter107.encode('utf-8') if sys.version_info[0] == 2 else iter107)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.nodeTimeseriesNum is not None:
            oprot.writeFieldBegin('nodeTimeseriesNum', TType.MAP, 10)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.nodeTimeseriesNum))
            for kiter108, viter109 in self.nodeTimeseriesNum.items():
                oprot.writeString(kiter108.encode('utf-8') if sys.version_info[0] == 2 else kiter108)
                oprot.writeString(viter109.encode('utf-8') if sys.version_info[0] == 2 else viter109)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.childPaths is not None:
            oprot.writeFieldBegin('childPaths', TType.SET, 11)
            oprot.writeSetBegin(TType.STRING, len(self.childPaths))
            for iter110 in self.childPaths:
                oprot.writeString(iter110.encode('utf-8') if sys.version_info[0] == 2 else iter110)
            oprot.writeSetEnd()
            oprot.writeFieldEnd()
        if self.version is not None:
            oprot.writeFieldBegin('version', TType.STRING, 12)
            oprot.writeString(self.version.encode('utf-8') if sys.version_info[0] == 2 else self.version)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.status is None:
            raise TProtocolException(message='Required field status 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 TSFetchMetadataReq(object):
    """
    Attributes:
     - type
     - columnPath
     - nodeLevel

    """


    def __init__(self, type=None, columnPath=None, nodeLevel=None,):
        self.type = type
        self.columnPath = columnPath
        self.nodeLevel = nodeLevel

    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.type = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.columnPath = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.nodeLevel = 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('TSFetchMetadataReq')
        if self.type is not None:
            oprot.writeFieldBegin('type', TType.STRING, 1)
            oprot.writeString(self.type.encode('utf-8') if sys.version_info[0] == 2 else self.type)
            oprot.writeFieldEnd()
        if self.columnPath is not None:
            oprot.writeFieldBegin('columnPath', TType.STRING, 2)
            oprot.writeString(self.columnPath.encode('utf-8') if sys.version_info[0] == 2 else self.columnPath)
            oprot.writeFieldEnd()
        if self.nodeLevel is not None:
            oprot.writeFieldBegin('nodeLevel', TType.I32, 3)
            oprot.writeI32(self.nodeLevel)
            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 TSColumnSchema(object):
    """
    Attributes:
     - name
     - dataType
     - encoding
     - otherArgs

    """


    def __init__(self, name=None, dataType=None, encoding=None, otherArgs=None,):
        self.name = name
        self.dataType = dataType
        self.encoding = encoding
        self.otherArgs = otherArgs

    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().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.dataType = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.encoding = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.MAP:
                    self.otherArgs = {}
                    (_ktype112, _vtype113, _size111) = iprot.readMapBegin()
                    for _i115 in range(_size111):
                        _key116 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        _val117 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.otherArgs[_key116] = _val117
                    iprot.readMapEnd()
                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('TSColumnSchema')
        if self.name is not None:
            oprot.writeFieldBegin('name', TType.STRING, 1)
            oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name)
            oprot.writeFieldEnd()
        if self.dataType is not None:
            oprot.writeFieldBegin('dataType', TType.STRING, 2)
            oprot.writeString(self.dataType.encode('utf-8') if sys.version_info[0] == 2 else self.dataType)
            oprot.writeFieldEnd()
        if self.encoding is not None:
            oprot.writeFieldBegin('encoding', TType.STRING, 3)
            oprot.writeString(self.encoding.encode('utf-8') if sys.version_info[0] == 2 else self.encoding)
            oprot.writeFieldEnd()
        if self.otherArgs is not None:
            oprot.writeFieldBegin('otherArgs', TType.MAP, 4)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.otherArgs))
            for kiter118, viter119 in self.otherArgs.items():
                oprot.writeString(kiter118.encode('utf-8') if sys.version_info[0] == 2 else kiter118)
                oprot.writeString(viter119.encode('utf-8') if sys.version_info[0] == 2 else viter119)
            oprot.writeMapEnd()
            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 TSGetTimeZoneResp(object):
    """
    Attributes:
     - status
     - timeZone

    """


    def __init__(self, status=None, timeZone=None,):
        self.status = status
        self.timeZone = timeZone

    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.status = TSStatus()
                    self.status.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.timeZone = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else 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('TSGetTimeZoneResp')
        if self.status is not None:
            oprot.writeFieldBegin('status', TType.STRUCT, 1)
            self.status.write(oprot)
            oprot.writeFieldEnd()
        if self.timeZone is not None:
            oprot.writeFieldBegin('timeZone', TType.STRING, 2)
            oprot.writeString(self.timeZone.encode('utf-8') if sys.version_info[0] == 2 else self.timeZone)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.status is None:
            raise TProtocolException(message='Required field status is unset!')
        if self.timeZone is None:
            raise TProtocolException(message='Required field timeZone 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 TSSetTimeZoneReq(object):
    """
    Attributes:
     - timeZone

    """


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

    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.timeZone = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else 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('TSSetTimeZoneReq')
        if self.timeZone is not None:
            oprot.writeFieldBegin('timeZone', TType.STRING, 1)
            oprot.writeString(self.timeZone.encode('utf-8') if sys.version_info[0] == 2 else self.timeZone)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.timeZone is None:
            raise TProtocolException(message='Required field timeZone 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 TSInsertionReq(object):
    """
    Attributes:
     - deviceId
     - measurements
     - values
     - timestamp
     - stmtId

    """


    def __init__(self, deviceId=None, measurements=None, values=None, timestamp=None, stmtId=None,):
        self.deviceId = deviceId
        self.measurements = measurements
        self.values = values
        self.timestamp = timestamp
        self.stmtId = stmtId

    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.deviceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.measurements = []
                    (_etype123, _size120) = iprot.readListBegin()
                    for _i124 in range(_size120):
                        _elem125 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.measurements.append(_elem125)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.LIST:
                    self.values = []
                    (_etype129, _size126) = iprot.readListBegin()
                    for _i130 in range(_size126):
                        _elem131 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.values.append(_elem131)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I64:
                    self.timestamp = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.I64:
                    self.stmtId = 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('TSInsertionReq')
        if self.deviceId is not None:
            oprot.writeFieldBegin('deviceId', TType.STRING, 1)
            oprot.writeString(self.deviceId.encode('utf-8') if sys.version_info[0] == 2 else self.deviceId)
            oprot.writeFieldEnd()
        if self.measurements is not None:
            oprot.writeFieldBegin('measurements', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.measurements))
            for iter132 in self.measurements:
                oprot.writeString(iter132.encode('utf-8') if sys.version_info[0] == 2 else iter132)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.values is not None:
            oprot.writeFieldBegin('values', TType.LIST, 3)
            oprot.writeListBegin(TType.STRING, len(self.values))
            for iter133 in self.values:
                oprot.writeString(iter133.encode('utf-8') if sys.version_info[0] == 2 else iter133)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.timestamp is not None:
            oprot.writeFieldBegin('timestamp', TType.I64, 4)
            oprot.writeI64(self.timestamp)
            oprot.writeFieldEnd()
        if self.stmtId is not None:
            oprot.writeFieldBegin('stmtId', TType.I64, 5)
            oprot.writeI64(self.stmtId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.stmtId is None:
            raise TProtocolException(message='Required field stmtId 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 TSBatchInsertionReq(object):
    """
    Attributes:
     - deviceId
     - measurements
     - values
     - timestamps
     - types
     - size

    """


    def __init__(self, deviceId=None, measurements=None, values=None, timestamps=None, types=None, size=None,):
        self.deviceId = deviceId
        self.measurements = measurements
        self.values = values
        self.timestamps = timestamps
        self.types = types
        self.size = size

    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.deviceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.measurements = []
                    (_etype137, _size134) = iprot.readListBegin()
                    for _i138 in range(_size134):
                        _elem139 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.measurements.append(_elem139)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.values = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRING:
                    self.timestamps = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.LIST:
                    self.types = []
                    (_etype143, _size140) = iprot.readListBegin()
                    for _i144 in range(_size140):
                        _elem145 = iprot.readI32()
                        self.types.append(_elem145)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.I32:
                    self.size = 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('TSBatchInsertionReq')
        if self.deviceId is not None:
            oprot.writeFieldBegin('deviceId', TType.STRING, 1)
            oprot.writeString(self.deviceId.encode('utf-8') if sys.version_info[0] == 2 else self.deviceId)
            oprot.writeFieldEnd()
        if self.measurements is not None:
            oprot.writeFieldBegin('measurements', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.measurements))
            for iter146 in self.measurements:
                oprot.writeString(iter146.encode('utf-8') if sys.version_info[0] == 2 else iter146)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.values is not None:
            oprot.writeFieldBegin('values', TType.STRING, 3)
            oprot.writeBinary(self.values)
            oprot.writeFieldEnd()
        if self.timestamps is not None:
            oprot.writeFieldBegin('timestamps', TType.STRING, 4)
            oprot.writeBinary(self.timestamps)
            oprot.writeFieldEnd()
        if self.types is not None:
            oprot.writeFieldBegin('types', TType.LIST, 5)
            oprot.writeListBegin(TType.I32, len(self.types))
            for iter147 in self.types:
                oprot.writeI32(iter147)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.size is not None:
            oprot.writeFieldBegin('size', TType.I32, 6)
            oprot.writeI32(self.size)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.deviceId is None:
            raise TProtocolException(message='Required field deviceId is unset!')
        if self.measurements is None:
            raise TProtocolException(message='Required field measurements is unset!')
        if self.values is None:
            raise TProtocolException(message='Required field values is unset!')
        if self.timestamps is None:
            raise TProtocolException(message='Required field timestamps is unset!')
        if self.types is None:
            raise TProtocolException(message='Required field types is unset!')
        if self.size is None:
            raise TProtocolException(message='Required field size 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 TSExecuteInsertRowInBatchResp(object):
    """
    Attributes:
     - statusList

    """


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

    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.statusList = []
                    (_etype151, _size148) = iprot.readListBegin()
                    for _i152 in range(_size148):
                        _elem153 = TSStatus()
                        _elem153.read(iprot)
                        self.statusList.append(_elem153)
                    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('TSExecuteInsertRowInBatchResp')
        if self.statusList is not None:
            oprot.writeFieldBegin('statusList', TType.LIST, 1)
            oprot.writeListBegin(TType.STRUCT, len(self.statusList))
            for iter154 in self.statusList:
                iter154.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.statusList is None:
            raise TProtocolException(message='Required field statusList 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 TSInsertInBatchReq(object):
    """
    Attributes:
     - deviceIds
     - measurementsList
     - valuesList
     - timestamps

    """


    def __init__(self, deviceIds=None, measurementsList=None, valuesList=None, timestamps=None,):
        self.deviceIds = deviceIds
        self.measurementsList = measurementsList
        self.valuesList = valuesList
        self.timestamps = timestamps

    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.deviceIds = []
                    (_etype158, _size155) = iprot.readListBegin()
                    for _i159 in range(_size155):
                        _elem160 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.deviceIds.append(_elem160)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.measurementsList = []
                    (_etype164, _size161) = iprot.readListBegin()
                    for _i165 in range(_size161):
                        _elem166 = []
                        (_etype170, _size167) = iprot.readListBegin()
                        for _i171 in range(_size167):
                            _elem172 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                            _elem166.append(_elem172)
                        iprot.readListEnd()
                        self.measurementsList.append(_elem166)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.LIST:
                    self.valuesList = []
                    (_etype176, _size173) = iprot.readListBegin()
                    for _i177 in range(_size173):
                        _elem178 = []
                        (_etype182, _size179) = iprot.readListBegin()
                        for _i183 in range(_size179):
                            _elem184 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                            _elem178.append(_elem184)
                        iprot.readListEnd()
                        self.valuesList.append(_elem178)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.LIST:
                    self.timestamps = []
                    (_etype188, _size185) = iprot.readListBegin()
                    for _i189 in range(_size185):
                        _elem190 = iprot.readI64()
                        self.timestamps.append(_elem190)
                    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('TSInsertInBatchReq')
        if self.deviceIds is not None:
            oprot.writeFieldBegin('deviceIds', TType.LIST, 1)
            oprot.writeListBegin(TType.STRING, len(self.deviceIds))
            for iter191 in self.deviceIds:
                oprot.writeString(iter191.encode('utf-8') if sys.version_info[0] == 2 else iter191)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.measurementsList is not None:
            oprot.writeFieldBegin('measurementsList', TType.LIST, 2)
            oprot.writeListBegin(TType.LIST, len(self.measurementsList))
            for iter192 in self.measurementsList:
                oprot.writeListBegin(TType.STRING, len(iter192))
                for iter193 in iter192:
                    oprot.writeString(iter193.encode('utf-8') if sys.version_info[0] == 2 else iter193)
                oprot.writeListEnd()
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.valuesList is not None:
            oprot.writeFieldBegin('valuesList', TType.LIST, 3)
            oprot.writeListBegin(TType.LIST, len(self.valuesList))
            for iter194 in self.valuesList:
                oprot.writeListBegin(TType.STRING, len(iter194))
                for iter195 in iter194:
                    oprot.writeString(iter195.encode('utf-8') if sys.version_info[0] == 2 else iter195)
                oprot.writeListEnd()
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.timestamps is not None:
            oprot.writeFieldBegin('timestamps', TType.LIST, 4)
            oprot.writeListBegin(TType.I64, len(self.timestamps))
            for iter196 in self.timestamps:
                oprot.writeI64(iter196)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.deviceIds is None:
            raise TProtocolException(message='Required field deviceIds is unset!')
        if self.measurementsList is None:
            raise TProtocolException(message='Required field measurementsList is unset!')
        if self.valuesList is None:
            raise TProtocolException(message='Required field valuesList is unset!')
        if self.timestamps is None:
            raise TProtocolException(message='Required field timestamps 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 TSInsertReq(object):
    """
    Attributes:
     - deviceId
     - measurements
     - values
     - timestamp

    """


    def __init__(self, deviceId=None, measurements=None, values=None, timestamp=None,):
        self.deviceId = deviceId
        self.measurements = measurements
        self.values = values
        self.timestamp = timestamp

    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.deviceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.measurements = []
                    (_etype200, _size197) = iprot.readListBegin()
                    for _i201 in range(_size197):
                        _elem202 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.measurements.append(_elem202)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.LIST:
                    self.values = []
                    (_etype206, _size203) = iprot.readListBegin()
                    for _i207 in range(_size203):
                        _elem208 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.values.append(_elem208)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I64:
                    self.timestamp = 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('TSInsertReq')
        if self.deviceId is not None:
            oprot.writeFieldBegin('deviceId', TType.STRING, 1)
            oprot.writeString(self.deviceId.encode('utf-8') if sys.version_info[0] == 2 else self.deviceId)
            oprot.writeFieldEnd()
        if self.measurements is not None:
            oprot.writeFieldBegin('measurements', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.measurements))
            for iter209 in self.measurements:
                oprot.writeString(iter209.encode('utf-8') if sys.version_info[0] == 2 else iter209)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.values is not None:
            oprot.writeFieldBegin('values', TType.LIST, 3)
            oprot.writeListBegin(TType.STRING, len(self.values))
            for iter210 in self.values:
                oprot.writeString(iter210.encode('utf-8') if sys.version_info[0] == 2 else iter210)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.timestamp is not None:
            oprot.writeFieldBegin('timestamp', TType.I64, 4)
            oprot.writeI64(self.timestamp)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.deviceId is None:
            raise TProtocolException(message='Required field deviceId is unset!')
        if self.measurements is None:
            raise TProtocolException(message='Required field measurements is unset!')
        if self.values is None:
            raise TProtocolException(message='Required field values is unset!')
        if self.timestamp is None:
            raise TProtocolException(message='Required field timestamp 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 TSDeleteDataReq(object):
    """
    Attributes:
     - paths
     - timestamp

    """


    def __init__(self, paths=None, timestamp=None,):
        self.paths = paths
        self.timestamp = timestamp

    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.paths = []
                    (_etype214, _size211) = iprot.readListBegin()
                    for _i215 in range(_size211):
                        _elem216 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.paths.append(_elem216)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I64:
                    self.timestamp = 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('TSDeleteDataReq')
        if self.paths is not None:
            oprot.writeFieldBegin('paths', TType.LIST, 1)
            oprot.writeListBegin(TType.STRING, len(self.paths))
            for iter217 in self.paths:
                oprot.writeString(iter217.encode('utf-8') if sys.version_info[0] == 2 else iter217)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.timestamp is not None:
            oprot.writeFieldBegin('timestamp', TType.I64, 2)
            oprot.writeI64(self.timestamp)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.paths is None:
            raise TProtocolException(message='Required field paths is unset!')
        if self.timestamp is None:
            raise TProtocolException(message='Required field timestamp 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 TSCreateTimeseriesReq(object):
    """
    Attributes:
     - path
     - dataType
     - encoding
     - compressor

    """


    def __init__(self, path=None, dataType=None, encoding=None, compressor=None,):
        self.path = path
        self.dataType = dataType
        self.encoding = encoding
        self.compressor = compressor

    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.path = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.dataType = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.encoding = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I32:
                    self.compressor = 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('TSCreateTimeseriesReq')
        if self.path is not None:
            oprot.writeFieldBegin('path', TType.STRING, 1)
            oprot.writeString(self.path.encode('utf-8') if sys.version_info[0] == 2 else self.path)
            oprot.writeFieldEnd()
        if self.dataType is not None:
            oprot.writeFieldBegin('dataType', TType.I32, 2)
            oprot.writeI32(self.dataType)
            oprot.writeFieldEnd()
        if self.encoding is not None:
            oprot.writeFieldBegin('encoding', TType.I32, 3)
            oprot.writeI32(self.encoding)
            oprot.writeFieldEnd()
        if self.compressor is not None:
            oprot.writeFieldBegin('compressor', TType.I32, 4)
            oprot.writeI32(self.compressor)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.path is None:
            raise TProtocolException(message='Required field path is unset!')
        if self.dataType is None:
            raise TProtocolException(message='Required field dataType is unset!')
        if self.encoding is None:
            raise TProtocolException(message='Required field encoding is unset!')
        if self.compressor is None:
            raise TProtocolException(message='Required field compressor 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 ServerProperties(object):
    """
    Attributes:
     - version
     - supportedTimeAggregationOperations
     - timestampPrecision

    """


    def __init__(self, version=None, supportedTimeAggregationOperations=None, timestampPrecision=None,):
        self.version = version
        self.supportedTimeAggregationOperations = supportedTimeAggregationOperations
        self.timestampPrecision = timestampPrecision

    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.version = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.supportedTimeAggregationOperations = []
                    (_etype221, _size218) = iprot.readListBegin()
                    for _i222 in range(_size218):
                        _elem223 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.supportedTimeAggregationOperations.append(_elem223)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.timestampPrecision = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else 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('ServerProperties')
        if self.version is not None:
            oprot.writeFieldBegin('version', TType.STRING, 1)
            oprot.writeString(self.version.encode('utf-8') if sys.version_info[0] == 2 else self.version)
            oprot.writeFieldEnd()
        if self.supportedTimeAggregationOperations is not None:
            oprot.writeFieldBegin('supportedTimeAggregationOperations', TType.LIST, 2)
            oprot.writeListBegin(TType.STRING, len(self.supportedTimeAggregationOperations))
            for iter224 in self.supportedTimeAggregationOperations:
                oprot.writeString(iter224.encode('utf-8') if sys.version_info[0] == 2 else iter224)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.timestampPrecision is not None:
            oprot.writeFieldBegin('timestampPrecision', TType.STRING, 3)
            oprot.writeString(self.timestampPrecision.encode('utf-8') if sys.version_info[0] == 2 else self.timestampPrecision)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        if self.version is None:
            raise TProtocolException(message='Required field version is unset!')
        if self.supportedTimeAggregationOperations is None:
            raise TProtocolException(message='Required field supportedTimeAggregationOperations is unset!')
        if self.timestampPrecision is None:
            raise TProtocolException(message='Required field timestampPrecision 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(TSStatusType)
TSStatusType.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'code', None, None, ),  # 1
    (2, TType.STRING, 'message', 'UTF8', None, ),  # 2
)
all_structs.append(TSStatus)
TSStatus.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'statusType', [TSStatusType, None], None, ),  # 1
    (2, TType.LIST, 'infoMessages', (TType.STRING, 'UTF8', False), None, ),  # 2
    (3, TType.STRING, 'sqlState', 'UTF8', None, ),  # 3
)
all_structs.append(TSHandleIdentifier)
TSHandleIdentifier.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'guid', 'BINARY', None, ),  # 1
    (2, TType.STRING, 'secret', 'BINARY', None, ),  # 2
    (3, TType.I64, 'queryId', None, None, ),  # 3
)
all_structs.append(TSOperationHandle)
TSOperationHandle.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'operationId', [TSHandleIdentifier, None], None, ),  # 1
    (2, TType.BOOL, 'hasResultSet', None, None, ),  # 2
)
all_structs.append(TSExecuteStatementResp)
TSExecuteStatementResp.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'status', [TSStatus, None], None, ),  # 1
    (2, TType.STRUCT, 'operationHandle', [TSOperationHandle, None], None, ),  # 2
    (3, TType.LIST, 'columns', (TType.STRING, 'UTF8', False), None, ),  # 3
    (4, TType.STRING, 'operationType', 'UTF8', None, ),  # 4
    (5, TType.BOOL, 'ignoreTimeStamp', None, None, ),  # 5
    (6, TType.LIST, 'dataTypeList', (TType.STRING, 'UTF8', False), None, ),  # 6
)
all_structs.append(TS_SessionHandle)
TS_SessionHandle.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'sessionId', [TSHandleIdentifier, None], None, ),  # 1
)
all_structs.append(TSOpenSessionResp)
TSOpenSessionResp.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'status', [TSStatus, None], None, ),  # 1
    (2, TType.I32, 'serverProtocolVersion', None, 0, ),  # 2
    (3, TType.STRUCT, 'sessionHandle', [TS_SessionHandle, None], None, ),  # 3
    (4, TType.MAP, 'configuration', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 4
)
all_structs.append(TSOpenSessionReq)
TSOpenSessionReq.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'client_protocol', None, 0, ),  # 1
    (2, TType.STRING, 'username', 'UTF8', None, ),  # 2
    (3, TType.STRING, 'password', 'UTF8', None, ),  # 3
    (4, TType.MAP, 'configuration', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 4
)
all_structs.append(TSCloseSessionReq)
TSCloseSessionReq.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'sessionHandle', [TS_SessionHandle, None], None, ),  # 1
)
all_structs.append(TSExecuteStatementReq)
TSExecuteStatementReq.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'sessionHandle', [TS_SessionHandle, None], None, ),  # 1
    (2, TType.STRING, 'statement', 'UTF8', None, ),  # 2
    (3, TType.I64, 'statementId', None, None, ),  # 3
)
all_structs.append(TSExecuteBatchStatementResp)
TSExecuteBatchStatementResp.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'status', [TSStatus, None], None, ),  # 1
    (2, TType.LIST, 'result', (TType.I32, None, False), None, ),  # 2
)
all_structs.append(TSExecuteBatchStatementReq)
TSExecuteBatchStatementReq.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'sessionHandle', [TS_SessionHandle, None], None, ),  # 1
    (2, TType.LIST, 'statements', (TType.STRING, 'UTF8', False), None, ),  # 2
)
all_structs.append(TSGetOperationStatusReq)
TSGetOperationStatusReq.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'operationHandle', [TSOperationHandle, None], None, ),  # 1
)
all_structs.append(TSCancelOperationReq)
TSCancelOperationReq.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'operationHandle', [TSOperationHandle, None], None, ),  # 1
)
all_structs.append(TSCloseOperationReq)
TSCloseOperationReq.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'operationHandle', [TSOperationHandle, None], None, ),  # 1
    (2, TType.I64, 'queryId', None, None, ),  # 2
    (3, TType.I64, 'stmtId', None, None, ),  # 3
)
all_structs.append(TSQueryDataSet)
TSQueryDataSet.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'values', 'BINARY', None, ),  # 1
    (2, TType.I32, 'rowCount', None, None, ),  # 2
)
all_structs.append(TSFetchResultsReq)
TSFetchResultsReq.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'statement', 'UTF8', None, ),  # 1
    (2, TType.I32, 'fetch_size', None, None, ),  # 2
    (3, TType.I64, 'queryId', None, None, ),  # 3
)
all_structs.append(TSFetchResultsResp)
TSFetchResultsResp.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'status', [TSStatus, None], None, ),  # 1
    (2, TType.BOOL, 'hasResultSet', None, None, ),  # 2
    (3, TType.STRUCT, 'queryDataSet', [TSQueryDataSet, None], None, ),  # 3
)
all_structs.append(TSFetchMetadataResp)
TSFetchMetadataResp.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'status', [TSStatus, None], None, ),  # 1
    (2, TType.STRING, 'metadataInJson', 'UTF8', None, ),  # 2
    (3, TType.LIST, 'columnsList', (TType.STRING, 'UTF8', False), None, ),  # 3
    (4, TType.I32, 'timeseriesNum', None, None, ),  # 4
    (5, TType.STRING, 'dataType', 'UTF8', None, ),  # 5
    (6, TType.LIST, 'timeseriesList', (TType.LIST, (TType.STRING, 'UTF8', False), False), None, ),  # 6
    (7, TType.SET, 'storageGroups', (TType.STRING, 'UTF8', False), None, ),  # 7
    (8, TType.SET, 'devices', (TType.STRING, 'UTF8', False), None, ),  # 8
    (9, TType.LIST, 'nodesList', (TType.STRING, 'UTF8', False), None, ),  # 9
    (10, TType.MAP, 'nodeTimeseriesNum', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 10
    (11, TType.SET, 'childPaths', (TType.STRING, 'UTF8', False), None, ),  # 11
    (12, TType.STRING, 'version', 'UTF8', None, ),  # 12
)
all_structs.append(TSFetchMetadataReq)
TSFetchMetadataReq.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'type', 'UTF8', None, ),  # 1
    (2, TType.STRING, 'columnPath', 'UTF8', None, ),  # 2
    (3, TType.I32, 'nodeLevel', None, None, ),  # 3
)
all_structs.append(TSColumnSchema)
TSColumnSchema.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'name', 'UTF8', None, ),  # 1
    (2, TType.STRING, 'dataType', 'UTF8', None, ),  # 2
    (3, TType.STRING, 'encoding', 'UTF8', None, ),  # 3
    (4, TType.MAP, 'otherArgs', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 4
)
all_structs.append(TSGetTimeZoneResp)
TSGetTimeZoneResp.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'status', [TSStatus, None], None, ),  # 1
    (2, TType.STRING, 'timeZone', 'UTF8', None, ),  # 2
)
all_structs.append(TSSetTimeZoneReq)
TSSetTimeZoneReq.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'timeZone', 'UTF8', None, ),  # 1
)
all_structs.append(TSInsertionReq)
TSInsertionReq.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'deviceId', 'UTF8', None, ),  # 1
    (2, TType.LIST, 'measurements', (TType.STRING, 'UTF8', False), None, ),  # 2
    (3, TType.LIST, 'values', (TType.STRING, 'UTF8', False), None, ),  # 3
    (4, TType.I64, 'timestamp', None, None, ),  # 4
    (5, TType.I64, 'stmtId', None, None, ),  # 5
)
all_structs.append(TSBatchInsertionReq)
TSBatchInsertionReq.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'deviceId', 'UTF8', None, ),  # 1
    (2, TType.LIST, 'measurements', (TType.STRING, 'UTF8', False), None, ),  # 2
    (3, TType.STRING, 'values', 'BINARY', None, ),  # 3
    (4, TType.STRING, 'timestamps', 'BINARY', None, ),  # 4
    (5, TType.LIST, 'types', (TType.I32, None, False), None, ),  # 5
    (6, TType.I32, 'size', None, None, ),  # 6
)
all_structs.append(TSExecuteInsertRowInBatchResp)
TSExecuteInsertRowInBatchResp.thrift_spec = (
    None,  # 0
    (1, TType.LIST, 'statusList', (TType.STRUCT, [TSStatus, None], False), None, ),  # 1
)
all_structs.append(TSInsertInBatchReq)
TSInsertInBatchReq.thrift_spec = (
    None,  # 0
    (1, TType.LIST, 'deviceIds', (TType.STRING, 'UTF8', False), None, ),  # 1
    (2, TType.LIST, 'measurementsList', (TType.LIST, (TType.STRING, 'UTF8', False), False), None, ),  # 2
    (3, TType.LIST, 'valuesList', (TType.LIST, (TType.STRING, 'UTF8', False), False), None, ),  # 3
    (4, TType.LIST, 'timestamps', (TType.I64, None, False), None, ),  # 4
)
all_structs.append(TSInsertReq)
TSInsertReq.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'deviceId', 'UTF8', None, ),  # 1
    (2, TType.LIST, 'measurements', (TType.STRING, 'UTF8', False), None, ),  # 2
    (3, TType.LIST, 'values', (TType.STRING, 'UTF8', False), None, ),  # 3
    (4, TType.I64, 'timestamp', None, None, ),  # 4
)
all_structs.append(TSDeleteDataReq)
TSDeleteDataReq.thrift_spec = (
    None,  # 0
    (1, TType.LIST, 'paths', (TType.STRING, 'UTF8', False), None, ),  # 1
    (2, TType.I64, 'timestamp', None, None, ),  # 2
)
all_structs.append(TSCreateTimeseriesReq)
TSCreateTimeseriesReq.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'path', 'UTF8', None, ),  # 1
    (2, TType.I32, 'dataType', None, None, ),  # 2
    (3, TType.I32, 'encoding', None, None, ),  # 3
    (4, TType.I32, 'compressor', None, None, ),  # 4
)
all_structs.append(ServerProperties)
ServerProperties.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'version', 'UTF8', None, ),  # 1
    (2, TType.LIST, 'supportedTimeAggregationOperations', (TType.STRING, 'UTF8', False), None, ),  # 2
    (3, TType.STRING, 'timestampPrecision', 'UTF8', None, ),  # 3
)
fix_spec(all_structs)
del all_structs
