def _nth_value(translator, expr):
    op = expr.op()
    arg, rank = op.args

    arg_formatted = translator.translate(arg)
    rank_formatted = translator.translate(rank - 1)

    return 'first_value(lag({0}, {1}))'.format(arg_formatted,
                                               rank_formatted)
dataset/ETHPy150Open cloudera/ibis/ibis/impala/compiler.py/_nth_value/original