Java Code Examples for org.apache.flink.table.factories.TableFactoryService#find()

The following examples show how to use org.apache.flink.table.factories.TableFactoryService#find() . 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: ElasticsearchUpsertTableSinkFactoryBase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private SerializationSchema<Row> getSerializationSchema(Map<String, String> properties) {
	final String formatType = properties.get(FORMAT_TYPE);
	// we could have added this check to the table factory context
	// but this approach allows to throw more helpful error messages
	// if the supported format has not been added
	if (formatType == null || !formatType.equals(SUPPORTED_FORMAT_TYPE)) {
		throw new ValidationException(
			"The Elasticsearch sink requires a '" + SUPPORTED_FORMAT_TYPE + "' format.");
	}

	@SuppressWarnings("unchecked")
	final SerializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		SerializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createSerializationSchema(properties);
}
 
Example 2
Source File: ElasticsearchUpsertTableSinkFactoryBase.java    From flink with Apache License 2.0 6 votes vote down vote up
private SerializationSchema<Row> getSerializationSchema(Map<String, String> properties) {
	final String formatType = properties.get(FORMAT_TYPE);
	// we could have added this check to the table factory context
	// but this approach allows to throw more helpful error messages
	// if the supported format has not been added
	if (formatType == null || !formatType.equals(SUPPORTED_FORMAT_TYPE)) {
		throw new ValidationException(
			"The Elasticsearch sink requires a '" + SUPPORTED_FORMAT_TYPE + "' format.");
	}

	@SuppressWarnings("unchecked")
	final SerializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		SerializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createSerializationSchema(properties);
}
 
Example 3
Source File: ElasticsearchUpsertTableSinkFactoryBase.java    From flink with Apache License 2.0 6 votes vote down vote up
private SerializationSchema<Row> getSerializationSchema(Map<String, String> properties) {
	final String formatType = properties.get(FORMAT_TYPE);
	// we could have added this check to the table factory context
	// but this approach allows to throw more helpful error messages
	// if the supported format has not been added
	if (formatType == null || !formatType.equals(SUPPORTED_FORMAT_TYPE)) {
		throw new ValidationException(
			"The Elasticsearch sink requires a '" + SUPPORTED_FORMAT_TYPE + "' format.");
	}

	@SuppressWarnings("unchecked")
	final SerializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		SerializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createSerializationSchema(properties);
}
 
Example 4
Source File: KafkaTableSourceSinkFactoryBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private DeserializationSchema<Row> getDeserializationSchema(Map<String, String> properties) {
	@SuppressWarnings("unchecked")
	final DeserializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		DeserializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createDeserializationSchema(properties);
}
 
Example 5
Source File: KafkaTableSourceSinkFactoryBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private SerializationSchema<Row> getSerializationSchema(Map<String, String> properties) {
	@SuppressWarnings("unchecked")
	final SerializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		SerializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createSerializationSchema(properties);
}
 
Example 6
Source File: KafkaTableSourceSinkFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
private DeserializationSchema<Row> getDeserializationSchema(Map<String, String> properties) {
	@SuppressWarnings("unchecked")
	final DeserializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		DeserializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createDeserializationSchema(properties);
}
 
Example 7
Source File: KafkaTableSourceSinkFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
private SerializationSchema<Row> getSerializationSchema(Map<String, String> properties) {
	@SuppressWarnings("unchecked")
	final SerializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		SerializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createSerializationSchema(properties);
}
 
Example 8
Source File: FlinkPravegaTableFactoryBase.java    From flink-connectors with Apache License 2.0 5 votes vote down vote up
protected SerializationSchema<Row> getSerializationSchema(Map<String, String> properties) {
    @SuppressWarnings("unchecked")
    final SerializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
            SerializationSchemaFactory.class,
            properties,
            this.getClass().getClassLoader());
    return formatFactory.createSerializationSchema(properties);
}
 
Example 9
Source File: FlinkPravegaTableFactoryBase.java    From flink-connectors with Apache License 2.0 5 votes vote down vote up
protected DeserializationSchema<Row> getDeserializationSchema(Map<String, String> properties) {
    @SuppressWarnings("unchecked")
    final DeserializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
            DeserializationSchemaFactory.class,
            properties,
            this.getClass().getClassLoader());
    return formatFactory.createDeserializationSchema(properties);
}
 
Example 10
Source File: KafkaTableSourceSinkFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
private DeserializationSchema<Row> getDeserializationSchema(Map<String, String> properties) {
	@SuppressWarnings("unchecked")
	final DeserializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		DeserializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createDeserializationSchema(properties);
}
 
Example 11
Source File: KafkaTableSourceSinkFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
private SerializationSchema<Row> getSerializationSchema(Map<String, String> properties) {
	@SuppressWarnings("unchecked")
	final SerializationSchemaFactory<Row> formatFactory = TableFactoryService.find(
		SerializationSchemaFactory.class,
		properties,
		this.getClass().getClassLoader());
	return formatFactory.createSerializationSchema(properties);
}
 
Example 12
Source File: SqlToOperationConverter.java    From flink with Apache License 2.0 5 votes vote down vote up
/** Convert CREATE CATALOG statement. */
private Operation convertCreateCatalog(SqlCreateCatalog sqlCreateCatalog) {
	String catalogName = sqlCreateCatalog.catalogName();

	// set with properties
	Map<String, String> properties = new HashMap<>();
	sqlCreateCatalog.getPropertyList().getList().forEach(p ->
		properties.put(((SqlTableOption) p).getKeyString(), ((SqlTableOption) p).getValueString()));

	final CatalogFactory factory =
		TableFactoryService.find(CatalogFactory.class, properties, this.getClass().getClassLoader());

	Catalog catalog = factory.createCatalog(catalogName, properties);
	return new CreateCatalogOperation(catalogName, catalog);
}
 
Example 13
Source File: ExecutionContext.java    From flink with Apache License 2.0 4 votes vote down vote up
private Catalog createCatalog(String name, Map<String, String> catalogProperties, ClassLoader classLoader) {
	final CatalogFactory factory =
		TableFactoryService.find(CatalogFactory.class, catalogProperties, classLoader);
	return factory.createCatalog(name, catalogProperties);
}
 
Example 14
Source File: ExecutionContext.java    From flink with Apache License 2.0 4 votes vote down vote up
private Module createModule(Map<String, String> moduleProperties, ClassLoader classLoader) {
	final ModuleFactory factory =
		TableFactoryService.find(ModuleFactory.class, moduleProperties, classLoader);
	return factory.createModule(moduleProperties);
}
 
Example 15
Source File: ExecutionContext.java    From flink with Apache License 2.0 4 votes vote down vote up
private Catalog createCatalog(String name, Map<String, String> catalogProperties, ClassLoader classLoader) {
	final CatalogFactory factory =
		TableFactoryService.find(CatalogFactory.class, catalogProperties, classLoader);
	return factory.createCatalog(name, catalogProperties);
}