#
# Autogenerated by Thrift Compiler (0.20.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 TExtArgumentType(object):
    Int8 = 0
    Int16 = 1
    Int32 = 2
    Int64 = 3
    Float = 4
    Double = 5
    Void = 6
    PInt8 = 7
    PInt16 = 8
    PInt32 = 9
    PInt64 = 10
    PFloat = 11
    PDouble = 12
    PBool = 13
    Bool = 14
    ArrayInt8 = 15
    ArrayInt16 = 16
    ArrayInt32 = 17
    ArrayInt64 = 18
    ArrayFloat = 19
    ArrayDouble = 20
    ArrayBool = 21
    GeoPoint = 22
    GeoLineString = 23
    Cursor = 24
    GeoPolygon = 25
    GeoMultiPolygon = 26
    ColumnInt8 = 27
    ColumnInt16 = 28
    ColumnInt32 = 29
    ColumnInt64 = 30
    ColumnFloat = 31
    ColumnDouble = 32
    ColumnBool = 33
    TextEncodingNone = 34
    TextEncodingDict = 35
    ColumnListInt8 = 36
    ColumnListInt16 = 37
    ColumnListInt32 = 38
    ColumnListInt64 = 39
    ColumnListFloat = 40
    ColumnListDouble = 41
    ColumnListBool = 42
    ColumnTextEncodingDict = 43
    ColumnListTextEncodingDict = 44
    ColumnTimestamp = 45
    Timestamp = 46
    ColumnArrayInt8 = 47
    ColumnArrayInt16 = 48
    ColumnArrayInt32 = 49
    ColumnArrayInt64 = 50
    ColumnArrayFloat = 51
    ColumnArrayDouble = 52
    ColumnArrayBool = 53
    ColumnListArrayInt8 = 54
    ColumnListArrayInt16 = 55
    ColumnListArrayInt32 = 56
    ColumnListArrayInt64 = 57
    ColumnListArrayFloat = 58
    ColumnListArrayDouble = 59
    ColumnListArrayBool = 60
    GeoMultiLineString = 61
    ArrayTextEncodingNone = 62
    ColumnTextEncodingNone = 63
    ColumnListTextEncodingNone = 64
    ColumnArrayTextEncodingNone = 65
    ColumnListArrayTextEncodingNone = 66
    ArrayTextEncodingDict = 67
    ColumnArrayTextEncodingDict = 68
    ColumnListArrayTextEncodingDict = 69
    GeoMultiPoint = 70
    DayTimeInterval = 71
    YearMonthTimeInterval = 72
    ColumnGeoPoint = 73
    ColumnGeoLineString = 74
    ColumnGeoPolygon = 75
    ColumnGeoMultiPoint = 76
    ColumnGeoMultiLineString = 77
    ColumnGeoMultiPolygon = 78
    ColumnListGeoPoint = 79
    ColumnListGeoLineString = 80
    ColumnListGeoPolygon = 81
    ColumnListGeoMultiPoint = 82
    ColumnListGeoMultiLineString = 83
    ColumnListGeoMultiPolygon = 84

    _VALUES_TO_NAMES = {
        0: "Int8",
        1: "Int16",
        2: "Int32",
        3: "Int64",
        4: "Float",
        5: "Double",
        6: "Void",
        7: "PInt8",
        8: "PInt16",
        9: "PInt32",
        10: "PInt64",
        11: "PFloat",
        12: "PDouble",
        13: "PBool",
        14: "Bool",
        15: "ArrayInt8",
        16: "ArrayInt16",
        17: "ArrayInt32",
        18: "ArrayInt64",
        19: "ArrayFloat",
        20: "ArrayDouble",
        21: "ArrayBool",
        22: "GeoPoint",
        23: "GeoLineString",
        24: "Cursor",
        25: "GeoPolygon",
        26: "GeoMultiPolygon",
        27: "ColumnInt8",
        28: "ColumnInt16",
        29: "ColumnInt32",
        30: "ColumnInt64",
        31: "ColumnFloat",
        32: "ColumnDouble",
        33: "ColumnBool",
        34: "TextEncodingNone",
        35: "TextEncodingDict",
        36: "ColumnListInt8",
        37: "ColumnListInt16",
        38: "ColumnListInt32",
        39: "ColumnListInt64",
        40: "ColumnListFloat",
        41: "ColumnListDouble",
        42: "ColumnListBool",
        43: "ColumnTextEncodingDict",
        44: "ColumnListTextEncodingDict",
        45: "ColumnTimestamp",
        46: "Timestamp",
        47: "ColumnArrayInt8",
        48: "ColumnArrayInt16",
        49: "ColumnArrayInt32",
        50: "ColumnArrayInt64",
        51: "ColumnArrayFloat",
        52: "ColumnArrayDouble",
        53: "ColumnArrayBool",
        54: "ColumnListArrayInt8",
        55: "ColumnListArrayInt16",
        56: "ColumnListArrayInt32",
        57: "ColumnListArrayInt64",
        58: "ColumnListArrayFloat",
        59: "ColumnListArrayDouble",
        60: "ColumnListArrayBool",
        61: "GeoMultiLineString",
        62: "ArrayTextEncodingNone",
        63: "ColumnTextEncodingNone",
        64: "ColumnListTextEncodingNone",
        65: "ColumnArrayTextEncodingNone",
        66: "ColumnListArrayTextEncodingNone",
        67: "ArrayTextEncodingDict",
        68: "ColumnArrayTextEncodingDict",
        69: "ColumnListArrayTextEncodingDict",
        70: "GeoMultiPoint",
        71: "DayTimeInterval",
        72: "YearMonthTimeInterval",
        73: "ColumnGeoPoint",
        74: "ColumnGeoLineString",
        75: "ColumnGeoPolygon",
        76: "ColumnGeoMultiPoint",
        77: "ColumnGeoMultiLineString",
        78: "ColumnGeoMultiPolygon",
        79: "ColumnListGeoPoint",
        80: "ColumnListGeoLineString",
        81: "ColumnListGeoPolygon",
        82: "ColumnListGeoMultiPoint",
        83: "ColumnListGeoMultiLineString",
        84: "ColumnListGeoMultiPolygon",
    }

    _NAMES_TO_VALUES = {
        "Int8": 0,
        "Int16": 1,
        "Int32": 2,
        "Int64": 3,
        "Float": 4,
        "Double": 5,
        "Void": 6,
        "PInt8": 7,
        "PInt16": 8,
        "PInt32": 9,
        "PInt64": 10,
        "PFloat": 11,
        "PDouble": 12,
        "PBool": 13,
        "Bool": 14,
        "ArrayInt8": 15,
        "ArrayInt16": 16,
        "ArrayInt32": 17,
        "ArrayInt64": 18,
        "ArrayFloat": 19,
        "ArrayDouble": 20,
        "ArrayBool": 21,
        "GeoPoint": 22,
        "GeoLineString": 23,
        "Cursor": 24,
        "GeoPolygon": 25,
        "GeoMultiPolygon": 26,
        "ColumnInt8": 27,
        "ColumnInt16": 28,
        "ColumnInt32": 29,
        "ColumnInt64": 30,
        "ColumnFloat": 31,
        "ColumnDouble": 32,
        "ColumnBool": 33,
        "TextEncodingNone": 34,
        "TextEncodingDict": 35,
        "ColumnListInt8": 36,
        "ColumnListInt16": 37,
        "ColumnListInt32": 38,
        "ColumnListInt64": 39,
        "ColumnListFloat": 40,
        "ColumnListDouble": 41,
        "ColumnListBool": 42,
        "ColumnTextEncodingDict": 43,
        "ColumnListTextEncodingDict": 44,
        "ColumnTimestamp": 45,
        "Timestamp": 46,
        "ColumnArrayInt8": 47,
        "ColumnArrayInt16": 48,
        "ColumnArrayInt32": 49,
        "ColumnArrayInt64": 50,
        "ColumnArrayFloat": 51,
        "ColumnArrayDouble": 52,
        "ColumnArrayBool": 53,
        "ColumnListArrayInt8": 54,
        "ColumnListArrayInt16": 55,
        "ColumnListArrayInt32": 56,
        "ColumnListArrayInt64": 57,
        "ColumnListArrayFloat": 58,
        "ColumnListArrayDouble": 59,
        "ColumnListArrayBool": 60,
        "GeoMultiLineString": 61,
        "ArrayTextEncodingNone": 62,
        "ColumnTextEncodingNone": 63,
        "ColumnListTextEncodingNone": 64,
        "ColumnArrayTextEncodingNone": 65,
        "ColumnListArrayTextEncodingNone": 66,
        "ArrayTextEncodingDict": 67,
        "ColumnArrayTextEncodingDict": 68,
        "ColumnListArrayTextEncodingDict": 69,
        "GeoMultiPoint": 70,
        "DayTimeInterval": 71,
        "YearMonthTimeInterval": 72,
        "ColumnGeoPoint": 73,
        "ColumnGeoLineString": 74,
        "ColumnGeoPolygon": 75,
        "ColumnGeoMultiPoint": 76,
        "ColumnGeoMultiLineString": 77,
        "ColumnGeoMultiPolygon": 78,
        "ColumnListGeoPoint": 79,
        "ColumnListGeoLineString": 80,
        "ColumnListGeoPolygon": 81,
        "ColumnListGeoMultiPoint": 82,
        "ColumnListGeoMultiLineString": 83,
        "ColumnListGeoMultiPolygon": 84,
    }


class TOutputBufferSizeType(object):
    kConstant = 0
    kUserSpecifiedConstantParameter = 1
    kUserSpecifiedRowMultiplier = 2
    kTableFunctionSpecifiedParameter = 3
    kPreFlightParameter = 4

    _VALUES_TO_NAMES = {
        0: "kConstant",
        1: "kUserSpecifiedConstantParameter",
        2: "kUserSpecifiedRowMultiplier",
        3: "kTableFunctionSpecifiedParameter",
        4: "kPreFlightParameter",
    }

    _NAMES_TO_VALUES = {
        "kConstant": 0,
        "kUserSpecifiedConstantParameter": 1,
        "kUserSpecifiedRowMultiplier": 2,
        "kTableFunctionSpecifiedParameter": 3,
        "kPreFlightParameter": 4,
    }


class TUserDefinedFunction(object):
    """
    Attributes:
     - name
     - argTypes
     - retType
     - annotations

    """


    def __init__(self, name=None, argTypes=None, retType=None, annotations=None,):
        self.name = name
        self.argTypes = argTypes
        self.retType = retType
        self.annotations = annotations

    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', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.argTypes = []
                    (_etype3, _size0) = iprot.readListBegin()
                    for _i4 in range(_size0):
                        _elem5 = iprot.readI32()
                        self.argTypes.append(_elem5)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.retType = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.LIST:
                    self.annotations = []
                    (_etype9, _size6) = iprot.readListBegin()
                    for _i10 in range(_size6):
                        _elem11 = {}
                        (_ktype13, _vtype14, _size12) = iprot.readMapBegin()
                        for _i16 in range(_size12):
                            _key17 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                            _val18 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                            _elem11[_key17] = _val18
                        iprot.readMapEnd()
                        self.annotations.append(_elem11)
                    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('TUserDefinedFunction')
        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.argTypes is not None:
            oprot.writeFieldBegin('argTypes', TType.LIST, 2)
            oprot.writeListBegin(TType.I32, len(self.argTypes))
            for iter19 in self.argTypes:
                oprot.writeI32(iter19)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.retType is not None:
            oprot.writeFieldBegin('retType', TType.I32, 3)
            oprot.writeI32(self.retType)
            oprot.writeFieldEnd()
        if self.annotations is not None:
            oprot.writeFieldBegin('annotations', TType.LIST, 4)
            oprot.writeListBegin(TType.MAP, len(self.annotations))
            for iter20 in self.annotations:
                oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter20))
                for kiter21, viter22 in iter20.items():
                    oprot.writeString(kiter21.encode('utf-8') if sys.version_info[0] == 2 else kiter21)
                    oprot.writeString(viter22.encode('utf-8') if sys.version_info[0] == 2 else viter22)
                oprot.writeMapEnd()
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

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

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

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


class TUserDefinedTableFunction(object):
    """
    Attributes:
     - name
     - sizerType
     - sizerArgPos
     - inputArgTypes
     - outputArgTypes
     - sqlArgTypes
     - annotations

    """


    def __init__(self, name=None, sizerType=None, sizerArgPos=None, inputArgTypes=None, outputArgTypes=None, sqlArgTypes=None, annotations=None,):
        self.name = name
        self.sizerType = sizerType
        self.sizerArgPos = sizerArgPos
        self.inputArgTypes = inputArgTypes
        self.outputArgTypes = outputArgTypes
        self.sqlArgTypes = sqlArgTypes
        self.annotations = annotations

    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', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.sizerType = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.sizerArgPos = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.LIST:
                    self.inputArgTypes = []
                    (_etype26, _size23) = iprot.readListBegin()
                    for _i27 in range(_size23):
                        _elem28 = iprot.readI32()
                        self.inputArgTypes.append(_elem28)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.LIST:
                    self.outputArgTypes = []
                    (_etype32, _size29) = iprot.readListBegin()
                    for _i33 in range(_size29):
                        _elem34 = iprot.readI32()
                        self.outputArgTypes.append(_elem34)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.LIST:
                    self.sqlArgTypes = []
                    (_etype38, _size35) = iprot.readListBegin()
                    for _i39 in range(_size35):
                        _elem40 = iprot.readI32()
                        self.sqlArgTypes.append(_elem40)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.LIST:
                    self.annotations = []
                    (_etype44, _size41) = iprot.readListBegin()
                    for _i45 in range(_size41):
                        _elem46 = {}
                        (_ktype48, _vtype49, _size47) = iprot.readMapBegin()
                        for _i51 in range(_size47):
                            _key52 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                            _val53 = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                            _elem46[_key52] = _val53
                        iprot.readMapEnd()
                        self.annotations.append(_elem46)
                    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('TUserDefinedTableFunction')
        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.sizerType is not None:
            oprot.writeFieldBegin('sizerType', TType.I32, 2)
            oprot.writeI32(self.sizerType)
            oprot.writeFieldEnd()
        if self.sizerArgPos is not None:
            oprot.writeFieldBegin('sizerArgPos', TType.I32, 3)
            oprot.writeI32(self.sizerArgPos)
            oprot.writeFieldEnd()
        if self.inputArgTypes is not None:
            oprot.writeFieldBegin('inputArgTypes', TType.LIST, 4)
            oprot.writeListBegin(TType.I32, len(self.inputArgTypes))
            for iter54 in self.inputArgTypes:
                oprot.writeI32(iter54)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.outputArgTypes is not None:
            oprot.writeFieldBegin('outputArgTypes', TType.LIST, 5)
            oprot.writeListBegin(TType.I32, len(self.outputArgTypes))
            for iter55 in self.outputArgTypes:
                oprot.writeI32(iter55)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.sqlArgTypes is not None:
            oprot.writeFieldBegin('sqlArgTypes', TType.LIST, 6)
            oprot.writeListBegin(TType.I32, len(self.sqlArgTypes))
            for iter56 in self.sqlArgTypes:
                oprot.writeI32(iter56)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.annotations is not None:
            oprot.writeFieldBegin('annotations', TType.LIST, 7)
            oprot.writeListBegin(TType.MAP, len(self.annotations))
            for iter57 in self.annotations:
                oprot.writeMapBegin(TType.STRING, TType.STRING, len(iter57))
                for kiter58, viter59 in iter57.items():
                    oprot.writeString(kiter58.encode('utf-8') if sys.version_info[0] == 2 else kiter58)
                    oprot.writeString(viter59.encode('utf-8') if sys.version_info[0] == 2 else viter59)
                oprot.writeMapEnd()
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

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

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

    def __ne__(self, other):
        return not (self == other)
all_structs.append(TUserDefinedFunction)
TUserDefinedFunction.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'name', 'UTF8', None, ),  # 1
    (2, TType.LIST, 'argTypes', (TType.I32, None, False), None, ),  # 2
    (3, TType.I32, 'retType', None, None, ),  # 3
    (4, TType.LIST, 'annotations', (TType.MAP, (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), False), None, ),  # 4
)
all_structs.append(TUserDefinedTableFunction)
TUserDefinedTableFunction.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'name', 'UTF8', None, ),  # 1
    (2, TType.I32, 'sizerType', None, None, ),  # 2
    (3, TType.I32, 'sizerArgPos', None, None, ),  # 3
    (4, TType.LIST, 'inputArgTypes', (TType.I32, None, False), None, ),  # 4
    (5, TType.LIST, 'outputArgTypes', (TType.I32, None, False), None, ),  # 5
    (6, TType.LIST, 'sqlArgTypes', (TType.I32, None, False), None, ),  # 6
    (7, TType.LIST, 'annotations', (TType.MAP, (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), False), None, ),  # 7
)
fix_spec(all_structs)
del all_structs
