本文整理汇总了Java中org.apache.flink.api.common.io.NonParallelInput类的典型用法代码示例。如果您正苦于以下问题:Java NonParallelInput类的具体用法?Java NonParallelInput怎么用?Java NonParallelInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NonParallelInput类属于org.apache.flink.api.common.io包,在下文中一共展示了NonParallelInput类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DataSource
import org.apache.flink.api.common.io.NonParallelInput; //导入依赖的package包/类
/**
* Creates a new data source.
*
* @param context The environment in which the data source gets executed.
* @param inputFormat The input format that the data source executes.
* @param type The type of the elements produced by this input format.
*/
public DataSource(ExecutionEnvironment context, InputFormat<OUT, ?> inputFormat, TypeInformation<OUT> type, String dataSourceLocationName) {
super(context, type);
this.dataSourceLocationName = dataSourceLocationName;
if (inputFormat == null) {
throw new IllegalArgumentException("The input format may not be null.");
}
this.inputFormat = inputFormat;
if (inputFormat instanceof NonParallelInput) {
this.parallelism = 1;
}
}
示例2: createInputSplits
import org.apache.flink.api.common.io.NonParallelInput; //导入依赖的package包/类
@Override
public GenericInputSplit[] createInputSplits(int numSplits) throws IOException {
if (numSplits < 1) {
throw new IllegalArgumentException("Number of input splits has to be at least 1.");
}
numSplits = (this instanceof NonParallelInput) ? 1 : numSplits;
GenericInputSplit[] splits = new GenericInputSplit[numSplits];
for (int i = 0; i < splits.length; i++) {
splits[i] = new GenericInputSplit(i, numSplits);
}
return splits;
}
示例3: DataSourceNode
import org.apache.flink.api.common.io.NonParallelInput; //导入依赖的package包/类
/**
* Creates a new DataSourceNode for the given contract.
*
* @param pactContract
* The data source contract object.
*/
public DataSourceNode(GenericDataSourceBase<?, ?> pactContract) {
super(pactContract);
if (pactContract.getUserCodeWrapper().getUserCodeClass() == null) {
throw new IllegalArgumentException("Input format has not been set.");
}
if (NonParallelInput.class.isAssignableFrom(pactContract.getUserCodeWrapper().getUserCodeClass())) {
setParallelism(1);
this.sequentialInput = true;
} else {
this.sequentialInput = false;
}
this.replicatedInput = ReplicatingInputFormat.class.isAssignableFrom(
pactContract.getUserCodeWrapper().getUserCodeClass());
this.gprops = new GlobalProperties();
this.lprops = new LocalProperties();
SplitDataProperties<?> splitProps = pactContract.getSplitDataProperties();
if(replicatedInput) {
this.gprops.setFullyReplicated();
this.lprops = new LocalProperties();
} else if (splitProps != null) {
// configure data properties of data source using split properties
setDataPropertiesFromSplitProperties(splitProps);
}
}
示例4: DataSourceNode
import org.apache.flink.api.common.io.NonParallelInput; //导入依赖的package包/类
/**
* Creates a new DataSourceNode for the given contract.
*
* @param pactContract
* The data source contract object.
*/
public DataSourceNode(GenericDataSourceBase<?, ?> pactContract) {
super(pactContract);
if (pactContract.getUserCodeWrapper().getUserCodeClass() == null) {
throw new IllegalArgumentException("Input format has not been set.");
}
if (NonParallelInput.class.isAssignableFrom(pactContract.getUserCodeWrapper().getUserCodeClass())) {
setDegreeOfParallelism(1);
this.sequentialInput = true;
} else {
this.sequentialInput = false;
}
}
示例5: DataSource
import org.apache.flink.api.common.io.NonParallelInput; //导入依赖的package包/类
/**
* Creates a new data source.
*
* @param context The environment in which the data source gets executed.
* @param inputFormat The input format that the data source executes.
* @param type The type of the elements produced by this input format.
*/
public DataSource(ExecutionEnvironment context, InputFormat<OUT, ?> inputFormat, TypeInformation<OUT> type) {
super(context, type);
if (inputFormat == null) {
throw new IllegalArgumentException("The input format may not be null.");
}
this.inputFormat = inputFormat;
if (inputFormat instanceof NonParallelInput) {
this.dop = 1;
}
}