예제 #1
0
  @Override
  public void receive(Duct previous, final Grouping<TupleEntry, TupleEntryIterator> grouping) {
    try {
      // we want to null out any 'values' before and after the iterator begins/ends
      // this allows buffers to emit tuples before next() and when hasNext() return false;
      final TupleEntry tupleEntry = grouping.joinIterator.getTupleEntry();
      incomingEntry = tupleEntry;

      // if Fields.NONE are declared on the CoGroup, we don't provide arguments, only the
      // joinerClosure
      if (!tupleEntry.getFields().isNone()) {
        final Tuple valueNulledTuple = Tuples.setOnEmpty(tupleEntry, grouping.key);
        tupleEntry.setTuple(valueNulledTuple);

        operationCall.setArgumentsIterator(
            createArgumentsIterator(grouping, tupleEntry, valueNulledTuple));
      }

      operationCall.setOutputCollector(outputCollector);
      operationCall.setJoinerClosure(grouping.joinerClosure);
      operationCall.setGroup(grouping.key);

      buffer.operate(flowProcess, operationCall);
    } catch (CascadingException exception) {
      handleException(exception, argumentsEntry);
    } catch (Throwable throwable) {
      handleException(
          new OperatorException(
              every,
              "operator Every failed executing operation: " + every.getOperation(),
              throwable),
          argumentsEntry);
    }
  }
예제 #2
0
  public void setTuple(Tuple tuple) {
    if (getFields().size() != tuple.size()) {
      throw new IllegalArgumentException("Size of tuple doesn't match current fields");
    }

    _tupleEntry.setTuple(tuple);
    reset();
  }