public void accumulate()

in src/main/java/org/apache/datasketches/pig/sampling/DataToVarOptSketch.java [91:106]


  public void accumulate(final Tuple inputTuple) throws IOException {
    if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
      return;
    }

    final DataBag samples = (DataBag) inputTuple.get(0);

    if (this.sketch_ == null) {
      this.sketch_ = VarOptItemsSketch.newInstance(this.targetK_);
    }

    for (final Tuple t : samples) {
      final double weight = (double) t.get(this.weightIdx_);
      this.sketch_.update(t, weight);
    }
  }