def find_source_table(expr):
    # A more complex version of _find_base_table.
    # TODO: Revisit/refactor this all at some point
    node = expr.op()

    # First table expression observed for each argument that the expr
    # depends on
    first_tables = []

    def push_first(arg):
        if not isinstance(arg, ir.Expr):
            return
        if isinstance(arg, ir.TableExpr):
            first_tables.append(arg)
        else:
            collect(arg.op())

    def collect(node):
        for arg in node.flat_args():
            push_first(arg)

    collect(node)
    options = util.unique_by_key(first_tables, id)

    if 1 > len(options):
        raise NotImplementedError

    return options[0]
dataset/ETHPy150Open cloudera/ibis/ibis/expr/analysis.py/find_source_table/swapped operands of `>`