コード例 #1
0
  /**
   * Process an incoming tuple that arrived on the specified port.
   *
   * <p>Copy the incoming tuple to a new output tuple and submit to the output port.
   *
   * @param inputStream Port the tuple is arriving on.
   * @param tuple Object representing the incoming tuple.
   * @throws Exception Operator failure, will cause the enclosing PE to terminate.
   */
  @Override
  public final void process(StreamingInput<Tuple> inputStream, Tuple tuple) throws Exception {

    // Create a new tuple for output port 0
    StreamingOutput<OutputTuple> outStream = getOutput(0);
    OutputTuple outTuple = outStream.newTuple();

    // Copy across all matching attributes.
    outTuple.assign(tuple);

    // TODO: Insert code to perform transformation on output tuple as needed:
    // outTuple.setString("AttributeName", "AttributeValue");

    // Submit new tuple to output port 0
    outStream.submit(outTuple);
  }
コード例 #2
0
 /** Removes the __spl_hash attribute at the start of a parallel region. */
 public void process(StreamingInput<Tuple> stream, Tuple tuple) throws Exception {
   OutputTuple out_t = output.newTuple();
   out_t.setObject(0, tuple.getObject(0));
   output.submit(out_t);
 }