# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flatbuf

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

# A cast expression
class Cast(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = Cast()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsCast(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # Cast
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # The expression to cast
    # Cast
    def Operand(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from vastdb.vast_flatbuf.org.apache.arrow.computeir.flatbuf.Expression import Expression
            obj = Expression()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # The type to cast to. This value is a `Field` to allow complete representation
    # of arrow types.
    #
    # `Type` is unable to completely represent complex types like lists and
    # maps.
    # Cast
    def To(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from vastdb.vast_flatbuf.org.apache.arrow.flatbuf.Field import Field
            obj = Field()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def Start(builder): builder.StartObject(2)
def CastStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddOperand(builder, operand): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(operand), 0)
def CastAddOperand(builder, operand):
    """This method is deprecated. Please switch to AddOperand."""
    return AddOperand(builder, operand)
def AddTo(builder, to): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(to), 0)
def CastAddTo(builder, to):
    """This method is deprecated. Please switch to AddTo."""
    return AddTo(builder, to)
def End(builder): return builder.EndObject()
def CastEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)