org.apache.flink.api.common.io.NonParallelInput Java Examples

The following examples show how to use org.apache.flink.api.common.io.NonParallelInput. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataSource.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
	}
}
 
Example #2
Source File: DataSource.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
	}
}
 
Example #3
Source File: DataSource.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
	}
}
 
Example #4
Source File: NonRichGenericInputFormat.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #5
Source File: DataSourceNode.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
	}

}
 
Example #6
Source File: NonRichGenericInputFormat.java    From flink with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #7
Source File: DataSourceNode.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
	}

}
 
Example #8
Source File: NonRichGenericInputFormat.java    From flink with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #9
Source File: DataSourceNode.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
	}

}