public void accumulate()

in src/main/java/org/apache/datasketches/pig/sampling/VarOptSampling.java [93:108]


  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);
    }
  }