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

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

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

Tap.getSinkFields介绍

[英]Method getSinkFields returns the sinkFields of this Tap object.
[中]方法getSinkFields返回此Tap对象的sinkFields。

代码示例

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

@Override
public Fields getSinkFields()
 {
 return original.getSinkFields();
 }

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

@Override
public Fields getSinkFields()
 {
 return original.getSinkFields();
 }

代码示例来源:origin: cascading/lingual-core

@Override
public Fields apply( Tap input )
 {
 return input.getSinkFields();
 }
} );

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

@Override
public Scheme getScheme()
 {
 if( super.getScheme() != null )
  return super.getScheme();
 Set<Fields> fields = new HashSet<Fields>();
 for( Tap child : getTaps() )
  fields.add( child.getSinkFields() );
 // if all schemes have the same sink fields, the just use the scheme
 if( fields.size() == 1 )
  {
  setScheme( getTaps()[ 0 ].getScheme() );
  return super.getScheme();
  }
 Fields allFields = Fields.merge( fields.toArray( new Fields[ fields.size() ] ) );
 setScheme( new NullScheme( allFields, allFields ) );
 return super.getScheme();
 }

代码示例来源:origin: cascading/lingual-core

@Override
public List<Pipe> resolveTails( Context context )
 {
 if( getSql() == null )
  throw new IllegalStateException( "a sql statement must be provided" );
 Flow flow = context.getFlow();
 flow.getSink().getSinkFields();
 PlannerPlatformBroker platformBroker = new PlannerPlatformBroker();
 LingualContext lingualContext = new LingualContext( this, flow, platformBroker );
 OptiqPrepareImpl prepare = new OptiqPrepareImpl();
 prepare.prepareSql( lingualContext, getSql(), null, Object[].class, -1 );
 Pipe current = platformBroker.getTail();
 String name;
 if( getTailName() != null )
  name = getTailName();
 else if( flow.getSinks().size() == 1 )
  name = (String) flow.getSinkNames().get( 0 );
 else
  throw new IllegalStateException( "too many sinks to choose from, found: " + flow.getSinks().size() + ", use setTailName to match tail pipe with sink Tap" );
 current = new Pipe( name, current ); // bind the tail to the sink name
 return Arrays.asList( current );
 }

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

@Override
public void prepare()
 {
 try
  {
  // todo: pass the resolved fields down
  collector = sink.openForWrite( flowProcess, getOutput() );
  if( sink.getSinkFields().isAll() )
   {
   Fields fields = getIncomingScopes().get( 0 ).getIncomingTapFields();
   collector.setFields( fields );
   }
  }
 catch( IOException exception )
  {
  throw new DuctException( "failed opening sink", exception );
  }
 }

代码示例来源:origin: cascading/lingual-core

public void addTapToConnection( LingualConnection connection, String schemaName, Tap tap, String tableAlias )
 {
 MapSchema rootSchema = (MapSchema) connection.getRootSchema();
 TapSchema subSchema = (TapSchema) rootSchema.getSubSchema( schemaName );
 SchemaDef schemaDef = schemaCatalog.getSchemaDef( schemaName );
 if( tableAlias != null && schemaDef.getTable( tableAlias ) != null )
  {
  TapTable table = (TapTable) subSchema.getTable( tableAlias, Object.class );
  if( table.getName().equals( tableAlias ) )
   LOG.debug( "table exists: {}, discarding", tableAlias );
  else
   LOG.debug( "replacing alias: {}, for: {} ", tableAlias, table.getName() );
  }
 String currentTableName = createTableDefFor( schemaName, null, tap.getIdentifier(), tap.getSinkFields(), null, null );
 TableDef tableDef = schemaDef.getTable( currentTableName );
 TapTable tapTable = subSchema.addTapTableFor( tableDef ); // add table named after flow
 LOG.debug( "adding table:{}", tableDef.getName() );
 if( tableAlias != null && !tapTable.getName().equals( tableAlias ) )
  {
  LOG.debug( "adding alias: {}, for table: {}", tableAlias, tapTable.getName() );
  subSchema.addTable( tableAlias, tapTable ); // add names after given tableName (LAST)
  }
 }

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

incomingFields.select( getSinkFields() );
 isSink() && getSinkFields().equals( Fields.ALL ) ) )
return new Scope( incomingFields );
return new Scope( getSinkFields() );

代码示例来源:origin: cascading/lingual-core

LOG.debug( "reading results fields: {}", flow.getSink().getSinkFields().printVerbose() );
int size = flow.getSink().getSinkFields().size();

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

Class[] types = sink.getSinkFields().getTypesClasses();
assertTrue(
 Arrays.equals(

代码示例来源:origin: cascading/pattern-core

protected void performTest( String inputData, Fields predictedFields, Fields expectedFields, EnsembleSpec<TreeSpec> ensembleSpec ) throws IOException
 {
 Pipe pipe = new Pipe( "head" );
 pipe = new Discard( pipe, predictedFields );
 pipe = new ParallelEnsembleAssembly( pipe, ensembleSpec );
 pipe = new Pipe( "tail", pipe );
 Tap source = getPlatform().getDelimitedFile( expectedFields.append( predictedFields ), true, ",", "\"", DATA_PATH + inputData, SinkMode.KEEP );
 Tap sink = getPlatform().getDelimitedFile( Fields.ALL, true, ",", "\"", getResultPath(), SinkMode.REPLACE );
 FlowDef flowDef = FlowDef.flowDef()
  .addSource( "head", source )
  .addSink( "tail", sink )
  .addTail( pipe );
 Flow flow = getPlatform().getFlowConnector().connect( flowDef );
 flow.writeDOT( getFlowPlanPath() + "/plan.dot" );
 flow.complete();
 Fields sourceSelector = source.getSourceFields();
 Fields sinkSelector = sink.getSinkFields();
 LOG.debug( "source select = {}", sourceSelector.printVerbose() );
 LOG.debug( "sink select   = {}", sinkSelector.printVerbose() );
 List<Tuple> sourceTuples = asList( flow, source, sourceSelector );
 List<Tuple> sinkTuples = asList( flow, sink, sinkSelector );
 assertEquals( sourceTuples, sinkTuples, 0.000001d );
 }
}

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

Class[] types = sink.getSinkFields().getTypesClasses();
assertTrue(
 Arrays.equals(

相关文章