/** * Override to provide custom ConcreteCall implementation to expose Tap level resources to the underlying Scheme. * * @return a new ConcreteCall instance */ protected <Context, IO> ConcreteCall<Context, IO> createSinkCall() { return new ConcreteCall<>(); }
protected Output getOutput() { return sinkCall.getOutput(); }
sourceCall.setTap( tap ); sourceCall.setIncomingEntry( getTupleEntry() ); sourceCall.setInput( wrapInput( inputIterator.next() ) );
protected void setOutput( Output output ) { sinkCall.setOutput( wrapOutput( output ) ); }
public TupleEntrySchemeCollector( FlowProcess<? extends Config> flowProcess, Tap tap, Scheme scheme, Output output, Supplier<String> loggableIdentifier ) { super( Fields.asDeclaration( scheme.getSinkFields() ) ); this.flowProcess = flowProcess; this.scheme = scheme; if( loggableIdentifier != null ) this.loggableIdentifier = loggableIdentifier; // only used for logging this.sinkCall = createSinkCall(); this.sinkCall.setTap( tap ); this.sinkCall.setOutgoingEntry( this.tupleEntry ); // created in super ctor if( output != null ) setOutput( output ); }
private TupleEntry getNext() throws IOException { Tuples.asModifiable( sourceCall.getIncomingEntry().getTuple() ); hasWaiting = scheme.source( flowProcess, sourceCall ); while( !hasWaiting && inputIterator.hasNext() ) { sourceCall.setInput( wrapInput( inputIterator.next() ) ); try { scheme.sourceRePrepare( flowProcess, sourceCall ); } catch( IOException exception ) { throw new TupleException( "unable to prepare source for input identifier: " + loggableIdentifier.get(), exception ); } Tuples.asModifiable( sourceCall.getIncomingEntry().getTuple() ); hasWaiting = scheme.source( flowProcess, sourceCall ); } return getTupleEntry(); }
@Override public void setFields( Fields declared ) { super.setFields( declared ); if( this.sinkCall != null ) this.sinkCall.setOutgoingEntry( this.tupleEntry ); }
private void initialize() throws IOException { tap.sinkConfInit(hadoopFlowProcess, conf); OutputFormat outputFormat = conf.getOutputFormat(); LOG.info("Output format class is: " + outputFormat.getClass().toString()); writer = outputFormat.getRecordWriter(null, conf, tap.getIdentifier(), Reporter.NULL); sinkCall.setOutput(this); }
@Override protected void collect( TupleEntry tupleEntry ) throws IOException { sinkCall.setOutgoingEntry( tupleEntry ); try { scheme.sink( flowProcess, sinkCall ); } catch( Exception exception ) { throw new TupleException( "unable to sink into output identifier: " + loggableIdentifier.get(), exception ); } }
/** * Override to provide custom ConcreteCall implementation to expose Tap level resources to the underlying Scheme. * * @return a new ConcreteCall instance */ protected <Context, IO> ConcreteCall<Context, IO> createSourceCall() { return new ConcreteCall<>(); }