Java Code Examples for org.apache.flink.core.fs.FileSystem.WriteMode#OVERWRITE

The following examples show how to use org.apache.flink.core.fs.FileSystem.WriteMode#OVERWRITE . 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: FsNegativeRunningJobsRegistry.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void createFile(Path path, boolean overwrite) throws IOException {
	final WriteMode writeMode = overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE;

	try (FSDataOutputStream out = fileSystem.create(path, writeMode)) {
		out.write(42);
	}
}
 
Example 2
Source File: FsNegativeRunningJobsRegistry.java    From flink with Apache License 2.0 5 votes vote down vote up
private void createFile(Path path, boolean overwrite) throws IOException {
	final WriteMode writeMode = overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE;

	try (FSDataOutputStream out = fileSystem.create(path, writeMode)) {
		out.write(42);
	}
}
 
Example 3
Source File: PythonOperationInfo.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public PythonOperationInfo(PythonPlanStreamer streamer, int environmentID) throws IOException {
	identifier = (String) streamer.getRecord();
	parentID = (Integer) streamer.getRecord(true);
	otherID = (Integer) streamer.getRecord(true);
	field = "f0.f" + (Integer) streamer.getRecord(true);
	int encodedOrder = (Integer) streamer.getRecord(true);
	switch (encodedOrder) {
		case 0:
			order = Order.NONE;
			break;
		case 1:
			order = Order.ASCENDING;
			break;
		case 2:
			order = Order.DESCENDING;
			break;
		case 3:
			order = Order.ANY;
			break;
		default:
			order = Order.NONE;
			break;
	}
	keys = Collections.unmodifiableList(Arrays.asList(normalizeKeys(streamer.getRecord(true))));
	keys1 = Collections.unmodifiableList(Arrays.asList(normalizeKeys(streamer.getRecord(true))));
	keys2 = Collections.unmodifiableList(Arrays.asList(normalizeKeys(streamer.getRecord(true))));
	Object tmpType = streamer.getRecord();
	types = tmpType == null ? null : getForObject(tmpType);
	usesUDF = (Boolean) streamer.getRecord();
	name = (String) streamer.getRecord();
	lineDelimiter = (String) streamer.getRecord();
	fieldDelimiter = (String) streamer.getRecord();
	writeMode = ((Integer) streamer.getRecord(true)) == 1
		? WriteMode.OVERWRITE
		: WriteMode.NO_OVERWRITE;
	path = (String) streamer.getRecord();
	frm = (Long) streamer.getRecord();
	to = (Long) streamer.getRecord();
	setID = (Integer) streamer.getRecord(true);
	toError = (Boolean) streamer.getRecord();
	count = (Integer) streamer.getRecord(true);
	int valueCount = (Integer) streamer.getRecord(true);
	List<Object> valueList = new ArrayList<>(valueCount);
	for (int x = 0; x < valueCount; x++) {
		valueList.add(streamer.getRecord());
	}
	values = valueList;
	parallelism = (Integer) streamer.getRecord(true);

	envID = environmentID;
}
 
Example 4
Source File: FileOutputFormat.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * Initialize defaults for output format. Needs to be a static method because it is configured for local
 * cluster execution.
 * @param configuration The configuration to load defaults from
 */
public static void initDefaultsFromConfiguration(Configuration configuration) {
	final boolean overwrite = configuration.getBoolean(CoreOptions.FILESYTEM_DEFAULT_OVERRIDE);

	DEFAULT_WRITE_MODE = overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE;
	
	final boolean alwaysCreateDirectory = configuration.getBoolean(CoreOptions.FILESYSTEM_OUTPUT_ALWAYS_CREATE_DIRECTORY);

	DEFAULT_OUTPUT_DIRECTORY_MODE = alwaysCreateDirectory ? OutputDirectoryMode.ALWAYS : OutputDirectoryMode.PARONLY;
}
 
Example 5
Source File: FileOutputFormat.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Initialize defaults for output format. Needs to be a static method because it is configured for local
 * cluster execution.
 * @param configuration The configuration to load defaults from
 */
public static void initDefaultsFromConfiguration(Configuration configuration) {
	final boolean overwrite = configuration.getBoolean(CoreOptions.FILESYTEM_DEFAULT_OVERRIDE);

	DEFAULT_WRITE_MODE = overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE;
	
	final boolean alwaysCreateDirectory = configuration.getBoolean(CoreOptions.FILESYSTEM_OUTPUT_ALWAYS_CREATE_DIRECTORY);

	DEFAULT_OUTPUT_DIRECTORY_MODE = alwaysCreateDirectory ? OutputDirectoryMode.ALWAYS : OutputDirectoryMode.PARONLY;
}
 
Example 6
Source File: FileOutputFormat.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Initialize defaults for output format. Needs to be a static method because it is configured for local
 * cluster execution.
 * @param configuration The configuration to load defaults from
 */
public static void initDefaultsFromConfiguration(Configuration configuration) {
	final boolean overwrite = configuration.getBoolean(CoreOptions.FILESYTEM_DEFAULT_OVERRIDE);

	DEFAULT_WRITE_MODE = overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE;
	
	final boolean alwaysCreateDirectory = configuration.getBoolean(CoreOptions.FILESYSTEM_OUTPUT_ALWAYS_CREATE_DIRECTORY);

	DEFAULT_OUTPUT_DIRECTORY_MODE = alwaysCreateDirectory ? OutputDirectoryMode.ALWAYS : OutputDirectoryMode.PARONLY;
}