当前位置: 首页>>代码示例>>Java>>正文


Java SourceCall类代码示例

本文整理汇总了Java中cascading.scheme.SourceCall的典型用法代码示例。如果您正苦于以下问题:Java SourceCall类的具体用法?Java SourceCall怎么用?Java SourceCall使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SourceCall类属于cascading.scheme包,在下文中一共展示了SourceCall类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
/**
 * Populates the {@link Corc} with the next value from the {@link RecordReader}. Then copies the values into the
 * incoming {@link TupleEntry}.
 */
@Override
public boolean source(FlowProcess<? extends Configuration> flowProcess, SourceCall<Corc, RecordReader> sourceCall)
    throws IOException {
  Corc corc = sourceCall.getContext();
  @SuppressWarnings("unchecked")
  boolean next = sourceCall.getInput().next(NullWritable.get(), corc);
  if (!next) {
    return false;
  }
  TupleEntry tupleEntry = sourceCall.getIncomingEntry();
  for (Comparable<?> fieldName : tupleEntry.getFields()) {
    if (ROW_ID_NAME.equals(fieldName)) {
      tupleEntry.setObject(ROW_ID_NAME, corc.getRecordIdentifier());
    } else {
      tupleEntry.setObject(fieldName, corc.get(fieldName.toString()));
    }
  }
  return true;
}
 
开发者ID:HotelsDotCom,项目名称:corc,代码行数:24,代码来源:OrcFile.java

示例2: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@Override
public boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) throws IOException {
    Tuple result = new Tuple();

    Object key = sourceCall.getContext()[0];
    Object value = sourceCall.getContext()[1];

    boolean hasNext = sourceCall.getInput().next(key, value);
    if (!hasNext) { return false; }

    // Skip nulls
    if (key == null || value == null) { return true; }

    LongWritable keyWritable = (LongWritable) key;
    ArrayListTextWritable values = (ArrayListTextWritable) value;
    result.add(keyWritable);

    for(Text textValue : values)
        result.add(textValue);

    sourceCall.getIncomingEntry().setTuple(result);

    return true;
}
 
开发者ID:yolodata,项目名称:tbana,代码行数:25,代码来源:ShuttlCsv.java

示例3: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@Override
public boolean source(FlowProcess<JobConf> prcs, SourceCall<Object[], RecordReader> sourceCall)
    throws IOException {

  Object key = sourceCall.getContext()[0];
  Object value = sourceCall.getContext()[1];

  boolean result = sourceCall.getInput().next(key, value);

  if (!result) {
    return false;
  }

  sourceCall.getIncomingEntry().setTuple(new Tuple(key, value));
  return true;
}
 
开发者ID:indix,项目名称:dfs-datastores,代码行数:17,代码来源:RawSequenceFile.java

示例4: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@Override
public boolean source(FlowProcess<JobConf> flowProcess,
    SourceCall<Object[], RecordReader> sourceCall) throws IOException {
  BytesWritable key = (BytesWritable) sourceCall.getContext()[0];
  BytesWritable value = (BytesWritable) sourceCall.getContext()[1];
  boolean result = sourceCall.getInput().next(key, value);

  if (!result) { return false; }

  Tuple tuple = sourceCall.getIncomingEntry().getTuple();
  tuple.clear();

  tuple.add(getBytes(key));
  tuple.add(getBytes(value));

  return true;
}
 
开发者ID:indix,项目名称:dfs-datastores,代码行数:18,代码来源:KeyValueByteScheme.java

示例5: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall)
		throws IOException {
	Tuple result = new Tuple();

	Object key = sourceCall.getContext()[0];
	Object value = sourceCall.getContext()[1];
	boolean hasNext = sourceCall.getInput().next(key, value);
	if (!hasNext) {
		return false;
	}

	// Skip nulls
	if (key == null || value == null) {
		return true;
	}

	ImmutableBytesWritable keyWritable = (ImmutableBytesWritable) key;
	Result row = (Result) value;
	result.add(keyWritable);
	result.add(row);
	sourceCall.getIncomingEntry().setTuple(result);
	return true;
}
 
开发者ID:ParallelAI,项目名称:SpyGlass,代码行数:26,代码来源:HBaseRawScheme.java

示例6: sourcePrepare

import cascading.scheme.SourceCall; //导入依赖的package包/类
@Override
public void sourcePrepare(FlowProcess<Properties> flowProcess, SourceCall<Object[], ScrollQuery> sourceCall) throws IOException {
    super.sourcePrepare(flowProcess, sourceCall);

    Object[] context = new Object[1];
    Settings settings = HadoopSettingsManager.loadFrom(flowProcess.getConfigCopy()).merge(props);
    context[0] = CascadingUtils.alias(settings);
    sourceCall.setContext(context);
    IS_ES_20 = SettingsUtils.isEs20(settings);
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:11,代码来源:EsLocalScheme.java

示例7: sourceCleanup

import cascading.scheme.SourceCall; //导入依赖的package包/类
@Override
public void sourceCleanup(FlowProcess<Properties> flowProcess, SourceCall<Object[], ScrollQuery> sourceCall) throws IOException {
    // in case of a source there's no local client so do all reporting here
    report(sourceCall.getInput().stats(), flowProcess);
    report(sourceCall.getInput().repository().stats(), flowProcess);
    sourceCall.getInput().close();
    sourceCall.setContext(null);
    // used for consistency
    cleanupClient(flowProcess);
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:11,代码来源:EsLocalScheme.java

示例8: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean source(FlowProcess<Properties> flowProcess, SourceCall<Object[], ScrollQuery> sourceCall) throws IOException {
    ScrollQuery query = sourceCall.getInput();

    if (!query.hasNext()) {
        return false;
    }

    TupleEntry entry = sourceCall.getIncomingEntry();
    Map<String, ?> data = (Map<String, ?>) query.next()[1];
    FieldAlias alias = (FieldAlias) sourceCall.getContext()[0];

    if (entry.getFields().isDefined()) {
        // lookup using writables
        for (Comparable<?> field : entry.getFields()) {
            Object result = data;
            // check for multi-level alias
            for (String level : StringUtils.tokenize(alias.toES(field.toString()), ".")) {
                result = ((Map) result).get(level);
                if (result == null) {
                    break;
                }
            }
            entry.setObject(field, result);
        }
    }
    else {
        // no definition means no coercion
        List<Object> elements = Tuple.elements(entry.getTuple());
        elements.clear();
        elements.addAll(data.values());
    }
    return true;
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:36,代码来源:EsLocalScheme.java

示例9: sourcePrepare

import cascading.scheme.SourceCall; //导入依赖的package包/类
@Override
public void sourcePrepare(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) throws IOException {
    super.sourcePrepare(flowProcess, sourceCall);

    Object[] context = new Object[3];
    context[0] = sourceCall.getInput().createKey();
    context[1] = sourceCall.getInput().createValue();
    // as the tuple _might_ vary (some objects might be missing), we use a map rather then a collection
    Settings settings = loadSettings(flowProcess.getConfigCopy(), true);
    context[2] = CascadingUtils.alias(settings);
    sourceCall.setContext(context);
    IS_ES_20 = SettingsUtils.isEs20(settings);
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:14,代码来源:EsHadoopScheme.java

示例10: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) throws IOException {
    Object[] context = sourceCall.getContext();

    if (!sourceCall.getInput().next(context[0], context[1])) {
        return false;
    }

    TupleEntry entry = sourceCall.getIncomingEntry();
    Map data = (Map) context[1];
    FieldAlias alias = (FieldAlias) context[2];

    if (entry.getFields().isDefined()) {
        // lookup using writables
        Text lookupKey = new Text();
        for (Comparable<?> field : entry.getFields()) {
            // check for multi-level alias (since ES 1.0)
            Object result = data;
            for (String level : StringUtils.tokenize(alias.toES(field.toString()), ".")) {
                lookupKey.set(level);
                result = ((Map) result).get(lookupKey);
                if (result == null) {
                    break;
                }
            }
            CascadingUtils.setObject(entry, field, result);
        }
    }
    else {
        // no definition means no coercion
        List<Object> elements = Tuple.elements(entry.getTuple());
        elements.clear();
        elements.addAll(data.values());
    }

    return true;
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:39,代码来源:EsHadoopScheme.java

示例11: sourcePrepare

import cascading.scheme.SourceCall; //导入依赖的package包/类
@Override
public void sourcePrepare(FlowProcess<JobConf> flowProcess, SourceCall<Object[], RecordReader> sourceCall) throws IOException {
  initIndices();
  if (sourceCall.getContext() == null) {
    sourceCall.setContext(new Object[2]);
  }
  sourceCall.getContext()[0] = sourceCall.getInput().createKey();
  sourceCall.getContext()[1] = sourceCall.getInput().createValue();
}
 
开发者ID:datascienceinc,项目名称:cascading.csv,代码行数:10,代码来源:CsvScheme.java

示例12: sourcePrepare

import cascading.scheme.SourceCall; //导入依赖的package包/类
@Override
public void sourcePrepare( FlowProcess<? extends Configuration> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) {
	if( !( flowProcess instanceof FlowProcessWrapper) ) {
		throw new RuntimeException( "not a flow process wrapper" );
	}

	if( !"process-default".equals( flowProcess.getProperty( "default" ) ) ) {
		throw new RuntimeException("not default value");
	}

	if( !"source-replace".equals( flowProcess.getProperty( "replace" ) ) ) {
		throw new RuntimeException( "not replaced value" );
	}

	if( !"node-replace".equals( flowProcess.getProperty( "default-node" ) ) ) {
		throw new RuntimeException( "not replaced value" );
	}

	flowProcess = ( (FlowProcessWrapper) flowProcess ).getDelegate();

	if( !"process-default".equals( flowProcess.getProperty( "default" ) ) ) {
		throw new RuntimeException( "not default value" );
	}

	if( !"process-replace".equals( flowProcess.getProperty( "replace" ) ) ) {
		throw new RuntimeException( "not replaced value" );
	}

	super.sourcePrepare( flowProcess, sourceCall );
}
 
开发者ID:dataArtisans,项目名称:cascading-flink,代码行数:31,代码来源:FlinkConfigDefScheme.java

示例13: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean source(FlowProcess<JobConf> fp, SourceCall<Object[], RecordReader> sc)
    throws IOException {
  Container<T> value = (Container<T>) sc.getInput().createValue();
  boolean hasNext = sc.getInput().next(null, value);
  if (!hasNext) { return false; }

  // Skip nulls
  if (value == null) { return true; }

  sc.getIncomingEntry().setTuple(new Tuple(value.get()));
  return true;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:15,代码来源:ParquetValueScheme.java

示例14: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean source(FlowProcess<JobConf> fp, SourceCall<Object[], RecordReader> sc)
    throws IOException {
  Container<Tuple> value = (Container<Tuple>) sc.getInput().createValue();
  boolean hasNext = sc.getInput().next(null, value);
  if (!hasNext) { return false; }

  // Skip nulls
  if (value == null) { return true; }

  sc.getIncomingEntry().setTuple(value.get());
  return true;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:15,代码来源:ParquetTupleScheme.java

示例15: source

import cascading.scheme.SourceCall; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean source(FlowProcess<? extends JobConf> fp, SourceCall<Object[], RecordReader> sc)
    throws IOException {
  Container<T> value = (Container<T>) sc.getInput().createValue();
  boolean hasNext = sc.getInput().next(null, value);
  if (!hasNext) { return false; }

  // Skip nulls
  if (value == null) { return true; }

  sc.getIncomingEntry().setTuple(new Tuple(value.get()));
  return true;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:15,代码来源:ParquetValueScheme.java


注:本文中的cascading.scheme.SourceCall类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。