本文整理汇总了Java中com.google.cloud.dataflow.sdk.values.TupleTag类的典型用法代码示例。如果您正苦于以下问题:Java TupleTag类的具体用法?Java TupleTag怎么用?Java TupleTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TupleTag类属于com.google.cloud.dataflow.sdk.values包,在下文中一共展示了TupleTag类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSideInputs
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
private static Map<TupleTag<?>, BroadcastHelper<?>> getSideInputs(
List<PCollectionView<?>> views,
EvaluationContext context) {
if (views == null) {
return ImmutableMap.of();
} else {
Map<TupleTag<?>, BroadcastHelper<?>> sideInputs = Maps.newHashMap();
for (PCollectionView<?> view : views) {
Iterable<? extends WindowedValue<?>> collectionView = context.getPCollectionView(view);
Coder<Iterable<WindowedValue<?>>> coderInternal = view.getCoderInternal();
@SuppressWarnings("unchecked")
BroadcastHelper<?> helper =
BroadcastHelper.create((Iterable<WindowedValue<?>>) collectionView, coderInternal);
//broadcast side inputs
helper.broadcast(context.getSparkContext());
sideInputs.put(view.getTagInternal(), helper);
}
return sideInputs;
}
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:21,代码来源:TransformTranslator.java
示例2: pair
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
public static PCollection<KV<GATKRead, Variant>> pair(PCollection<GATKRead> pRead, PCollection<Variant> pVariant) {
PCollection<KV<VariantShard, GATKRead>> vkReads = pRead.apply(new KeyReadsByOverlappingVariantShard());
PCollection<KV<VariantShard, Variant>> vkVariants =
pVariant.apply(new KeyVariantByOverlappingVariantShard());
// GroupBy VariantShard
final TupleTag<Variant> variantTag = new TupleTag<>();
final TupleTag<GATKRead> readTag = new TupleTag<>();
PCollection<KV<VariantShard, CoGbkResult>> coGbkInput = KeyedPCollectionTuple
.of(variantTag, vkVariants)
.and(readTag, vkReads).apply(CoGroupByKey.<VariantShard>create());
// GroupBy Read
return coGbkInput.apply(ParDo.of(
new DoFn<KV<VariantShard, CoGbkResult>, KV<GATKRead, Variant>>() {
private static final long serialVersionUID = 1L;
@Override
public void processElement(ProcessContext c) throws Exception {
Iterable<Variant> kVariants = c.element().getValue().getAll(variantTag);
Iterable<GATKRead> kReads = c.element().getValue().getAll(readTag);
// Compute overlap.
for (GATKRead r : kReads) {
SimpleInterval readInterval = new SimpleInterval(r);
for (Variant v : kVariants) {
if (readInterval.overlaps(v)) {
c.output(KV.of(r, v));
}
}
}
}
})).setName("PairReadsAndVariants_GroupByRead");
}
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:35,代码来源:GetOverlappingReadsAndVariants.java
示例3: MultiDoFnFunction
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
MultiDoFnFunction(
DoFn<I, O> fn,
SparkRuntimeContext runtimeContext,
TupleTag<O> mainOutputTag,
Map<TupleTag<?>, BroadcastHelper<?>> sideInputs) {
this.mFunction = fn;
this.mRuntimeContext = runtimeContext;
this.mMainOutputTag = mainOutputTag;
this.mSideInputs = sideInputs;
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:11,代码来源:MultiDoFnFunction.java
示例4: call
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
@Override
public Iterable<Tuple2<TupleTag<?>, WindowedValue<?>>>
call(Iterator<WindowedValue<I>> iter) throws Exception {
ProcCtxt ctxt = new ProcCtxt(mFunction, mRuntimeContext, mSideInputs);
mFunction.startBundle(ctxt);
ctxt.setup();
return ctxt.getOutputIterable(iter, mFunction);
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:9,代码来源:MultiDoFnFunction.java
示例5: getOutputIterator
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
@Override
protected Iterator<Tuple2<TupleTag<?>, WindowedValue<?>>> getOutputIterator() {
return Iterators.transform(outputs.entries().iterator(),
new Function<Map.Entry<TupleTag<?>, WindowedValue<?>>,
Tuple2<TupleTag<?>, WindowedValue<?>>>() {
@Override
public Tuple2<TupleTag<?>, WindowedValue<?>> apply(Map.Entry<TupleTag<?>,
WindowedValue<?>> input) {
return new Tuple2<TupleTag<?>, WindowedValue<?>>(input.getKey(), input.getValue());
}
});
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:13,代码来源:MultiDoFnFunction.java
示例6: SparkProcessContext
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
SparkProcessContext(DoFn<I, O> fn,
SparkRuntimeContext runtime,
Map<TupleTag<?>, BroadcastHelper<?>> sideInputs) {
fn.super();
this.fn = fn;
this.mRuntimeContext = runtime;
this.mSideInputs = sideInputs;
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:9,代码来源:SparkProcessContext.java
示例7: sideOutput
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
@Override
public <T> void sideOutput(TupleTag<T> tupleTag, T t) {
String message = "sideOutput is an unsupported operation for doFunctions, use a " +
"MultiDoFunction instead.";
LOG.warn(message);
throw new UnsupportedOperationException(message);
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:8,代码来源:SparkProcessContext.java
示例8: sideOutputWithTimestamp
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
@Override
public <T> void sideOutputWithTimestamp(TupleTag<T> tupleTag, T t, Instant instant) {
String message =
"sideOutputWithTimestamp is an unsupported operation for doFunctions, use a " +
"MultiDoFunction instead.";
LOG.warn(message);
throw new UnsupportedOperationException(message);
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:9,代码来源:SparkProcessContext.java
示例9: multiDo
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
private static <I, O> TransformEvaluator<ParDo.BoundMulti<I, O>> multiDo() {
return new TransformEvaluator<ParDo.BoundMulti<I, O>>() {
@Override
public void evaluate(ParDo.BoundMulti<I, O> transform, EvaluationContext context) {
TupleTag<O> mainOutputTag = MULTIDO_FG.get("mainOutputTag", transform);
MultiDoFnFunction<I, O> multifn = new MultiDoFnFunction<>(
transform.getFn(),
context.getRuntimeContext(),
mainOutputTag,
getSideInputs(transform.getSideInputs(), context));
@SuppressWarnings("unchecked")
JavaRDDLike<WindowedValue<I>, ?> inRDD =
(JavaRDDLike<WindowedValue<I>, ?>) context.getInputRDD(transform);
JavaPairRDD<TupleTag<?>, WindowedValue<?>> all = inRDD
.mapPartitionsToPair(multifn)
.cache();
PCollectionTuple pct = context.getOutput(transform);
for (Map.Entry<TupleTag<?>, PCollection<?>> e : pct.getAll().entrySet()) {
@SuppressWarnings("unchecked")
JavaPairRDD<TupleTag<?>, WindowedValue<?>> filtered =
all.filter(new TupleTagFilter(e.getKey()));
@SuppressWarnings("unchecked")
// Object is the best we can do since different outputs can have different tags
JavaRDD<WindowedValue<Object>> values =
(JavaRDD<WindowedValue<Object>>) (JavaRDD<?>) filtered.values();
context.setRDD(e.getValue(), values);
}
}
};
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:33,代码来源:TransformTranslator.java
示例10: DoFnFunction
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
/**
* @param fn DoFunction to be wrapped.
* @param runtime Runtime to apply function in.
* @param sideInputs Side inputs used in DoFunction.
*/
public DoFnFunction(DoFn<I, O> fn,
SparkRuntimeContext runtime,
Map<TupleTag<?>, BroadcastHelper<?>> sideInputs) {
this.mFunction = fn;
this.mRuntimeContext = runtime;
this.mSideInputs = sideInputs;
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:13,代码来源:DoFnFunction.java
示例11: FileToState
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
public FileToState(TupleTag<GCPResourceErrorInfo> tag) {
errorOutputTag = tag;
}
开发者ID:GoogleCloudPlatform,项目名称:policyscanner,代码行数:4,代码来源:FileToState.java
示例12: ExtractState
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
public ExtractState(TupleTag<GCPResourceErrorInfo> tag) {
errorOutputTag = tag;
}
开发者ID:GoogleCloudPlatform,项目名称:policyscanner,代码行数:4,代码来源:ExtractState.java
示例13: CreateWorkPacketsDoFn
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
public CreateWorkPacketsDoFn(WorkPacketConfig workPacketView, TupleTag<Integer> counter) {
this.workPacketView = workPacketView;
this.counter = counter;
}
开发者ID:GoogleCloudPlatform,项目名称:data-timeseries-java,代码行数:5,代码来源:CreateWorkPacketsDoFn.java
示例14: DistributeWorkDataDoFn
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
public DistributeWorkDataDoFn(WorkPacketConfig workPacketView, TupleTag<Integer> tag) {
this.workPacketView = workPacketView;
this.tag = tag;
}
开发者ID:GoogleCloudPlatform,项目名称:data-timeseries-java,代码行数:5,代码来源:DistributeWorkDataDoFn.java
示例15: ProcCtxt
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
ProcCtxt(DoFn<I, O> fn, SparkRuntimeContext runtimeContext, Map<TupleTag<?>,
BroadcastHelper<?>> sideInputs) {
super(fn, runtimeContext, sideInputs);
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:5,代码来源:MultiDoFnFunction.java
示例16: sideOutput
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
@Override
public synchronized <T> void sideOutput(TupleTag<T> tag, T t) {
outputs.put(tag, windowedValue.withValue(t));
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:5,代码来源:MultiDoFnFunction.java
示例17: sideOutputWithTimestamp
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
@Override
public <T> void sideOutputWithTimestamp(TupleTag<T> tupleTag, T t, Instant instant) {
outputs.put(tupleTag, WindowedValue.of(t, instant,
windowedValue.getWindows(), windowedValue.getPane()));
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:6,代码来源:MultiDoFnFunction.java
示例18: TupleTagFilter
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
private TupleTagFilter(TupleTag<V> tag) {
this.tag = tag;
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:4,代码来源:TransformTranslator.java
示例19: call
import com.google.cloud.dataflow.sdk.values.TupleTag; //导入依赖的package包/类
@Override
public Boolean call(Tuple2<TupleTag<V>, WindowedValue<?>> input) {
return tag.equals(input._1());
}
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:5,代码来源:TransformTranslator.java
注:本文中的com.google.cloud.dataflow.sdk.values.TupleTag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论