# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flatbuf

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

# Join between two tables
class Join(object):
    __slots__ = ['_tab']

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

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

    # An identifiier for the relation. The identifier should be unique over the
    # entire plan. Optional.
    # Join
    def Id(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from vast_flatbuf.org.apache.arrow.computeir.flatbuf.RelId import RelId
            obj = RelId()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Left relation
    # Join
    def Left(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from vast_flatbuf.org.apache.arrow.computeir.flatbuf.Relation import Relation
            obj = Relation()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Right relation
    # Join
    def Right(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from vast_flatbuf.org.apache.arrow.computeir.flatbuf.Relation import Relation
            obj = Relation()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # The expression which will be evaluated against rows from each
    # input to determine whether they should be included in the
    # join relation's output.
    # Join
    def OnExpression(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from vast_flatbuf.org.apache.arrow.computeir.flatbuf.Expression import Expression
            obj = Expression()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # The kind of join to use.
    # Join
    def JoinKind(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

def Start(builder): builder.StartObject(5)
def JoinStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddId(builder, id): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
def JoinAddId(builder, id):
    """This method is deprecated. Please switch to AddId."""
    return AddId(builder, id)
def AddLeft(builder, left): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(left), 0)
def JoinAddLeft(builder, left):
    """This method is deprecated. Please switch to AddLeft."""
    return AddLeft(builder, left)
def AddRight(builder, right): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(right), 0)
def JoinAddRight(builder, right):
    """This method is deprecated. Please switch to AddRight."""
    return AddRight(builder, right)
def AddOnExpression(builder, onExpression): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(onExpression), 0)
def JoinAddOnExpression(builder, onExpression):
    """This method is deprecated. Please switch to AddOnExpression."""
    return AddOnExpression(builder, onExpression)
def AddJoinKind(builder, joinKind): builder.PrependUint8Slot(4, joinKind, 0)
def JoinAddJoinKind(builder, joinKind):
    """This method is deprecated. Please switch to AddJoinKind."""
    return AddJoinKind(builder, joinKind)
def End(builder): return builder.EndObject()
def JoinEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)