@SuppressWarnings("unchecked") @Override public boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) throws IOException { Object[] context = sourceCall.getContext();
boolean isJSON = (Boolean) sourceCall.getContext()[SRC_CTX_OUTPUT_JSON]; FieldAlias alias = (FieldAlias) sourceCall.getContext()[SRC_CTX_ALIASES];
@Override public void sourcePrepare( FlowProcess<? extends Configuration> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) { if( sourceCall.getContext() == null ) sourceCall.setContext( new Object[ 3 ] ); sourceCall.getContext()[ 0 ] = sourceCall.getInput().createKey(); sourceCall.getContext()[ 1 ] = sourceCall.getInput().createValue(); sourceCall.getContext()[ 2 ] = Charset.forName( charsetName ); }
@Override public void sourcePrepare( FlowProcess<? extends Configuration> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) { if( sourceCall.getContext() == null ) sourceCall.setContext( new Object[ 3 ] ); sourceCall.getContext()[ 0 ] = sourceCall.getInput().createKey(); sourceCall.getContext()[ 1 ] = sourceCall.getInput().createValue(); sourceCall.getContext()[ 2 ] = Charset.forName( charsetName ); }
@Override public boolean source( FlowProcess<? extends Properties> flowProcess, SourceCall<LineNumberReader, InputStream> sourceCall ) throws IOException { String line = sourceCall.getContext().readLine(); if( line == null ) return false; TupleEntry incomingEntry = sourceCall.getIncomingEntry(); JsonNode jsonNode = null; if( !line.isEmpty() ) jsonNode = mapper.readTree( line ); incomingEntry.setObject( 0, jsonNode ); return true; }
private boolean sourceReadInput( SourceCall<Object[], RecordReader> sourceCall ) throws IOException { Object[] context = sourceCall.getContext(); return sourceCall.getInput().next( context[ 0 ], context[ 1 ] ); }
@Override public boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader<TupleWrapper, NullWritable>> sourceCall) throws IOException { TupleWrapper key = (TupleWrapper) sourceCall.getContext()[ 0 ]; NullWritable value = (NullWritable) sourceCall.getContext()[ 1 ]; boolean result = sourceCall.getInput().next( key, value ); if( !result ) return false; sourceCall.getIncomingEntry().setTuple(key.tuple); return true; }
private boolean sourceReadInput( SourceCall<Object[], RecordReader> sourceCall ) throws IOException { Object[] context = sourceCall.getContext(); return sourceCall.getInput().next( context[ 0 ], context[ 1 ] ); }
@Override public void sourcePrepare( FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader<TupleWrapper, NullWritable>> sourceCall ) { sourceCall.setContext( new Object[ 2 ] ); sourceCall.getContext()[ 0 ] = sourceCall.getInput().createKey(); sourceCall.getContext()[ 1 ] = sourceCall.getInput().createValue(); }
@Override public void sourcePrepare(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) { sourceCall.setContext(new Object[2]); sourceCall.getContext()[0] = sourceCall.getInput().createKey(); sourceCall.getContext()[1] = sourceCall.getInput().createValue(); }
/** * This sets up the state between succesive calls to source */ @Override public void sourcePrepare(FlowProcess<? extends Configuration> flowProcess, SourceCall<Object[], RecordReader> sourceCall) { //Hadoop sets a key value pair: sourceCall.setContext(new Object[2]); sourceCall.getContext()[0] = sourceCall.getInput().createKey(); sourceCall.getContext()[1] = sourceCall.getInput().createValue(); } }
@Override public void sourcePrepare(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) { sourceCall.setContext(new Object[2]); sourceCall.getContext()[0] = sourceCall.getInput().createKey(); sourceCall.getContext()[1] = sourceCall.getInput().createValue(); }
@Override public boolean source(FlowProcess<JobConf> prcs, SourceCall<Object[], RecordReader> sourceCall) throws IOException { Object key = sourceCall.getContext()[0]; Object value = sourceCall.getContext()[1]; boolean result = sourceCall.getInput().next(key, value); if (!result) { return false; } sourceCall.getIncomingEntry().setTuple(new Tuple(key, value)); return true; }
/** * This sets up the state between succesive calls to source */ @Override public void sourcePrepare(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) { //Hadoop sets a key value pair: sourceCall.setContext(new Object[2]); sourceCall.getContext()[0] = sourceCall.getInput().createKey(); sourceCall.getContext()[1] = sourceCall.getInput().createValue(); } }
@Override public boolean source(FlowProcess<JobConf> process, SourceCall<Object[], RecordReader> sourceCall) throws IOException { Object k = sourceCall.getContext()[0]; Object v = sourceCall.getContext()[1]; boolean result = sourceCall.getInput().next(k, v); if (!result) { return false; } String relPath = ((Text) k).toString(); Object value = deserialize((BytesWritable) v); sourceCall.getIncomingEntry().setTuple(new Tuple(relPath, value)); return true; }
@Override public boolean source( FlowProcess<? extends Configuration> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) throws IOException { boolean success = sourceCall.getInput().next( sourceCall.getContext()[ 0 ], sourceCall.getContext()[ 1 ] ); if( !success ) return false; if( sourceCall.getContext()[ 1 ].toString().matches( "^\\s*#.*$" ) ) return source( flowProcess, sourceCall ); sourceHandleInput( sourceCall ); return true; } }
@Override public boolean source( FlowProcess<? extends Configuration> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) throws IOException { boolean success = sourceCall.getInput().next( sourceCall.getContext()[ 0 ], sourceCall.getContext()[ 1 ] ); if( !success ) return false; if( sourceCall.getContext()[ 1 ].toString().matches( "^\\s*#.*$" ) ) return source( flowProcess, sourceCall ); sourceHandleInput( sourceCall ); return true; } }
protected void sourceHandleInput( SourceCall<Object[], RecordReader> sourceCall ) throws IOException { TupleEntry result = sourceCall.getIncomingEntry(); int index = 0; Object[] context = sourceCall.getContext(); // coerce into canonical forms if( getSourceFields().size() == 2 ) result.setLong( index++, ( (LongWritable) context[ 0 ] ).get() ); result.setString( index, makeEncodedString( context ) ); }
protected void sourceHandleInput( SourceCall<Object[], RecordReader> sourceCall ) throws IOException { TupleEntry result = sourceCall.getIncomingEntry(); int index = 0; Object[] context = sourceCall.getContext(); // coerce into canonical forms if( getSourceFields().size() == 2 ) result.setLong( index++, ( (LongWritable) context[ 0 ] ).get() ); result.setString( index, makeEncodedString( context ) ); }
@Override public boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) throws IOException { BytesWritable key = (BytesWritable) sourceCall.getContext()[0]; BytesWritable value = (BytesWritable) sourceCall.getContext()[1]; boolean result = sourceCall.getInput().next(key, value); if (!result) { return false; } Tuple tuple = sourceCall.getIncomingEntry().getTuple(); tuple.clear(); tuple.add(getBytes(key)); tuple.add(getBytes(value)); return true; }