本文整理了Java中cascading.tuple.TupleEntry.getTuple()
方法的一些代码示例,展示了TupleEntry.getTuple()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TupleEntry.getTuple()
方法的具体详情如下:
包路径:cascading.tuple.TupleEntry
类名称:TupleEntry
方法名:getTuple
[英]Method getTuple returns the tuple of this TupleEntry object.
[中]方法getTuple返回这个TupleEntry对象的元组。
代码示例来源:origin: elastic/elasticsearch-hadoop
static Tuple coerceToString(SinkCall<?, ?> sinkCall) {
return sinkCall.getOutgoingEntry().getTuple();
}
}
代码示例来源:origin: cwensel/cascading
protected void collect( TupleEntry tupleEntry )
{
if( copyTupleOnCollect )
tuples.add( tupleEntry.getTupleCopy() );
else
tuples.add( tupleEntry.getTuple() );
}
代码示例来源:origin: elastic/elasticsearch-hadoop
List<Object> elements = Tuple.elements(entry.getTuple());
elements.clear();
elements.addAll(data.values());
代码示例来源:origin: elastic/elasticsearch-hadoop
@Override
public void convert(Object from, BytesArray to) {
// expect a tuple holding one field - chararray or bytearray
Assert.isTrue(from instanceof SinkCall,
String.format("Unexpected object type, expecting [%s], given [%s]", SinkCall.class, from.getClass()));
// handle common cases
SinkCall sinkCall = (SinkCall) from;
Tuple rawTuple = sinkCall.getOutgoingEntry().getTuple();
if (rawTuple == null || rawTuple.isEmpty()) {
to.bytes("{}");
return;
}
Assert.isTrue(rawTuple.size() == 1, "When using JSON input, only one field is expected");
// postpone the coercion
Tuple tuple = CascadingUtils.coerceToString(sinkCall);
super.convert(tuple.getObject(0), to);
}
}
代码示例来源:origin: elastic/elasticsearch-hadoop
List<Object> elements = Tuple.elements(entry.getTuple());
elements.clear();
elements.addAll(data.values());
代码示例来源:origin: elastic/elasticsearch-hadoop
static Tuple coerceToString(SinkCall<?, ?> sinkCall) {
TupleEntry entry = sinkCall.getOutgoingEntry();
Fields fields = entry.getFields();
Tuple tuple = entry.getTuple();
if (fields.hasTypes()) {
Type types[] = new Type[fields.size()];
for (int index = 0; index < fields.size(); index++) {
Type type = fields.getType(index);
if (type instanceof CoercibleType<?>) {
types[index] = String.class;
}
else {
types[index] = type;
}
}
tuple = entry.getCoercedTuple(types);
}
return tuple;
}
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean isRemove( FlowProcess flowProcess, FilterCall filterCall )
{
for( Object value : filterCall.getArguments().getTuple() )
{
if( value != null )
return true;
}
return false;
}
}
代码示例来源:origin: cwensel/cascading
@Override
public Tuple next()
{
Tuple tuple = childIterator.next().getTuple();
TupleViews.reset( view, base, tuple );
return view;
}
代码示例来源:origin: cwensel/cascading
public TupleEntry next()
{
argumentsEntry.setTuple( argumentsBuilder.makeResult( grouping.joinIterator.next().getTuple(), null ) );
return argumentsEntry;
}
代码示例来源:origin: cwensel/cascading
private String print( TupleEntry tupleEntry )
{
if( tupleEntry == null || tupleEntry.getFields() == null )
return "[uninitialized]";
else if( tupleEntry.getTuple() == null )
return "fields: " + tupleEntry.getFields().printVerbose();
else
return "fields: " + tupleEntry.getFields().printVerbose() + " tuple: " + tupleEntry.getTuple().print();
}
}
代码示例来源:origin: cwensel/cascading
@Override
public void sink( FlowProcess<? extends Configuration> flowProcess, SinkCall<Object[], OutputCollector> sinkCall ) throws IOException
{
Text text = (Text) sinkCall.getContext()[ 0 ];
Charset charset = (Charset) sinkCall.getContext()[ 1 ];
String line = sinkCall.getOutgoingEntry().getTuple().toString();
text.set( line.getBytes( charset ) );
// it's ok to use NULL here so the collector does not write anything
sinkCall.getOutput().collect( null, text );
}
代码示例来源:origin: cwensel/cascading
@Override
public void doAssert( FlowProcess flowProcess, ValueAssertionCall assertionCall )
{
TupleEntry input = assertionCall.getArguments();
if( input.size() != size )
fail( input.size(), size, input.getTuple().print() );
}
代码示例来源:origin: cwensel/cascading
@Override
public void doAssert( FlowProcess flowProcess, ValueAssertionCall assertionCall )
{
TupleEntry input = assertionCall.getArguments();
if( input.size() <= size )
fail( input.size(), size, input.getTuple().print() );
}
代码示例来源:origin: cwensel/cascading
public void aggregate( FlowProcess flowProcess, AggregatorCall aggregatorCall )
{
if( !aggregatorCall.getGroup().isUnmodifiable() )
throw new IllegalStateException( "is modifiable" );
if( !aggregatorCall.getGroup().getTuple().isUnmodifiable() )
throw new IllegalStateException( "is modifiable" );
if( !aggregatorCall.getArguments().isUnmodifiable() )
throw new IllegalStateException( "is modifiable" );
if( !aggregatorCall.getArguments().getTuple().isUnmodifiable() )
throw new IllegalStateException( "is modifiable" );
}
代码示例来源:origin: cwensel/cascading
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 ) ) );
}
};
代码示例来源:origin: cwensel/cascading
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 ) ) );
}
};
代码示例来源:origin: cwensel/cascading
@Override
public void operate( FlowProcess flowProcess, FunctionCall<Tuple> functionCall )
{
functionCall.getContext().set( 0, functionCall.getArguments().getTuple().toString( delimiter, false ) );
functionCall.getOutputCollector().add( functionCall.getContext() );
}
代码示例来源:origin: cwensel/cascading
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" );
}
}
代码示例来源:origin: cwensel/cascading
@Override
public void doAssert( FlowProcess flowProcess, ValueAssertionCall<Matcher> assertionCall )
{
TupleEntry input = assertionCall.getArguments();
int pos = matchEachElementPos( assertionCall.getContext(), input );
if( pos != -1 )
BaseAssertion.throwFail( message, input.getFields().get( pos ), input.getObject( pos ), patternString, input.getTuple().print() );
}
}
代码示例来源:origin: cwensel/cascading
@Test
public void testSetNull()
{
TupleEntry entryA = new TupleEntry( new Fields( "a", "b", "c" ), new Tuple( "a", "b", "c" ) );
entryA.setTuple( null );
assertTrue( entryA.getTuple() == null );
}
内容来源于网络,如有侵权,请联系作者删除!