Refine search
public void operate(FlowProcess process, FunctionCall call) { int hourBucket = call.getArguments().getInteger(0); int dayBucket = hourBucket / 24; int weekBucket = dayBucket / 7; int monthBucket = dayBucket / 28; call.getOutputCollector().add(new Tuple("h", hourBucket)); call.getOutputCollector().add(new Tuple("d", dayBucket)); call.getOutputCollector().add(new Tuple("w", weekBucket)); call.getOutputCollector().add(new Tuple("m", monthBucket)); } }
/** * Constructor TupleCollector creates a new TupleCollector instance. * * @param declared of type Fields */ public TupleEntryCollector( Fields declared ) { setFields( declared ); }
@Override public void operate(FlowProcess flowProcess, FunctionCall functionCall) { functionCall.getOutputCollector().add(functionCall.getArguments().getTuple()); } }
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)); } } }
@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 cleanup(FlowProcess flowProcess, OperationCall operationCall) { JobConf conf = (JobConf) flowProcess.getConfigCopy(); try { LOG.info("HLL counter found " + approxCounter.cardinality() + " distinct keys"); Hfs tap = new Hfs(new SequenceFile(new Fields("bytes")), BloomProps.getApproxCountsDir(conf)); TupleEntryCollector out = tap.openForWrite(new HadoopFlowProcess(conf)); out.add(new Tuple(new BytesWritable(approxCounter.getBytes()))); out.close(); } catch (IOException e) { throw new RuntimeException("couldn't write approximate counts to side bucket", e); } }
private void useSize( TupleEntry input, TupleEntryCollector outputCollector ) { LOG.debug( "using size: {}", size ); Tuple tuple = new Tuple( input.getTuple() ); // make clone Tuple group = tuple.remove( input.getFields(), groupFieldSelector ); for( int i = 0; i < tuple.size(); i = i + size ) { Tuple result = new Tuple( group ); result.addAll( tuple.get( Fields.offsetSelector( size, i ).getPos() ) ); outputCollector.add( result ); } }
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 ) { 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 ); }
@Override public void operate( FlowProcess flowProcess, FunctionCall<Pair<Pattern, TupleEntry>> functionCall ) { String value = functionCall.getArguments().getString( 0 ); if( value == null ) value = ""; TupleEntry output = functionCall.getContext().getRhs(); String[] split = functionCall.getContext().getLhs().split( value, length ); if( length == -1 ) { output.getTuple().clear(); for( String element : split ) output.getTuple().add( element ); } else { output.setCanonicalValues( split ); } functionCall.getOutputCollector().add( output ); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { functionCall.getOutputCollector().add( new Tuple( "value" ) ); }
@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<Pair<Pattern, TupleEntry>> functionCall ) { String value = functionCall.getArguments().getString( 0 ); if( value == null ) value = ""; String[] split = functionCall.getContext().getLhs().split( value ); for( String string : split ) { TupleEntry tupleEntry = functionCall.getContext().getRhs(); tupleEntry.setString( 0, string ); functionCall.getOutputCollector().add( tupleEntry ); } } }
protected void emitTuple(CombinerAggregatorContext context, AggregatorCall aggregatorCall) { TupleEntry output = new TupleEntry(outputFields); output.setTuple(Tuple.size(outputFields.size())); Tuple result = context.getAggregateTuple(); MultiCombiner.populateOutputTupleEntry(context.getDefinition(), output, result); aggregatorCall.getOutputCollector().add(output); } }
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())); } }
@Override public void operate( FlowProcess flowProcess, FunctionCall<Tuple> functionCall ) { functionCall.getContext().set( 0, functionCall.getArguments().getTuple().format( format ) ); functionCall.getOutputCollector().add( functionCall.getContext() ); }
public void complete( FlowProcess flowProcess, AggregatorCall aggregatorCall ) { if( !aggregatorCall.getGroup().isUnmodifiable() ) throw new IllegalStateException( "is modifiable" ); if( !aggregatorCall.getGroup().getTuple().isUnmodifiable() ) throw new IllegalStateException( "is modifiable" ); Tuple result = new Tuple( "some value" ); aggregatorCall.getOutputCollector().add( result ); if( result.isUnmodifiable() ) throw new IllegalStateException( "is unmodifiable" ); } }
public void operate(FlowProcess process, FunctionCall call) { System.out.println("DEBUG: " + call.getArguments().toString()); call.getOutputCollector().add(new Tuple(1)); } }
public void operate( FlowProcess flowProcess, FunctionCall<Long> functionCall ) { String string = asBytes; if( functionCall.getContext() != -1 ) { string = functionCall.getContext() + string; functionCall.setContext( functionCall.getContext() + 1 ); } functionCall.getOutputCollector().add( new Tuple( (Object) string.getBytes() ) ); } }