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


Java MapOperatorBase.setDegreeOfParallelism方法代码示例

本文整理汇总了Java中org.apache.flink.api.common.operators.base.MapOperatorBase.setDegreeOfParallelism方法的典型用法代码示例。如果您正苦于以下问题:Java MapOperatorBase.setDegreeOfParallelism方法的具体用法?Java MapOperatorBase.setDegreeOfParallelism怎么用?Java MapOperatorBase.setDegreeOfParallelism使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.api.common.operators.base.MapOperatorBase的用法示例。


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

示例1: translateSelectorFunctionReducer

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <IN, OUT, K> PlanUnwrappingReduceGroupOperator<IN, OUT, K> translateSelectorFunctionReducer(
		Keys.SelectorFunctionKeys<IN, ?> rawKeys, GroupReduceFunction<IN, OUT> function,
		TypeInformation<IN> inputType, TypeInformation<OUT> outputType, String name, Operator<IN> input,
		boolean combinable)
{
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<IN, K> keys = (Keys.SelectorFunctionKeys<IN, K>) rawKeys;
	
	TypeInformation<Tuple2<K, IN>> typeInfoWithKey = new TupleTypeInfo<Tuple2<K, IN>>(keys.getKeyType(), inputType);
	
	KeyExtractingMapper<IN, K> extractor = new KeyExtractingMapper<IN, K>(keys.getKeyExtractor());
	
	PlanUnwrappingReduceGroupOperator<IN, OUT, K> reducer = new PlanUnwrappingReduceGroupOperator<IN, OUT, K>(function, keys, name, outputType, typeInfoWithKey, combinable);
	
	MapOperatorBase<IN, Tuple2<K, IN>, MapFunction<IN, Tuple2<K, IN>>> mapper = new MapOperatorBase<IN, Tuple2<K, IN>, MapFunction<IN, Tuple2<K, IN>>>(extractor, new UnaryOperatorInformation<IN, Tuple2<K, IN>>(inputType, typeInfoWithKey), "Key Extractor");

	reducer.setInput(mapper);
	mapper.setInput(input);
	
	// set the mapper's parallelism to the input parallelism to make sure it is chained
	mapper.setDegreeOfParallelism(input.getDegreeOfParallelism());
	
	return reducer;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:25,代码来源:GroupReduceOperator.java

示例2: translateToDataFlow

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
@Override
protected org.apache.flink.api.common.operators.base.MapOperatorBase<IN, OUT, MapFunction<IN, OUT>> translateToDataFlow(Operator<IN> input) {
	
	String name = getName() != null ? getName() : function.getClass().getName();
	// create operator
	MapOperatorBase<IN, OUT, MapFunction<IN, OUT>> po = new MapOperatorBase<IN, OUT, MapFunction<IN, OUT>>(function, new UnaryOperatorInformation<IN, OUT>(getInputType(), getResultType()), name);
	// set input
	po.setInput(input);
	// set dop
	if(this.getParallelism() > 0) {
		// use specified dop
		po.setDegreeOfParallelism(this.getParallelism());
	} else {
		// if no dop has been specified, use dop of input operator to enable chaining
		po.setDegreeOfParallelism(input.getDegreeOfParallelism());
	}
	
	return po;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:20,代码来源:MapOperator.java

示例3: translateSelectorFunctionReducer

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <T, K> MapOperatorBase<Tuple2<K, T>, T, ?> translateSelectorFunctionReducer(Keys.SelectorFunctionKeys<T, ?> rawKeys,
		ReduceFunction<T> function, TypeInformation<T> inputType, String name, Operator<T> input, int dop)
{
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<T, K> keys = (Keys.SelectorFunctionKeys<T, K>) rawKeys;
	
	TypeInformation<Tuple2<K, T>> typeInfoWithKey = new TupleTypeInfo<Tuple2<K, T>>(keys.getKeyType(), inputType);
	
	KeyExtractingMapper<T, K> extractor = new KeyExtractingMapper<T, K>(keys.getKeyExtractor());
	
	PlanUnwrappingReduceOperator<T, K> reducer = new PlanUnwrappingReduceOperator<T, K>(function, keys, name, inputType, typeInfoWithKey);
	
	MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>> keyExtractingMap = new MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>>(extractor, new UnaryOperatorInformation<T, Tuple2<K, T>>(inputType, typeInfoWithKey), "Key Extractor");
	MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>> keyRemovingMap = new MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>>(new KeyRemovingMapper<T, K>(), new UnaryOperatorInformation<Tuple2<K, T>, T>(typeInfoWithKey, inputType), "Key Extractor");

	keyExtractingMap.setInput(input);
	reducer.setInput(keyExtractingMap);
	keyRemovingMap.setInput(reducer);
	
	// set dop
	keyExtractingMap.setDegreeOfParallelism(input.getDegreeOfParallelism());
	reducer.setDegreeOfParallelism(dop);
	keyRemovingMap.setDegreeOfParallelism(dop);
	
	return keyRemovingMap;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:27,代码来源:ReduceOperator.java

示例4: translateSelectorFunctionReducer

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <T, K> MapOperatorBase<Tuple2<K, T>, T, ?> translateSelectorFunctionReducer(Keys.SelectorFunctionKeys<T, ?> rawKeys,
		PartitionMethod pMethod, TypeInformation<T> inputType, String name, Operator<T> input, int partitionDop)
{
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<T, K> keys = (Keys.SelectorFunctionKeys<T, K>) rawKeys;
	
	TypeInformation<Tuple2<K, T>> typeInfoWithKey = new TupleTypeInfo<Tuple2<K, T>>(keys.getKeyType(), inputType);
	UnaryOperatorInformation<Tuple2<K, T>, Tuple2<K, T>> operatorInfo = new UnaryOperatorInformation<Tuple2<K, T>, Tuple2<K, T>>(typeInfoWithKey, typeInfoWithKey);
	
	KeyExtractingMapper<T, K> extractor = new KeyExtractingMapper<T, K>(keys.getKeyExtractor());
	
	MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>> keyExtractingMap = new MapOperatorBase<T, Tuple2<K, T>, MapFunction<T, Tuple2<K, T>>>(extractor, new UnaryOperatorInformation<T, Tuple2<K, T>>(inputType, typeInfoWithKey), "Key Extractor");
	PartitionOperatorBase<Tuple2<K, T>> noop = new PartitionOperatorBase<Tuple2<K, T>>(operatorInfo, pMethod, new int[]{0}, name);
	MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>> keyRemovingMap = new MapOperatorBase<Tuple2<K, T>, T, MapFunction<Tuple2<K, T>, T>>(new KeyRemovingMapper<T, K>(), new UnaryOperatorInformation<Tuple2<K, T>, T>(typeInfoWithKey, inputType), "Key Extractor");

	keyExtractingMap.setInput(input);
	noop.setInput(keyExtractingMap);
	keyRemovingMap.setInput(noop);
	
	// set dop
	keyExtractingMap.setDegreeOfParallelism(input.getDegreeOfParallelism());
	noop.setDegreeOfParallelism(partitionDop);
	keyRemovingMap.setDegreeOfParallelism(partitionDop);
	
	return keyRemovingMap;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:27,代码来源:PartitionOperator.java

示例5: translateSelectorFunctionJoin

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <I1, I2, K, OUT> PlanBothUnwrappingJoinOperator<I1, I2, OUT, K> translateSelectorFunctionJoin(
		Keys.SelectorFunctionKeys<I1, ?> rawKeys1, Keys.SelectorFunctionKeys<I2, ?> rawKeys2, 
		FlatJoinFunction<I1, I2, OUT> function,
		TypeInformation<I1> inputType1, TypeInformation<I2> inputType2, TypeInformation<OUT> outputType, String name,
		Operator<I1> input1, Operator<I2> input2)
{
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<I1, K> keys1 = (Keys.SelectorFunctionKeys<I1, K>) rawKeys1;
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<I2, K> keys2 = (Keys.SelectorFunctionKeys<I2, K>) rawKeys2;
	
	final TypeInformation<Tuple2<K, I1>> typeInfoWithKey1 = new TupleTypeInfo<Tuple2<K, I1>>(keys1.getKeyType(), inputType1);
	final TypeInformation<Tuple2<K, I2>> typeInfoWithKey2 = new TupleTypeInfo<Tuple2<K, I2>>(keys2.getKeyType(), inputType2);
	
	final KeyExtractingMapper<I1, K> extractor1 = new KeyExtractingMapper<I1, K>(keys1.getKeyExtractor());
	final KeyExtractingMapper<I2, K> extractor2 = new KeyExtractingMapper<I2, K>(keys2.getKeyExtractor());

	final MapOperatorBase<I1, Tuple2<K, I1>, MapFunction<I1, Tuple2<K, I1>>> keyMapper1 =
			new MapOperatorBase<I1, Tuple2<K, I1>, MapFunction<I1, Tuple2<K, I1>>>(extractor1, new UnaryOperatorInformation<I1, Tuple2<K, I1>>(inputType1, typeInfoWithKey1), "Key Extractor 1");
	final MapOperatorBase<I2, Tuple2<K, I2>, MapFunction<I2, Tuple2<K, I2>>> keyMapper2 =
			new MapOperatorBase<I2, Tuple2<K, I2>, MapFunction<I2, Tuple2<K, I2>>>(extractor2, new UnaryOperatorInformation<I2, Tuple2<K, I2>>(inputType2, typeInfoWithKey2), "Key Extractor 2");
	final PlanBothUnwrappingJoinOperator<I1, I2, OUT, K> join = new PlanBothUnwrappingJoinOperator<I1, I2, OUT, K>(function, keys1, keys2, name, outputType, typeInfoWithKey1, typeInfoWithKey2);
	
	join.setFirstInput(keyMapper1);
	join.setSecondInput(keyMapper2);
	
	keyMapper1.setInput(input1);
	keyMapper2.setInput(input2);
	// set dop
	keyMapper1.setDegreeOfParallelism(input1.getDegreeOfParallelism());
	keyMapper2.setDegreeOfParallelism(input2.getDegreeOfParallelism());
	
	return join;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:35,代码来源:JoinOperator.java

示例6: translateSelectorFunctionCoGroup

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <I1, I2, K, OUT> PlanBothUnwrappingCoGroupOperator<I1, I2, OUT, K> translateSelectorFunctionCoGroup(
		Keys.SelectorFunctionKeys<I1, ?> rawKeys1, Keys.SelectorFunctionKeys<I2, ?> rawKeys2,
		CoGroupFunction<I1, I2, OUT> function,
		TypeInformation<I1> inputType1, TypeInformation<I2> inputType2, TypeInformation<OUT> outputType, String name,
		Operator<I1> input1, Operator<I2> input2)
{
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<I1, K> keys1 = (Keys.SelectorFunctionKeys<I1, K>) rawKeys1;
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<I2, K> keys2 = (Keys.SelectorFunctionKeys<I2, K>) rawKeys2;

	final TypeInformation<Tuple2<K, I1>> typeInfoWithKey1 = new TupleTypeInfo<Tuple2<K, I1>>(keys1.getKeyType(), inputType1);
	final TypeInformation<Tuple2<K, I2>> typeInfoWithKey2 = new TupleTypeInfo<Tuple2<K, I2>>(keys2.getKeyType(), inputType2);

	final KeyExtractingMapper<I1, K> extractor1 = new KeyExtractingMapper<I1, K>(keys1.getKeyExtractor());
	final KeyExtractingMapper<I2, K> extractor2 = new KeyExtractingMapper<I2, K>(keys2.getKeyExtractor());
	
	final MapOperatorBase<I1, Tuple2<K, I1>, MapFunction<I1, Tuple2<K, I1>>> keyMapper1 =
			new MapOperatorBase<I1, Tuple2<K, I1>, MapFunction<I1, Tuple2<K, I1>>>(extractor1, new UnaryOperatorInformation<I1, Tuple2<K, I1>>(inputType1, typeInfoWithKey1), "Key Extractor 1");
	final MapOperatorBase<I2, Tuple2<K, I2>, MapFunction<I2, Tuple2<K, I2>>> keyMapper2 =
			new MapOperatorBase<I2, Tuple2<K, I2>, MapFunction<I2, Tuple2<K, I2>>>(extractor2, new UnaryOperatorInformation<I2, Tuple2<K, I2>>(inputType2, typeInfoWithKey2), "Key Extractor 2");
	final PlanBothUnwrappingCoGroupOperator<I1, I2, OUT, K> cogroup = new PlanBothUnwrappingCoGroupOperator<I1, I2, OUT, K>(function, keys1, keys2, name, outputType, typeInfoWithKey1, typeInfoWithKey2);

	cogroup.setFirstInput(keyMapper1);
	cogroup.setSecondInput(keyMapper2);

	keyMapper1.setInput(input1);
	keyMapper2.setInput(input2);
	// set dop
	keyMapper1.setDegreeOfParallelism(input1.getDegreeOfParallelism());
	keyMapper2.setDegreeOfParallelism(input2.getDegreeOfParallelism());

	return cogroup;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:35,代码来源:CoGroupOperator.java

示例7: translateSelectorFunctionJoinRight

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <I1, I2, K, OUT> PlanRightUnwrappingJoinOperator<I1, I2, OUT, K> translateSelectorFunctionJoinRight(
		int[] logicalKeyPositions1,
		Keys.SelectorFunctionKeys<I2, ?> rawKeys2,
		FlatJoinFunction<I1, I2, OUT> function,
		TypeInformation<I1> inputType1,
		TypeInformation<I2> inputType2,
		TypeInformation<OUT> outputType,
		String name,
		Operator<I1> input1,
		Operator<I2> input2) {

	if(!inputType1.isTupleType()) {
		throw new InvalidParameterException("Should not happen.");
	}
	
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<I2, K> keys2 =
			(Keys.SelectorFunctionKeys<I2, K>) rawKeys2;
	
	final TypeInformation<Tuple2<K, I2>> typeInfoWithKey2 =
			new TupleTypeInfo<Tuple2<K, I2>>(keys2.getKeyType(), inputType2);
	
	final KeyExtractingMapper<I2, K> extractor2 =
			new KeyExtractingMapper<I2, K>(keys2.getKeyExtractor());

	final MapOperatorBase<I2, Tuple2<K, I2>, MapFunction<I2, Tuple2<K, I2>>> keyMapper2 =
			new MapOperatorBase<I2, Tuple2<K, I2>, MapFunction<I2, Tuple2<K, I2>>>(
					extractor2,
					new UnaryOperatorInformation<I2,Tuple2<K, I2>>(inputType2, typeInfoWithKey2),
					"Key Extractor 2");
	
	final PlanRightUnwrappingJoinOperator<I1, I2, OUT, K> join =
			new PlanRightUnwrappingJoinOperator<I1, I2, OUT, K>(
					function,
					logicalKeyPositions1,
					keys2,
					name,
					outputType,
					inputType1,
					typeInfoWithKey2);
	
	join.setFirstInput(input1);
	join.setSecondInput(keyMapper2);
	
	keyMapper2.setInput(input2);
	// set dop
	keyMapper2.setDegreeOfParallelism(input2.getDegreeOfParallelism());
	
	return join;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:51,代码来源:JoinOperator.java

示例8: translateSelectorFunctionJoinLeft

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <I1, I2, K, OUT> PlanLeftUnwrappingJoinOperator<I1, I2, OUT, K> translateSelectorFunctionJoinLeft(
		Keys.SelectorFunctionKeys<I1, ?> rawKeys1,
		int[] logicalKeyPositions2,
		FlatJoinFunction<I1, I2, OUT> function,
		TypeInformation<I1> inputType1,
		TypeInformation<I2> inputType2,
		TypeInformation<OUT> outputType,
		String name,
		Operator<I1> input1,
		Operator<I2> input2) {

	if(!inputType2.isTupleType()) {
		throw new InvalidParameterException("Should not happen.");
	}
	
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<I1, K> keys1 = (Keys.SelectorFunctionKeys<I1, K>) rawKeys1;
	
	final TypeInformation<Tuple2<K, I1>> typeInfoWithKey1 =
			new TupleTypeInfo<Tuple2<K, I1>>(keys1.getKeyType(), inputType1);

	final KeyExtractingMapper<I1, K> extractor1 =
			new KeyExtractingMapper<I1, K>(keys1.getKeyExtractor());

	final MapOperatorBase<I1, Tuple2<K, I1>, MapFunction<I1, Tuple2<K, I1>>> keyMapper1 =
			new MapOperatorBase<I1, Tuple2<K, I1>, MapFunction<I1, Tuple2<K, I1>>>(
					extractor1,
					new UnaryOperatorInformation<I1, Tuple2<K, I1>>(inputType1, typeInfoWithKey1),
					"Key Extractor 1");

	final PlanLeftUnwrappingJoinOperator<I1, I2, OUT, K> join =
			new PlanLeftUnwrappingJoinOperator<I1, I2, OUT, K>(
					function,
					keys1,
					logicalKeyPositions2,
					name,
					outputType,
					typeInfoWithKey1,
					inputType2);
	
	join.setFirstInput(keyMapper1);
	join.setSecondInput(input2);
	
	keyMapper1.setInput(input1);
	// set dop
	keyMapper1.setDegreeOfParallelism(input1.getDegreeOfParallelism());

	return join;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:50,代码来源:JoinOperator.java

示例9: translateSelectorFunctionCoGroupRight

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <I1, I2, K, OUT> PlanRightUnwrappingCoGroupOperator<I1, I2, OUT, K> translateSelectorFunctionCoGroupRight(
		int[] logicalKeyPositions1, Keys.SelectorFunctionKeys<I2, ?> rawKeys2,
		CoGroupFunction<I1, I2, OUT> function,
		TypeInformation<I1> inputType1, TypeInformation<I2> inputType2, TypeInformation<OUT> outputType, String name,
		Operator<I1> input1, Operator<I2> input2)
{
	if(!inputType1.isTupleType()) {
		throw new InvalidParameterException("Should not happen.");
	}

	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<I2, K> keys2 = (Keys.SelectorFunctionKeys<I2, K>) rawKeys2;

	final TypeInformation<Tuple2<K, I2>> typeInfoWithKey2 =
			new TupleTypeInfo<Tuple2<K, I2>>(keys2.getKeyType(), inputType2);

	final KeyExtractingMapper<I2, K> extractor2 =
			new KeyExtractingMapper<I2, K>(keys2.getKeyExtractor());

	final MapOperatorBase<I2, Tuple2<K, I2>, MapFunction<I2, Tuple2<K, I2>>> keyMapper2 =
			new MapOperatorBase<I2, Tuple2<K, I2>, MapFunction<I2, Tuple2<K, I2>>>(
					extractor2,
					new UnaryOperatorInformation<I2, Tuple2<K, I2>>(inputType2, typeInfoWithKey2),
					"Key Extractor 2");
	
	final PlanRightUnwrappingCoGroupOperator<I1, I2, OUT, K> cogroup =
			new PlanRightUnwrappingCoGroupOperator<I1, I2, OUT, K>(
					function,
					logicalKeyPositions1,
					keys2,
					name,
					outputType,
					inputType1,
					typeInfoWithKey2);

	cogroup.setFirstInput(input1);
	cogroup.setSecondInput(keyMapper2);

	keyMapper2.setInput(input2);
	// set dop
	keyMapper2.setDegreeOfParallelism(input2.getDegreeOfParallelism());

	return cogroup;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:45,代码来源:CoGroupOperator.java

示例10: translateSelectorFunctionCoGroupLeft

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <I1, I2, K, OUT> PlanLeftUnwrappingCoGroupOperator<I1, I2, OUT, K> translateSelectorFunctionCoGroupLeft(
		Keys.SelectorFunctionKeys<I1, ?> rawKeys1, int[] logicalKeyPositions2,
		CoGroupFunction<I1, I2, OUT> function,
		TypeInformation<I1> inputType1, TypeInformation<I2> inputType2, TypeInformation<OUT> outputType, String name,
		Operator<I1> input1, Operator<I2> input2)
{
	if(!inputType2.isTupleType()) {
		throw new InvalidParameterException("Should not happen.");
	}

	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<I1, K> keys1 = (Keys.SelectorFunctionKeys<I1, K>) rawKeys1;

	final TypeInformation<Tuple2<K, I1>> typeInfoWithKey1 =
			new TupleTypeInfo<Tuple2<K, I1>>(keys1.getKeyType(), inputType1);

	final KeyExtractingMapper<I1, K> extractor1 = new KeyExtractingMapper<I1, K>(keys1.getKeyExtractor());

	final MapOperatorBase<I1, Tuple2<K, I1>, MapFunction<I1, Tuple2<K, I1>>> keyMapper1 =
			new MapOperatorBase<I1, Tuple2<K, I1>, MapFunction<I1, Tuple2<K, I1>>>(
					extractor1,
					new UnaryOperatorInformation<I1, Tuple2<K, I1>>(inputType1, typeInfoWithKey1),
					"Key Extractor 1");

	final PlanLeftUnwrappingCoGroupOperator<I1, I2, OUT, K> cogroup =
			new PlanLeftUnwrappingCoGroupOperator<I1, I2, OUT, K>(
					function,
					keys1,
					logicalKeyPositions2,
					name,
					outputType,
					typeInfoWithKey1,
					inputType2);

	cogroup.setFirstInput(keyMapper1);
	cogroup.setSecondInput(input2);

	keyMapper1.setInput(input1);
	// set dop
	keyMapper1.setDegreeOfParallelism(input1.getDegreeOfParallelism());

	return cogroup;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:44,代码来源:CoGroupOperator.java

示例11: translateSelectorFunctionDistinct

import org.apache.flink.api.common.operators.base.MapOperatorBase; //导入方法依赖的package包/类
private static <IN, OUT, K> PlanUnwrappingReduceGroupOperator<IN, OUT, K> translateSelectorFunctionDistinct(
		Keys.SelectorFunctionKeys<IN, ?> rawKeys, RichGroupReduceFunction<IN, OUT> function,
		TypeInformation<IN> inputType, TypeInformation<OUT> outputType, String name, Operator<IN> input)
{
	@SuppressWarnings("unchecked")
	final Keys.SelectorFunctionKeys<IN, K> keys = (Keys.SelectorFunctionKeys<IN, K>) rawKeys;
	
	TypeInformation<Tuple2<K, IN>> typeInfoWithKey = new TupleTypeInfo<Tuple2<K, IN>>(keys.getKeyType(), inputType);
	
	KeyExtractingMapper<IN, K> extractor = new KeyExtractingMapper<IN, K>(keys.getKeyExtractor());


	PlanUnwrappingReduceGroupOperator<IN, OUT, K> reducer =
			new PlanUnwrappingReduceGroupOperator<IN, OUT, K>(function, keys, name, outputType, typeInfoWithKey, true);
	
	MapOperatorBase<IN, Tuple2<K, IN>, MapFunction<IN, Tuple2<K, IN>>> mapper = new MapOperatorBase<IN, Tuple2<K, IN>, MapFunction<IN, Tuple2<K, IN>>>(extractor, new UnaryOperatorInformation<IN, Tuple2<K, IN>>(inputType, typeInfoWithKey), "Key Extractor");

	reducer.setInput(mapper);
	mapper.setInput(input);
	
	// set the mapper's parallelism to the input parallelism to make sure it is chained
	mapper.setDegreeOfParallelism(input.getDegreeOfParallelism());
	
	return reducer;
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:26,代码来源:DistinctOperator.java


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