cascading.pipe.Pipe.named()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(135)

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

Pipe.named介绍

暂无

代码示例

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

protected void verifyCheckpoints( FlowDef flowDef, Pipe[] flowTails )
 {
 verifyNotSourcesSinks( flowDef.getCheckpoints(), flowDef.getSources(), flowDef.getSinks(), "checkpoint" );
 for( Tap checkpointTap : flowDef.getCheckpoints().values() )
  {
  Scheme scheme = checkpointTap.getScheme();
  if( scheme.getSourceFields().equals( Fields.UNKNOWN ) && scheme.getSinkFields().equals( Fields.ALL ) )
   continue;
  throw new PlannerException( "checkpoint tap scheme must be undeclared, source fields must be UNKNOWN, and sink fields ALL, got: " + scheme.toString() );
  }
 Set<String> names = new HashSet<String>( asList( Pipe.names( flowTails ) ) );
 for( String name : flowDef.getCheckpoints().keySet() )
  {
  if( !names.contains( name ) )
   throw new PlannerException( "named checkpoint declared in FlowDef, but no named branch found in pipe assembly: '" + name + "'" );
  Set<Pipe> pipes = new HashSet<Pipe>( asList( Pipe.named( name, flowTails ) ) );
  int count = 0;
  for( Pipe pipe : pipes )
   {
   if( pipe instanceof Checkpoint )
    count++;
   }
  if( count == 0 )
   throw new PlannerException( "no checkpoint pipe with branch name found in pipe assembly: '" + name + "'" );
  if( count > 1 )
   throw new PlannerException( "more than one checkpoint pipe with branch name found in pipe assembly: '" + name + "'" );
  }
 }

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

@Test
public void testGetNames()
 {
 Pipe pipe = new Pipe( "first" );
 pipe = new NestedSubAssembly( pipe );
 Pipe pipe1 = new Pipe( "fifth", ( (SubAssembly) pipe ).getTails()[ 0 ] );
 Pipe pipe2 = new Pipe( "sixth", ( (SubAssembly) pipe ).getTails()[ 1 ] );
 assertEquals( 6, Pipe.names( pipe1, pipe2 ).length );
 assertEquals( 1, Pipe.named( "second", pipe1, pipe2 ).length );
 assertEquals( 1, Pipe.named( "sixth", pipe1, pipe2 ).length );
 assertEquals( pipe2, Pipe.named( "sixth", pipe1, pipe2 )[ 0 ] );
 }
}

相关文章