cascading.tap.Tap.getIdentifier()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(125)

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

Tap.getIdentifier介绍

[英]Method getIdentifier returns a String representing the resource this Tap instance represents.

Often, if the tap accesses a filesystem, the identifier is nothing more than the path to the file or directory. In other cases it may be a an URL or URI representing a connection string or remote resource.

Any two Tap instances having the same value for the identifier are considered equal.
[中]方法getIdentifier返回一个字符串,表示该Tap实例所代表的资源。
通常,如果tap访问文件系统,标识符只不过是文件或目录的路径。在其他情况下,它可能是表示连接字符串或远程资源的URL或URI。
标识符值相同的任何两个Tap实例都被视为相等。

代码示例

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

/**
 * Method getFullIdentifier returns a fully qualified resource identifier.
 *
 * @param conf of type Config
 * @return String
 */
public String getFullIdentifier( Config conf )
 {
 return getIdentifier();
 }

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

@Override
public String getIdentifier()
 {
 return original.getIdentifier();
 }

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

@Override
public String getIdentifier()
 {
 return original.getIdentifier();
 }

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

@Override
public String getIdentifier()
 {
 return parent.getIdentifier();
 }

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

@Override
public Tap getSinkWith( String identifier )
 {
 if( Util.isEmpty( identifier ) )
  return null;
 for( Tap tap : sinks.keySet() )
  {
  if( identifier.equalsIgnoreCase( tap.getIdentifier() ) )
   return tap;
  }
 return null;
 }

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

@Override
public Tap getSourceWith( String identifier )
 {
 if( Util.isEmpty( identifier ) )
  return null;
 for( Tap tap : sources.keySet() )
  {
  if( identifier.equalsIgnoreCase( tap.getIdentifier() ) )
   return tap;
  }
 return null;
 }

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

/**
 * Called from flow step to remove temp dirs
 *
 * @param conf
 * @throws IOException
 */
public static void cleanupTapMetaData( Configuration conf, Tap tap ) throws IOException
 {
 cleanTempPath( conf, new Path( tap.getIdentifier() ) );
 }

代码示例来源:origin: cascading/cascading-hadoop2-io

/**
 * Called from flow step to remove temp dirs
 *
 * @param conf
 * @throws IOException
 */
public static void cleanupTapMetaData( Configuration conf, Tap tap ) throws IOException
 {
 cleanTempPath( conf, new Path( tap.getIdentifier() ) );
 }

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

@Override
public int hashCode()
 {
 int result = getIdentifier() != null ? getIdentifier().hashCode() : 0;
 result = 31 * result + ( getScheme() != null ? getScheme().hashCode() : 0 );
 return result;
 }

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

@Override
public String toString()
 {
 if( getIdentifier() != null )
  return getClass().getSimpleName() + "[\"" + getScheme() + "\"]" + "[\"" + Util.sanitizeUrl( getIdentifier() ) + "\"]"; // sanitize
 else
  return getClass().getSimpleName() + "[\"" + getScheme() + "\"]" + "[not initialized]";
 }
}

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

private Map<String, Tap> makeTapMap( Object resource )
 {
 Collection paths = makeCollection( resource );
 Map<String, Tap> taps = new HashMap<String, Tap>();
 for( Object path : paths )
  {
  if( path instanceof Tap && ( (Tap) path ).getIdentifier() != null )
   taps.put( ( (Tap) path ).getIdentifier(), (Tap) path );
  else
   taps.put( path.toString(), new ProcessTap( new NullScheme(), path.toString() ) );
  }
 return taps;
 }

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

public String makeFlowStepName( FlowStep flowStep, int numSteps, int stepNum )
 {
 Tap sink = Util.getFirst( flowStep.getSinkTaps() );
 stepNum++; // number more sensical (5/5)
 if( sink == null || sink.isTemporary() )
  return String.format( "(%d/%d)", stepNum, numSteps );
 String identifier = sink.getIdentifier();
 if( Util.isEmpty( identifier ) )
  return String.format( "(%d/%d)", stepNum, numSteps );
 if( identifier.length() > 25 )
  identifier = String.format( "...%25s", identifier.substring( identifier.length() - 25 ) );
 return String.format( "(%d/%d) %s", stepNum, numSteps, identifier );
 }

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

public HadoopTupleEntrySchemeCollector( FlowProcess<? extends Configuration> flowProcess, Tap<Configuration, RecordReader, OutputCollector> tap ) throws IOException
 {
 super( flowProcess, tap, tap.getScheme(), makeCollector( flowProcess, tap, null ), tap.getIdentifier() );
 }

代码示例来源:origin: dataArtisans/cascading-flink

@Override
  public void finalizeGlobal(int parallelism) throws IOException {

    org.apache.hadoop.conf.Configuration config = HadoopUtil.copyConfiguration(this.config);
    Tap tap = this.flowNode.getSinkTaps().iterator().next();

    config.setBoolean(HadoopUtil.CASCADING_FLOW_EXECUTING, false);
    HadoopUtil.setOutputPath(config, new Path(tap.getIdentifier()));

    Hadoop18TapUtil.cleanupJob( config );
  }
}

代码示例来源:origin: com.twitter/maple

private void initialize() throws IOException {
 tap.sinkConfInit(hadoopFlowProcess, conf);
 OutputFormat outputFormat = conf.getOutputFormat();
 LOG.info("Output format class is: " + outputFormat.getClass().toString());
 writer = outputFormat.getRecordWriter(null, conf, tap.getIdentifier(), Reporter.NULL);
 sinkCall.setOutput(this);
}

代码示例来源:origin: cascading/cascading-hadoop2-tez

private void setLocalMode( Configuration parent, JobConf current, Tap tap )
 {
 // force step to local mode
 if( !HadoopUtil.isLocal( current ) )
  return;
 if( tap != null )
  logInfo( "tap forcing step to tez local mode: " + tap.getIdentifier() );
 HadoopUtil.setLocal( parent );
 }

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

@Override
public boolean deleteResource( Properties conf ) throws IOException
 {
 String[] childIdentifiers = ( (FileTap) parent ).getChildIdentifiers( conf, Integer.MAX_VALUE, false );
 if( childIdentifiers.length == 0 )
  return deleteParent( conf );
 DirTap.deleteChildren( Paths.get( parent.getIdentifier() ), childIdentifiers );
 return deleteParent( conf );
 }

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

private void setLocalMode( Configuration parent, JobConf current, Tap tap )
 {
 // force step to local mode
 if( !HadoopUtil.isLocal( current ) )
  return;
 if( tap != null )
  logInfo( "tap forcing step to tez local mode: " + tap.getIdentifier() );
 HadoopUtil.setLocal( parent );
 }

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

private void assertHeaders( Tap output, Flow flow ) throws IOException
 {
 TupleEntryIterator iterator = flow.openTapForRead( getPlatform().getTextFile( new Fields( "line" ), output.getIdentifier() ) );
 assertEquals( iterator.next().getObject( 0 ), "first,second,third,fourth,fifth" );
 iterator.close();
 }

代码示例来源:origin: cascading/cascading-platform

private void assertHeaders( Tap output, Flow flow ) throws IOException
 {
 TupleEntryIterator iterator = flow.openTapForRead( getPlatform().getTextFile( new Fields( "line" ), output.getIdentifier() ) );
 assertEquals( iterator.next().getObject( 0 ), "first,second,third,fourth,fifth" );
 iterator.close();
 }

相关文章