cascading.tuple.TupleEntry.selectTupleCopy()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中cascading.tuple.TupleEntry.selectTupleCopy()方法的一些代码示例,展示了TupleEntry.selectTupleCopy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TupleEntry.selectTupleCopy()方法的具体详情如下:
包路径:cascading.tuple.TupleEntry
类名称:TupleEntry
方法名:selectTupleCopy

TupleEntry.selectTupleCopy介绍

[英]Method selectTupleCopy selects the fields specified in selector from this instance.

It is guaranteed to return a new modifiable Tuple instance at a cost of copying data.

The returned instance is safe to cache.
[中]方法selectTupleCopy从此实例中选择选择器中指定的字段。
它保证以复制数据为代价返回一个新的可修改元组实例。
返回的实例可以安全缓存。

代码示例

代码示例来源:origin: cwensel/cascading

/**
 * Method tupleStreamCopy returns a {@link Stream} of {@link Tuple} instances from the given
 * Tap instance.
 * <p>
 * This method returns an Tuple instance suitable for caching.
 * <p>
 * Also see {@link cascading.tuple.TupleStream#tupleStreamCopy(Tap, FlowProcess)}.
 *
 * @param flowProcess represents the current platform configuration
 * @param selector    the fields to select from the underlying Tuple
 * @return a Stream of TupleE instances
 */
public Stream<Tuple> tupleStreamCopy( FlowProcess<? extends Config> flowProcess, Fields selector )
 {
 return entryStream( flowProcess ).map( tupleEntry -> tupleEntry.selectTupleCopy( selector ) );
 }

代码示例来源:origin: cwensel/cascading

private void useResultSelectors( TupleEntry input, TupleEntryCollector outputCollector )
 {
 LOG.debug( "using result selectors: {}", resultFieldSelectors.length );
 for( Fields resultFieldSelector : resultFieldSelectors )
  {
  Tuple group = input.selectTupleCopy( groupFieldSelector ); // need a mutable copy
  input.selectInto( resultFieldSelector, group );
  outputCollector.add( group );
  }
 }

代码示例来源:origin: cwensel/cascading

public static <C extends Collection<Tuple>> C asCollection( TupleEntryIterator iterator, Fields selector, C result )
 {
 while( iterator.hasNext() )
  result.add( iterator.next().selectTupleCopy( selector ) );
 return result;
 }
}

代码示例来源:origin: cwensel/cascading

@Override
public void operate( FlowProcess flowProcess, FunctionCall<CompositeFunction.Context> functionCall )
 {
 TupleEntry arguments = functionCall.getArguments();
 Tuple key = TupleHasher.wrapTuple( this.tupleHasher, arguments.selectTupleCopy( groupingFields ) );
 Context context = functionCall.getContext();
 Tuple[] functorContext = context.lru.get( key );
 if( functorContext == null )
  {
  functorContext = new Tuple[ functors.length ];
  context.lru.put( key, functorContext );
  flowProcess.increment( Cache.Num_Keys_Missed, 1 );
  }
 else
  {
  flowProcess.increment( Cache.Num_Keys_Hit, 1 );
  }
 for( int i = 0; i < functors.length; i++ )
  {
  TupleViews.reset( context.arguments[ i ].getTuple(), arguments.getTuple() );
  functorContext[ i ] = functors[ i ].aggregate( flowProcess, context.arguments[ i ], functorContext[ i ] );
  }
 }

相关文章