org.apache.flink.table.descriptors.FormatDescriptorValidator Java Examples

The following examples show how to use org.apache.flink.table.descriptors.FormatDescriptorValidator. 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: TableFormatFactoryBase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public final List<String> supportedProperties() {
	final List<String> properties = new ArrayList<>();
	if (supportsSchemaDerivation) {
		properties.add(FormatDescriptorValidator.FORMAT_DERIVE_SCHEMA);
		// schema
		properties.add(SCHEMA + ".#." + SCHEMA_TYPE);
		properties.add(SCHEMA + ".#." + SCHEMA_NAME);
		properties.add(SCHEMA + ".#." + SCHEMA_FROM);
		// time attributes
		properties.add(SCHEMA + ".#." + SCHEMA_PROCTIME);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_TYPE);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_FROM);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_CLASS);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_SERIALIZED);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_TYPE);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_CLASS);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_SERIALIZED);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_DELAY);
	}
	properties.addAll(supportedFormatProperties());
	return properties;
}
 
Example #2
Source File: TableFactoryService.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Performs filtering for special cases (i.e. table format factories with schema derivation).
 */
private static List<String> filterSupportedPropertiesFactorySpecific(TableFactory factory, List<String> keys) {

	if (factory instanceof TableFormatFactory) {
		boolean includeSchema = ((TableFormatFactory) factory).supportsSchemaDerivation();
		return keys.stream().filter(k -> {
			if (includeSchema) {
				return k.startsWith(Schema.SCHEMA + ".") ||
					k.startsWith(FormatDescriptorValidator.FORMAT + ".");
			} else {
				return k.startsWith(FormatDescriptorValidator.FORMAT + ".");
			}
		}).collect(Collectors.toList());
	} else {
		return keys;
	}
}
 
Example #3
Source File: TableFormatFactoryBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public final List<String> supportedProperties() {
	final List<String> properties = new ArrayList<>();
	if (supportsSchemaDerivation) {
		properties.add(FormatDescriptorValidator.FORMAT_DERIVE_SCHEMA);
		// schema
		properties.add(SCHEMA + ".#." + SCHEMA_TYPE);
		properties.add(SCHEMA + ".#." + SCHEMA_NAME);
		properties.add(SCHEMA + ".#." + SCHEMA_FROM);
		// time attributes
		properties.add(SCHEMA + ".#." + SCHEMA_PROCTIME);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_TYPE);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_FROM);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_CLASS);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_SERIALIZED);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_TYPE);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_CLASS);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_SERIALIZED);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_DELAY);
	}
	properties.addAll(supportedFormatProperties());
	return properties;
}
 
Example #4
Source File: TableFactoryService.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Performs filtering for special cases (i.e. table format factories with schema derivation).
 */
private static List<String> filterSupportedPropertiesFactorySpecific(TableFactory factory, List<String> keys) {

	if (factory instanceof TableFormatFactory) {
		boolean includeSchema = ((TableFormatFactory) factory).supportsSchemaDerivation();
		return keys.stream().filter(k -> {
			if (includeSchema) {
				return k.startsWith(Schema.SCHEMA + ".") ||
					k.startsWith(FormatDescriptorValidator.FORMAT + ".");
			} else {
				return k.startsWith(FormatDescriptorValidator.FORMAT + ".");
			}
		}).collect(Collectors.toList());
	} else {
		return keys;
	}
}
 
Example #5
Source File: CsvTableSinkFactoryBase.java    From flink with Apache License 2.0 6 votes vote down vote up
public List<String> supportedProperties() {
	List<String> properties = new ArrayList<>();
	// connector
	properties.add(CONNECTOR_PATH);
	// format
	properties.add(FORMAT_FIELDS + ".#." + DescriptorProperties.TYPE);
	properties.add(FORMAT_FIELDS + ".#." + DescriptorProperties.DATA_TYPE);
	properties.add(FORMAT_FIELDS + ".#." + DescriptorProperties.NAME);
	properties.add(FormatDescriptorValidator.FORMAT_DERIVE_SCHEMA);
	properties.add(FORMAT_FIELD_DELIMITER);
	properties.add(CONNECTOR_PATH);
	properties.add(FORMAT_WRITE_MODE);
	properties.add(FORMAT_NUM_FILES);

	// schema
	properties.add(SCHEMA + ".#." + DescriptorProperties.TYPE);
	properties.add(SCHEMA + ".#." + DescriptorProperties.DATA_TYPE);
	properties.add(SCHEMA + ".#." + DescriptorProperties.NAME);
	properties.add(SCHEMA + ".#." + DescriptorProperties.EXPR);
	// schema watermark
	properties.add(SCHEMA + "." + DescriptorProperties.WATERMARK + ".*");
	return properties;
}
 
Example #6
Source File: TableFormatFactoryBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public final Map<String, String> requiredContext() {
	final Map<String, String> context = new HashMap<>();
	context.put(FormatDescriptorValidator.FORMAT_TYPE, type);
	context.put(FormatDescriptorValidator.FORMAT_PROPERTY_VERSION, version);
	context.putAll(requiredFormatContext());
	return context;
}
 
Example #7
Source File: TableFormatFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public final Map<String, String> requiredContext() {
	final Map<String, String> context = new HashMap<>();
	context.put(FormatDescriptorValidator.FORMAT_TYPE, type);
	context.put(FormatDescriptorValidator.FORMAT_PROPERTY_VERSION, version);
	context.putAll(requiredFormatContext());
	return context;
}
 
Example #8
Source File: TableFormatFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public final Map<String, String> requiredContext() {
	final Map<String, String> context = new HashMap<>();
	context.put(FormatDescriptorValidator.FORMAT_TYPE, type);
	context.put(FormatDescriptorValidator.FORMAT_PROPERTY_VERSION, version);
	context.putAll(requiredFormatContext());
	return context;
}
 
Example #9
Source File: TableFormatFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public final List<String> supportedProperties() {
	final List<String> properties = new ArrayList<>();
	if (supportsSchemaDerivation) {
		properties.add(FormatDescriptorValidator.FORMAT_DERIVE_SCHEMA);
		// schema
		properties.add(SCHEMA + ".#." + SCHEMA_DATA_TYPE);
		properties.add(SCHEMA + ".#." + SCHEMA_TYPE);
		properties.add(SCHEMA + ".#." + SCHEMA_NAME);
		properties.add(SCHEMA + ".#." + SCHEMA_FROM);
		// computed column
		properties.add(SCHEMA + ".#." + EXPR);
		// time attributes
		properties.add(SCHEMA + ".#." + SCHEMA_PROCTIME);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_TYPE);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_FROM);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_CLASS);
		properties.add(SCHEMA + ".#." + ROWTIME_TIMESTAMPS_SERIALIZED);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_TYPE);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_CLASS);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_SERIALIZED);
		properties.add(SCHEMA + ".#." + ROWTIME_WATERMARKS_DELAY);
		// watermark
		properties.add(SCHEMA + "." + WATERMARK + ".#."  + WATERMARK_ROWTIME);
		properties.add(SCHEMA + "." + WATERMARK + ".#."  + WATERMARK_STRATEGY_EXPR);
		properties.add(SCHEMA + "." + WATERMARK + ".#."  + WATERMARK_STRATEGY_DATA_TYPE);
		// table constraint
		properties.add(SCHEMA + "." + DescriptorProperties.PRIMARY_KEY_NAME);
		properties.add(SCHEMA + "." + DescriptorProperties.PRIMARY_KEY_COLUMNS);
	}
	properties.addAll(supportedFormatProperties());
	return properties;
}
 
Example #10
Source File: CsvTableSourceFactoryBase.java    From flink with Apache License 2.0 5 votes vote down vote up
public List<String> supportedProperties() {
	List<String> properties = new ArrayList<>();
	// connector
	properties.add(CONNECTOR_PATH);
	// format
	properties.add(FORMAT_FIELDS + ".#." + DescriptorProperties.TYPE);
	properties.add(FORMAT_FIELDS + ".#." + DescriptorProperties.DATA_TYPE);
	properties.add(FORMAT_FIELDS + ".#." + DescriptorProperties.NAME);
	properties.add(FormatDescriptorValidator.FORMAT_DERIVE_SCHEMA);
	properties.add(FORMAT_FIELD_DELIMITER);
	properties.add(FORMAT_LINE_DELIMITER);
	properties.add(FORMAT_QUOTE_CHARACTER);
	properties.add(FORMAT_COMMENT_PREFIX);
	properties.add(FORMAT_IGNORE_FIRST_LINE);
	properties.add(FORMAT_IGNORE_PARSE_ERRORS);
	properties.add(CONNECTOR_PATH);
	// schema
	properties.add(SCHEMA + ".#." + DescriptorProperties.TYPE);
	properties.add(SCHEMA + ".#." + DescriptorProperties.DATA_TYPE);
	properties.add(SCHEMA + ".#." + DescriptorProperties.NAME);
	properties.add(SCHEMA + ".#." + DescriptorProperties.EXPR);
	// watermark
	properties.add(SCHEMA + "." + WATERMARK + ".#."  + WATERMARK_ROWTIME);
	properties.add(SCHEMA + "." + WATERMARK + ".#."  + WATERMARK_STRATEGY_EXPR);
	properties.add(SCHEMA + "." + WATERMARK + ".#."  + WATERMARK_STRATEGY_DATA_TYPE);
	// table constraint
	properties.add(SCHEMA + "." + DescriptorProperties.PRIMARY_KEY_NAME);
	properties.add(SCHEMA + "." + DescriptorProperties.PRIMARY_KEY_COLUMNS);

	return properties;
}