code: @Override
    public Val apply(Env env, Env.StackHelp stk, AstRoot asts[]) {
      // Argument parsing and sanity checking
      // Whole frame being imputed
      Frame fr = stk.track(asts[1].exec(env)).getFrame();
  
      // Column within frame being imputed
      final String method = asts[2].exec(env).getStr();
      if (!(Arrays.asList("forward","backward")).contains(method.toLowerCase()))
        throw new IllegalArgumentException("Method must be forward or backward");
  
      final int axis = (int) asts[3].exec(env).getNum();
      if (!(Arrays.asList(0,1)).contains(axis))
        throw new IllegalArgumentException("Axis must be 0 for columnar 1 for row");
      final int limit = (int) asts[4].exec(env).getNum();
  
      assert limit >= 0:"The maxlen/limit parameter should be >= 0.";
      if (limit == 0) // fast short cut to do nothing if user set zero limit
        return new ValFrame(fr.deepCopy(Key.make().toString()));
  
      Frame res;
  
      if (axis == 0) {
        res = (METHOD_BACKWARD.equalsIgnoreCase(method.trim()))?
                new FillBackwardTaskCol(limit, fr.anyVec().nChunks()).doAll(fr.numCols(), Vec.T_NUM, fr).outputFrame():
                new FillForwardTaskCol(limit).doAll(fr.numCols(), Vec.T_NUM, fr).outputFrame();
      } else {
        res = (METHOD_BACKWARD.equalsIgnoreCase(method.trim()))?
                new FillBackwardTaskRow(limit).doAll(fr.numCols(), Vec.T_NUM, fr).outputFrame():
                new FillForwardTaskRow(limit).doAll(fr.numCols(), Vec.T_NUM, fr).outputFrame();
      }
      res._key = Key.<Frame>make();
      return new ValFrame(res);
    }
docs: (h2o.impute data col method combine_method groupby groupByFrame values)