Package sizzle.io

Examples of sizzle.io.EmitValue


  }

  @Test
  public void testFloatQuantileAggregator() {
    final List<EmitValue> values = new ArrayList<EmitValue>();
    values.add(new EmitValue(3));
    values.add(new EmitValue(6));
    values.add(new EmitValue(7));
    values.add(new EmitValue(8));
    values.add(new EmitValue(8));
    values.add(new EmitValue(10));
    values.add(new EmitValue(13));
    values.add(new EmitValue(15));
    values.add(new EmitValue(16));
    values.add(new EmitValue(20));

    final ReduceDriver<EmitKey, EmitValue, Text, NullWritable> reduceDriver = new ReduceDriver<EmitKey, EmitValue, Text, NullWritable>(
        new FloatQuartileSizzleReducer());
    reduceDriver.setInput(new EmitKey("test"), values);
    reduceDriver.addOutput(new Text("test[] = [7.0, 8.0, 15.0, 20.0]"), NullWritable.get());
View Full Code Here


    final BufferedReader r = new BufferedReader(new FileReader("test/normals"));
    try {
      String line = null;
      while ((line = r.readLine()) != null)
        values.add(new EmitValue(Long.parseLong(line)));
    } finally {
      r.close();
    }

    final ReduceDriver<EmitKey, EmitValue, Text, NullWritable> reduceDriver = new ReduceDriver<EmitKey, EmitValue, Text, NullWritable>(
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  protected void collect(final String data, final String metadata) throws IOException, InterruptedException {
    if (this.combining)
      this.getContext().write(this.getKey(), new EmitValue(data, metadata));
    else if (metadata != null)
      this.getContext().write(new Text(this.getKey() + " = " + data + " weight " + metadata), NullWritable.get());
    else
      this.getContext().write(new Text(this.getKey() + " = " + data), NullWritable.get());
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  protected void collect(final long data, final String metadata) throws IOException, InterruptedException {
    if (this.combining)
      this.getContext().write(this.getKey(), new EmitValue(data, metadata));
    else if (metadata != null)
      this.getContext().write(new Text(this.getKey() + " = " + data + " weight " + metadata), NullWritable.get());
    else
      this.getContext().write(new Text(this.getKey() + " = " + data), NullWritable.get());
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  protected void collect(final double data, final String metadata) throws IOException, InterruptedException {
    if (this.combining)
      this.getContext().write(this.getKey(), new EmitValue(data, metadata));
    else if (metadata != null)
      this.getContext().write(new Text(this.getKey() + " = " + data + " weight " + metadata), NullWritable.get());
    else
      this.getContext().write(new Text(this.getKey() + " = " + data), NullWritable.get());
  }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  @SuppressWarnings("unchecked")
  protected void collect(final String data, final String metadata) throws IOException, InterruptedException {
    if (this.isCombining())
      this.getContext().write(this.getKey(), new EmitValue(data, metadata));
    else if (metadata != null)
      this.getContext().write(new Text(data + " weight " + metadata), NullWritable.get());
    else
      this.getContext().write(new Text(data), NullWritable.get());
  }
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public EmitValue getResult() {
    return new EmitValue(this.sum);
  }
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public EmitValue getResult() {
    return new EmitValue(this.sum);
  }
View Full Code Here

TOP

Related Classes of sizzle.io.EmitValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.