@Override public void initialize() { super.initialize(); groupAssertion = every.getGroupAssertion(); reducing = (Reducing) getNext(); }
@Override public void completeGroup( Duct previous, TupleEntry incomingEntry ) { this.incomingEntry = incomingEntry; operationCall.setArguments( null ); try { groupAssertion.doAssert( flowProcess, operationCall ); // collector calls next reducing.completeGroup( this, incomingEntry ); } catch( CascadingException exception ) { handleException( exception, incomingEntry ); } catch( Throwable throwable ) { handleException( new OperatorException( every, "operator Every failed completing operation: " + every.getOperation(), throwable ), incomingEntry ); } } }
rhsDuct = new AggregatorEveryStage( flowProcess, everyElement ); else if( everyElement.isGroupAssertion() ) rhsDuct = new GroupAssertionEveryStage( flowProcess, everyElement ); else throw new IllegalStateException( "unknown operation: " + everyElement.getOperation().getClass().getCanonicalName() );
@Override public void startGroup( Duct previous, TupleEntry groupEntry ) { operationCall.setGroup( groupEntry ); operationCall.setArguments( null ); // zero it out operationCall.setOutputCollector( null ); // zero it out try { groupAssertion.start( flowProcess, operationCall ); } catch( CascadingException exception ) { handleException( exception, groupEntry ); } catch( Throwable throwable ) { handleException( new OperatorException( every, "operator Every failed starting operation: " + every.getOperation(), throwable ), groupEntry ); } reducing.startGroup( this, groupEntry ); }
@Override public void receive( Duct previous, int ordinal, TupleEntry tupleEntry ) { try { argumentsEntry.setTuple( argumentsBuilder.makeResult( tupleEntry.getTuple(), null ) ); operationCall.setArguments( argumentsEntry ); groupAssertion.aggregate( flowProcess, operationCall ); } catch( CascadingException exception ) { handleException( exception, argumentsEntry ); } catch( Throwable throwable ) { handleException( new OperatorException( every, "operator Every failed executing operation: " + every.getOperation(), throwable ), argumentsEntry ); } next.receive( this, 0, tupleEntry ); }