org.apache.flink.configuration.DelegatingConfiguration Java Examples

The following examples show how to use org.apache.flink.configuration.DelegatingConfiguration. 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: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
private void setTypeComparatorFactory(TypeComparatorFactory<?> factory,
		String classNameKey, String parametersPrefix)
{
	// sanity check the factory type
	InstantiationUtil.checkForInstantiation(factory.getClass());
	
	// store the type
	this.config.setString(classNameKey, factory.getClass().getName());
	// store the parameters
	final DelegatingConfiguration parameters = new DelegatingConfiguration(this.config, parametersPrefix);
	factory.writeParametersToConfig(parameters);
}
 
Example #2
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
private void setTypeComparatorFactory(TypeComparatorFactory<?> factory,
		String classNameKey, String parametersPrefix)
{
	// sanity check the factory type
	InstantiationUtil.checkForInstantiation(factory.getClass());
	
	// store the type
	this.config.setString(classNameKey, factory.getClass().getName());
	// store the parameters
	final DelegatingConfiguration parameters = new DelegatingConfiguration(this.config, parametersPrefix);
	factory.writeParametersToConfig(parameters);
}
 
Example #3
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
private void setTypeSerializerFactory(TypeSerializerFactory<?> factory,
		String classNameKey, String parametersPrefix)
{
	// sanity check the factory type
	InstantiationUtil.checkForInstantiation(factory.getClass());
	
	// store the type
	this.config.setString(classNameKey, factory.getClass().getName());
	// store the parameters
	final DelegatingConfiguration parameters = new DelegatingConfiguration(this.config, parametersPrefix);
	factory.writeParametersToConfig(parameters);
}
 
Example #4
Source File: ReporterSetup.java    From flink with Apache License 2.0 5 votes vote down vote up
private static List<Tuple2<String, Configuration>> loadReporterConfigurations(Configuration configuration, Set<String> namedReporters) {
	final List<Tuple2<String, Configuration>> reporterConfigurations = new ArrayList<>(namedReporters.size());

	for (String namedReporter: namedReporters) {
		DelegatingConfiguration delegatingConfiguration = new DelegatingConfiguration(
			configuration,
			ConfigConstants.METRICS_REPORTER_PREFIX + namedReporter + '.');

		reporterConfigurations.add(Tuple2.of(namedReporter, delegatingConfiguration));
	}
	return reporterConfigurations;
}
 
Example #5
Source File: FileSystemTableSink.java    From flink with Apache License 2.0 5 votes vote down vote up
private Object createWriter() {
	FileSystemFormatFactory formatFactory = createFormatFactory(properties);
	Configuration conf = new Configuration();
	properties.forEach(conf::setString);

	FileSystemFormatFactory.WriterContext context = new FileSystemFormatFactory.WriterContext() {

		@Override
		public TableSchema getSchema() {
			return schema;
		}

		@Override
		public ReadableConfig getFormatOptions() {
			return new DelegatingConfiguration(conf, formatFactory.factoryIdentifier() + ".");
		}

		@Override
		public List<String> getPartitionKeys() {
			return partitionKeys;
		}
	};

	Optional<Encoder<RowData>> encoder = formatFactory.createEncoder(context);
	Optional<BulkWriter.Factory<RowData>> bulk = formatFactory.createBulkWriterFactory(context);

	if (encoder.isPresent()) {
		return encoder.get();
	} else if (bulk.isPresent()) {
		return bulk.get();
	} else {
		throw new TableException(
				formatFactory + " format should implement at least one Encoder or BulkWriter");
	}
}
 
Example #6
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
private void setTypeSerializerFactory(TypeSerializerFactory<?> factory,
		String classNameKey, String parametersPrefix)
{
	// sanity check the factory type
	InstantiationUtil.checkForInstantiation(factory.getClass());
	
	// store the type
	this.config.setString(classNameKey, factory.getClass().getName());
	// store the parameters
	final DelegatingConfiguration parameters = new DelegatingConfiguration(this.config, parametersPrefix);
	factory.writeParametersToConfig(parameters);
}
 
Example #7
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void setTypeComparatorFactory(TypeComparatorFactory<?> factory,
		String classNameKey, String parametersPrefix)
{
	// sanity check the factory type
	InstantiationUtil.checkForInstantiation(factory.getClass());
	
	// store the type
	this.config.setString(classNameKey, factory.getClass().getName());
	// store the parameters
	final DelegatingConfiguration parameters = new DelegatingConfiguration(this.config, parametersPrefix);
	factory.writeParametersToConfig(parameters);
}
 
Example #8
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void setTypeSerializerFactory(TypeSerializerFactory<?> factory,
		String classNameKey, String parametersPrefix)
{
	// sanity check the factory type
	InstantiationUtil.checkForInstantiation(factory.getClass());
	
	// store the type
	this.config.setString(classNameKey, factory.getClass().getName());
	// store the parameters
	final DelegatingConfiguration parameters = new DelegatingConfiguration(this.config, parametersPrefix);
	factory.writeParametersToConfig(parameters);
}
 
Example #9
Source File: TaskConfig.java    From flink with Apache License 2.0 4 votes vote down vote up
public Configuration getStubParameters() {
	return new DelegatingConfiguration(this.config, STUB_PARAM_PREFIX);
}
 
Example #10
Source File: TaskConfig.java    From flink with Apache License 2.0 4 votes vote down vote up
public TaskConfig getChainedStubConfig(int chainPos) {
	return new TaskConfig(new DelegatingConfiguration(this.config, CHAINING_TASKCONFIG_PREFIX + chainPos + SEPARATOR));
}
 
Example #11
Source File: TaskConfig.java    From flink with Apache License 2.0 4 votes vote down vote up
public TaskConfig getIterationHeadFinalOutputConfig() {
	return new TaskConfig(new DelegatingConfiguration(this.config, ITERATION_HEAD_FINAL_OUT_CONFIG_PREFIX));
}
 
Example #12
Source File: InputOutputFormatContainer.java    From flink with Apache License 2.0 4 votes vote down vote up
public Configuration getParameters(OperatorID operatorId) {
	return new DelegatingConfiguration(parameters, getParamKeyPrefix(operatorId));
}
 
Example #13
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public Configuration getStubParameters() {
	return new DelegatingConfiguration(this.config, STUB_PARAM_PREFIX);
}
 
Example #14
Source File: FileSystemTableSource.java    From flink with Apache License 2.0 4 votes vote down vote up
private InputFormat<RowData, ?> getInputFormat() {
	// When this table has no partition, just return a empty source.
	if (!partitionKeys.isEmpty() && getOrFetchPartitions().isEmpty()) {
		return new CollectionInputFormat<>(new ArrayList<>(), null);
	}

	FileSystemFormatFactory formatFactory = createFormatFactory(properties);
	Configuration conf = new Configuration();
	properties.forEach(conf::setString);
	return formatFactory.createReader(new FileSystemFormatFactory.ReaderContext() {

		@Override
		public TableSchema getSchema() {
			return schema;
		}

		@Override
		public ReadableConfig getFormatOptions() {
			return new DelegatingConfiguration(conf, formatFactory.factoryIdentifier() + ".");
		}

		@Override
		public List<String> getPartitionKeys() {
			return partitionKeys;
		}

		@Override
		public String getDefaultPartName() {
			return defaultPartName;
		}

		@Override
		public Path[] getPaths() {
			if (partitionKeys.isEmpty()) {
				return new Path[] {path};
			} else {
				return getOrFetchPartitions().stream()
						.map(FileSystemTableSource.this::toFullLinkedPartSpec)
						.map(PartitionPathUtils::generatePartitionPath)
						.map(n -> new Path(path, n))
						.toArray(Path[]::new);
			}
		}

		@Override
		public int[] getProjectFields() {
			return readFields();
		}

		@Override
		public long getPushedDownLimit() {
			return limit == null ? Long.MAX_VALUE : limit;
		}

		@Override
		public List<Expression> getPushedDownFilters() {
			return filters == null ? Collections.emptyList() : filters;
		}
	});
}
 
Example #15
Source File: FactoryUtil.java    From flink with Apache License 2.0 4 votes vote down vote up
private ReadableConfig projectOptions(String formatPrefix) {
	return new DelegatingConfiguration(
		allOptions,
		formatPrefix);
}
 
Example #16
Source File: InputOutputFormatContainer.java    From flink with Apache License 2.0 4 votes vote down vote up
public Configuration getParameters(OperatorID operatorId) {
	return new DelegatingConfiguration(parameters, getParamKeyPrefix(operatorId));
}
 
Example #17
Source File: TaskConfig.java    From flink with Apache License 2.0 4 votes vote down vote up
public Configuration getStubParameters() {
	return new DelegatingConfiguration(this.config, STUB_PARAM_PREFIX);
}
 
Example #18
Source File: TaskConfig.java    From flink with Apache License 2.0 4 votes vote down vote up
public TaskConfig getChainedStubConfig(int chainPos) {
	return new TaskConfig(new DelegatingConfiguration(this.config, CHAINING_TASKCONFIG_PREFIX + chainPos + SEPARATOR));
}
 
Example #19
Source File: TaskConfig.java    From flink with Apache License 2.0 4 votes vote down vote up
public TaskConfig getIterationHeadFinalOutputConfig() {
	return new TaskConfig(new DelegatingConfiguration(this.config, ITERATION_HEAD_FINAL_OUT_CONFIG_PREFIX));
}
 
Example #20
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public TaskConfig getIterationHeadFinalOutputConfig() {
	return new TaskConfig(new DelegatingConfiguration(this.config, ITERATION_HEAD_FINAL_OUT_CONFIG_PREFIX));
}
 
Example #21
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public TaskConfig getChainedStubConfig(int chainPos) {
	return new TaskConfig(new DelegatingConfiguration(this.config, CHAINING_TASKCONFIG_PREFIX + chainPos + SEPARATOR));
}