org.apache.flink.table.client.config.entries.ExecutionEntry Java Examples

The following examples show how to use org.apache.flink.table.client.config.entries.ExecutionEntry. 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: Environment.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Merges two environments. The properties of the first environment might be overwritten by the second one.
 */
public static Environment merge(Environment env1, Environment env2) {
	final Environment mergedEnv = new Environment();

	// merge tables
	final Map<String, TableEntry> tables = new LinkedHashMap<>(env1.getTables());
	tables.putAll(env2.getTables());
	mergedEnv.tables = tables;

	// merge functions
	final Map<String, FunctionEntry> functions = new HashMap<>(env1.getFunctions());
	functions.putAll(env2.getFunctions());
	mergedEnv.functions = functions;

	// merge execution properties
	mergedEnv.execution = ExecutionEntry.merge(env1.getExecution(), env2.getExecution());

	// merge deployment properties
	mergedEnv.deployment = DeploymentEntry.merge(env1.getDeployment(), env2.getDeployment());

	return mergedEnv;
}
 
Example #2
Source File: Environment.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Enriches an environment with new/modified properties or views and returns the new instance.
 */
public static Environment enrich(
		Environment env,
		Map<String, String> properties,
		Map<String, ViewEntry> views) {
	final Environment enrichedEnv = new Environment();

	// merge tables
	enrichedEnv.tables = new LinkedHashMap<>(env.getTables());
	enrichedEnv.tables.putAll(views);

	// merge functions
	enrichedEnv.functions = new HashMap<>(env.getFunctions());

	// enrich execution properties
	enrichedEnv.execution = ExecutionEntry.enrich(env.execution, properties);

	// enrich deployment properties
	enrichedEnv.deployment = DeploymentEntry.enrich(env.deployment, properties);

	return enrichedEnv;
}
 
Example #3
Source File: ExecutionContext.java    From flink with Apache License 2.0 6 votes vote down vote up
private TableConfig createTableConfig() {
	final TableConfig config = new TableConfig();
	config.addConfiguration(flinkConfig);
	Configuration conf = config.getConfiguration();
	environment.getConfiguration().asMap().forEach(conf::setString);
	ExecutionEntry execution = environment.getExecution();
	config.setIdleStateRetentionTime(
			Time.milliseconds(execution.getMinStateRetention()),
			Time.milliseconds(execution.getMaxStateRetention()));

	conf.set(CoreOptions.DEFAULT_PARALLELISM, execution.getParallelism());
	conf.set(PipelineOptions.MAX_PARALLELISM, execution.getMaxParallelism());
	conf.set(StreamPipelineOptions.TIME_CHARACTERISTIC, execution.getTimeCharacteristic());
	if (execution.getTimeCharacteristic() == TimeCharacteristic.EventTime) {
		conf.set(PipelineOptions.AUTO_WATERMARK_INTERVAL,
				Duration.ofMillis(execution.getPeriodicWatermarksInterval()));
	}

	setRestartStrategy(conf);
	return config;
}
 
Example #4
Source File: Environment.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Enriches an environment with new/modified properties and returns the new instance.
 */
public static Environment enrich(Environment env, Map<String, String> properties) {
	final Environment enrichedEnv = new Environment();

	// copy modules
	enrichedEnv.modules = new LinkedHashMap<>(env.getModules());

	// copy catalogs
	enrichedEnv.catalogs = new LinkedHashMap<>(env.getCatalogs());

	// copy tables
	enrichedEnv.tables = new LinkedHashMap<>(env.getTables());

	// copy functions
	enrichedEnv.functions = new HashMap<>(env.getFunctions());

	// enrich execution properties
	enrichedEnv.execution = ExecutionEntry.enrich(env.execution, properties);

	// enrich configuration properties
	enrichedEnv.configuration = ConfigurationEntry.enrich(env.configuration, properties);

	// enrich deployment properties
	enrichedEnv.deployment = DeploymentEntry.enrich(env.deployment, properties);

	return enrichedEnv;
}
 
Example #5
Source File: Environment.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Merges two environments. The properties of the first environment might be overwritten by the second one.
 */
public static Environment merge(Environment env1, Environment env2) {
	final Environment mergedEnv = new Environment();

	// merge modules
	final Map<String, ModuleEntry> modules = new LinkedHashMap<>(env1.getModules());
	modules.putAll(env2.getModules());
	mergedEnv.modules = modules;

	// merge catalogs
	final Map<String, CatalogEntry> catalogs = new HashMap<>(env1.getCatalogs());
	catalogs.putAll(env2.getCatalogs());
	mergedEnv.catalogs = catalogs;

	// merge tables
	final Map<String, TableEntry> tables = new LinkedHashMap<>(env1.getTables());
	tables.putAll(env2.getTables());
	mergedEnv.tables = tables;

	// merge functions
	final Map<String, FunctionEntry> functions = new HashMap<>(env1.getFunctions());
	functions.putAll(env2.getFunctions());
	mergedEnv.functions = functions;

	// merge execution properties
	mergedEnv.execution = ExecutionEntry.merge(env1.getExecution(), env2.getExecution());

	// merge configuration properties
	mergedEnv.configuration = ConfigurationEntry.merge(env1.getConfiguration(), env2.getConfiguration());

	// merge deployment properties
	mergedEnv.deployment = DeploymentEntry.merge(env1.getDeployment(), env2.getDeployment());

	return mergedEnv;
}
 
Example #6
Source File: Environment.java    From flink with Apache License 2.0 5 votes vote down vote up
public Environment() {
	this.modules = new LinkedHashMap<>();
	this.catalogs = Collections.emptyMap();
	this.tables = Collections.emptyMap();
	this.functions = Collections.emptyMap();
	this.execution = ExecutionEntry.DEFAULT_INSTANCE;
	this.configuration = ConfigurationEntry.DEFAULT_INSTANCE;
	this.deployment = DeploymentEntry.DEFAULT_INSTANCE;
}
 
Example #7
Source File: Environment.java    From flink with Apache License 2.0 5 votes vote down vote up
public Environment() {
	this.catalogs = Collections.emptyMap();
	this.tables = Collections.emptyMap();
	this.functions = Collections.emptyMap();
	this.execution = ExecutionEntry.DEFAULT_INSTANCE;
	this.configuration = ConfigurationEntry.DEFAULT_INSTANCE;
	this.deployment = DeploymentEntry.DEFAULT_INSTANCE;
}
 
Example #8
Source File: Environment.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Merges two environments. The properties of the first environment might be overwritten by the second one.
 */
public static Environment merge(Environment env1, Environment env2) {
	final Environment mergedEnv = new Environment();

	// merge catalogs
	final Map<String, CatalogEntry> catalogs = new HashMap<>(env1.getCatalogs());
	catalogs.putAll(env2.getCatalogs());
	mergedEnv.catalogs = catalogs;

	// merge tables
	final Map<String, TableEntry> tables = new LinkedHashMap<>(env1.getTables());
	tables.putAll(env2.getTables());
	mergedEnv.tables = tables;

	// merge functions
	final Map<String, FunctionEntry> functions = new HashMap<>(env1.getFunctions());
	functions.putAll(env2.getFunctions());
	mergedEnv.functions = functions;

	// merge execution properties
	mergedEnv.execution = ExecutionEntry.merge(env1.getExecution(), env2.getExecution());

	// merge configuration properties
	mergedEnv.configuration = ConfigurationEntry.merge(env1.getConfiguration(), env2.getConfiguration());

	// merge deployment properties
	mergedEnv.deployment = DeploymentEntry.merge(env1.getDeployment(), env2.getDeployment());

	return mergedEnv;
}
 
Example #9
Source File: Environment.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Enriches an environment with new/modified properties or views and returns the new instance.
 */
public static Environment enrich(
		Environment env,
		Map<String, String> properties,
		Map<String, ViewEntry> views) {
	final Environment enrichedEnv = new Environment();

	// merge catalogs
	enrichedEnv.catalogs = new LinkedHashMap<>(env.getCatalogs());

	// merge tables
	enrichedEnv.tables = new LinkedHashMap<>(env.getTables());
	enrichedEnv.tables.putAll(views);

	// merge functions
	enrichedEnv.functions = new HashMap<>(env.getFunctions());

	// enrich execution properties
	enrichedEnv.execution = ExecutionEntry.enrich(env.execution, properties);

	// enrich configuration properties
	enrichedEnv.configuration = ConfigurationEntry.enrich(env.configuration, properties);

	// enrich deployment properties
	enrichedEnv.deployment = DeploymentEntry.enrich(env.deployment, properties);

	return enrichedEnv;
}
 
Example #10
Source File: Environment.java    From flink with Apache License 2.0 4 votes vote down vote up
public ExecutionEntry getExecution() {
	return execution;
}
 
Example #11
Source File: LocalExecutorITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Parameters(name = "Planner: {0}")
public static List<String> planner() {
	return Arrays.asList(
		ExecutionEntry.EXECUTION_PLANNER_VALUE_OLD,
		ExecutionEntry.EXECUTION_PLANNER_VALUE_BLINK);
}
 
Example #12
Source File: Environment.java    From flink with Apache License 2.0 4 votes vote down vote up
public ExecutionEntry getExecution() {
	return execution;
}
 
Example #13
Source File: Environment.java    From flink with Apache License 2.0 4 votes vote down vote up
public void setExecution(Map<String, Object> config) {
	this.execution = ExecutionEntry.create(config);
}
 
Example #14
Source File: LocalExecutorITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Parameters(name = "Planner: {0}")
public static List<String> planner() {
	return Arrays.asList(
		ExecutionEntry.EXECUTION_PLANNER_VALUE_OLD,
		ExecutionEntry.EXECUTION_PLANNER_VALUE_BLINK);
}
 
Example #15
Source File: Environment.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public Environment() {
	this.tables = Collections.emptyMap();
	this.functions = Collections.emptyMap();
	this.execution = ExecutionEntry.DEFAULT_INSTANCE;
	this.deployment = DeploymentEntry.DEFAULT_INSTANCE;
}
 
Example #16
Source File: Environment.java    From flink with Apache License 2.0 4 votes vote down vote up
public void setExecution(Map<String, Object> config) {
	this.execution = ExecutionEntry.create(config);
}
 
Example #17
Source File: SessionContext.java    From flink with Apache License 2.0 4 votes vote down vote up
public void setCurrentDatabase(String currentDatabase) {
	checkArgument(!StringUtils.isNullOrWhitespaceOnly(currentDatabase));

	sessionProperties.put(ExecutionEntry.EXECUTION_CURRENT_DATABASE, currentDatabase);
}
 
Example #18
Source File: SessionContext.java    From flink with Apache License 2.0 4 votes vote down vote up
public Optional<String> getCurrentDatabase() {
	return Optional.ofNullable(sessionProperties.get(ExecutionEntry.EXECUTION_CURRENT_DATABASE));
}
 
Example #19
Source File: SessionContext.java    From flink with Apache License 2.0 4 votes vote down vote up
public void setCurrentCatalog(String currentCatalog) {
	checkArgument(!StringUtils.isNullOrWhitespaceOnly(currentCatalog));

	sessionProperties.put(ExecutionEntry.EXECUTION_CURRENT_CATALOG, currentCatalog);
}
 
Example #20
Source File: SessionContext.java    From flink with Apache License 2.0 4 votes vote down vote up
public Optional<String> getCurrentCatalog() {
	return Optional.ofNullable(sessionProperties.get(ExecutionEntry.EXECUTION_CURRENT_CATALOG));
}
 
Example #21
Source File: Environment.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public ExecutionEntry getExecution() {
	return execution;
}
 
Example #22
Source File: Environment.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public void setExecution(Map<String, Object> config) {
	this.execution = ExecutionEntry.create(config);
}