@Override public void add( TupleEntry tupleEntry ) { if( !prepared ) prepare(); super.add( tupleEntry ); }
@Override public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { functionCall.getOutputCollector().add( Tuple.NULL ); } }
@Override public void complete( FlowProcess flowProcess, AggregatorCall<Context> aggregatorCall ) { aggregatorCall.getOutputCollector().add( getResult( aggregatorCall ) ); }
public void operate(FlowProcess process, FunctionCall call) { long val = call.getArguments().getLong(0); ByteBuffer buffer = ByteBuffer.allocate(8); buffer.putLong(val); call.getOutputCollector().add( new Tuple(buffer.array())); } }
public void operate(FlowProcess process, FunctionCall call) { String urlStr = call.getArguments().getString(0); try { URL url = new URL(urlStr); call.getOutputCollector().add( new Tuple(url.getAuthority())); } catch(MalformedURLException e) { } } }
@Override public void complete( FlowProcess flowProcess, AggregatorCall<Context> aggregatorCall ) { aggregatorCall.getOutputCollector().add( aggregatorCall.getContext().result() ); } }
public void operate(FlowProcess process, FunctionCall call) { Object node1 = call.getArguments().getObject(0); Object node2 = call.getArguments().getObject(1); if(!node1.equals(node2)) { call.getOutputCollector().add( new Tuple(node1, node2)); call.getOutputCollector().add( new Tuple(node2, node1)); } } }
public void operate(FlowProcess process, FunctionCall call) { int timestamp = call.getArguments().getInteger(0); int hourBucket = timestamp / HOUR_SECS; call.getOutputCollector().add(new Tuple(hourBucket)); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall<Context> functionCall ) { functionCall.getOutputCollector().add( (Tuple) evaluate( functionCall.getContext(), functionCall.getArguments() ) ); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall<Pair<SimpleDateFormat, TupleEntry>> functionCall ) { long ts = functionCall.getArguments().getLong( 0 ); Calendar calendar = getCalendar(); calendar.setTimeInMillis( ts ); String formatted = functionCall.getContext().getLhs().format( calendar.getTime() ); functionCall.getContext().getRhs().setString( 0, formatted ); functionCall.getOutputCollector().add( functionCall.getContext().getRhs() ); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall<Tuple> functionCall ) { functionCall.getContext().set( 0, functionCall.getArguments().getTuple().toString( delimiter, false ) ); functionCall.getOutputCollector().add( functionCall.getContext() ); }
@Override public void operate( FlowProcess flowProcess, FunctionCall<ExpressionOperation.Context> functionCall ) { functionCall.getContext().result.set( 0, evaluate( functionCall.getContext(), functionCall.getArguments() ) ); functionCall.getOutputCollector().add( functionCall.getContext().result ); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall<Context> functionCall ) { functionCall.getContext().result.set( 0, evaluate( functionCall.getContext(), functionCall.getArguments() ) ); functionCall.getOutputCollector().add( functionCall.getContext().result ); } }
public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { functionCall.getOutputCollector().add( new Tuple( new BooleanWritable( asBoolean ) ) ); } }
public void complete( FlowProcess flowProcess, AggregatorCall aggregatorCall ) { Tuple tuple = super.getResult( aggregatorCall ); aggregatorCall.getOutputCollector().add( new Tuple( 1 / ( 1 + tuple.getDouble( 0 ) ) ) ); } };
public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { Set<Tuple> set = new TreeSet<Tuple>(); TupleEntry input = functionCall.getArguments(); for( Fields field : fields ) set.add( input.selectTuple( field ) ); int i = 0; Tuple inputCopy = new Tuple( input.getTuple() ); for( Tuple tuple : set ) inputCopy.put( input.getFields(), fields[ i++ ], tuple ); functionCall.getOutputCollector().add( inputCopy ); }
public void complete( FlowProcess flowProcess, AggregatorCall aggregatorCall ) { Tuple tuple = super.getResult( aggregatorCall ); aggregatorCall.getOutputCollector().add( new Tuple( 1 / ( 1 + tuple.getDouble( 0 ) ) ) ); } };
public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { if( !functionCall.getArguments().isUnmodifiable() ) throw new IllegalStateException( "is modifiable" ); if( !functionCall.getArguments().getTuple().isUnmodifiable() ) throw new IllegalStateException( "is modifiable" ); Tuple result = new Tuple( functionCall.getArguments().getTuple() ); functionCall.getOutputCollector().add( result ); if( result.isUnmodifiable() ) throw new IllegalStateException( "is unmodifiable" ); } }
public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { TupleEntry input = functionCall.getArguments(); functionCall.getOutputCollector().add( new Tuple( Math.pow( input.getTuple().getDouble( 0 ) - input.getTuple().getDouble( 1 ), 2 ) ) ); } };
private void writeFileTo( String path ) throws IOException { Hfs tap = new Hfs( new TextLine( new Fields( "offset", "line" ) ), getOutputPath( path ) ); TupleEntryCollector collector = tap.openForWrite( getPlatform().getFlowProcess() ); collector.add( new Tuple( 1, "1" ) ); collector.close(); }