presto-main/src/main/java/io/prestosql/operator/window/LagFunction.java/LagFunction/processRow
class LagFunction:    @Override
    public void processRow(BlockBuilder output, int frameStart, int frameEnd, int currentPosition)
    {
        if ((offsetChannel >= 0) && windowIndex.isNull(offsetChannel, currentPosition)) {
            output.appendNull();
        }
        else {
            long offset = (offsetChannel < 0) ? 1 : windowIndex.getLong(offsetChannel, currentPosition);
            checkCondition(offset >= 0, INVALID_FUNCTION_ARGUMENT, "Offset must be at least 0");

            long valuePosition;

            if (ignoreNulls && (offset > 0)) {
                long count = 0;
                valuePosition = currentPosition - 1;
                while (withinPartition(valuePosition, currentPosition)) {
                    if (!windowIndex.isNull(valueChannel, toIntExact(valuePosition))) {
                        count++;
                        if (count == offset) {
                            break;
                        }
                    }
                    valuePosition--;
                }
            }
            else {
                valuePosition = currentPosition - offset;
            }

            if (withinPartition(valuePosition, currentPosition)) {
                windowIndex.appendTo(valueChannel, toIntExact(valuePosition), output);
            }
            else if (defaultChannel >= 0) {
                windowIndex.appendTo(defaultChannel, currentPosition, output);
            }
            else {
                output.appendNull();
            }
        }
    }