Java Code Examples for org.apache.flink.table.utils.TableSchemaUtils#checkNoGeneratedColumns()

The following examples show how to use org.apache.flink.table.utils.TableSchemaUtils#checkNoGeneratedColumns() . 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: KafkaTableSourceBase.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a generic Kafka {@link StreamTableSource}.
 *
 * @param schema                      Schema of the produced table.
 * @param proctimeAttribute           Field name of the processing time attribute.
 * @param rowtimeAttributeDescriptors Descriptor for a rowtime attribute
 * @param fieldMapping                Mapping for the fields of the table schema to
 *                                    fields of the physical returned type.
 * @param topic                       Kafka topic to consume.
 * @param properties                  Properties for the Kafka consumer.
 * @param deserializationSchema       Deserialization schema for decoding records from Kafka.
 * @param startupMode                 Startup mode for the contained consumer.
 * @param specificStartupOffsets      Specific startup offsets; only relevant when startup
 *                                    mode is {@link StartupMode#SPECIFIC_OFFSETS}.
 * @param startupTimestampMillis	  Startup timestamp for offsets; only relevant when startup
 *                                    mode is {@link StartupMode#TIMESTAMP}.
 */
protected KafkaTableSourceBase(
		TableSchema schema,
		Optional<String> proctimeAttribute,
		List<RowtimeAttributeDescriptor> rowtimeAttributeDescriptors,
		Optional<Map<String, String>> fieldMapping,
		String topic,
		Properties properties,
		DeserializationSchema<Row> deserializationSchema,
		StartupMode startupMode,
		Map<KafkaTopicPartition, Long> specificStartupOffsets,
		long startupTimestampMillis) {
	this.schema = TableSchemaUtils.checkNoGeneratedColumns(schema);
	this.proctimeAttribute = validateProctimeAttribute(proctimeAttribute);
	this.rowtimeAttributeDescriptors = validateRowtimeAttributeDescriptors(rowtimeAttributeDescriptors);
	this.fieldMapping = fieldMapping;
	this.topic = Preconditions.checkNotNull(topic, "Topic must not be null.");
	this.properties = Preconditions.checkNotNull(properties, "Properties must not be null.");
	this.deserializationSchema = Preconditions.checkNotNull(
		deserializationSchema, "Deserialization schema must not be null.");
	this.startupMode = Preconditions.checkNotNull(startupMode, "Startup mode must not be null.");
	this.specificStartupOffsets = Preconditions.checkNotNull(
		specificStartupOffsets, "Specific offsets must not be null.");
	this.startupTimestampMillis = startupTimestampMillis;
}
 
Example 2
Source File: FlinkPravegaTableSource.java    From flink-connectors with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Pravega {@link TableSource}.
 * @param sourceFunctionFactory a factory for the {@link FlinkPravegaReader} to implement {@link StreamTableSource}
 * @param inputFormatFactory a factory for the {@link FlinkPravegaInputFormat} to implement {@link BatchTableSource}
 * @param schema the table schema
 */
protected FlinkPravegaTableSource(
        Supplier<FlinkPravegaReader<Row>> sourceFunctionFactory,
        Supplier<FlinkPravegaInputFormat<Row>> inputFormatFactory,
        TableSchema schema) {
    this.sourceFunctionFactory = checkNotNull(sourceFunctionFactory, "sourceFunctionFactory");
    this.inputFormatFactory = checkNotNull(inputFormatFactory, "inputFormatFactory");
    this.schema = TableSchemaUtils.checkNoGeneratedColumns(schema);
}
 
Example 3
Source File: JdbcUpsertTableSink.java    From flink with Apache License 2.0 5 votes vote down vote up
private JdbcUpsertTableSink(
		TableSchema schema,
		JdbcOptions options,
		int flushMaxSize,
		long flushIntervalMills,
		int maxRetryTime) {
	this.schema = TableSchemaUtils.checkNoGeneratedColumns(schema);
	this.options = options;
	this.flushMaxSize = flushMaxSize;
	this.flushIntervalMills = flushIntervalMills;
	this.maxRetryTime = maxRetryTime;
}
 
Example 4
Source File: ElasticsearchUpsertTableSinkBase.java    From flink with Apache License 2.0 5 votes vote down vote up
public ElasticsearchUpsertTableSinkBase(
		boolean isAppendOnly,
		TableSchema schema,
		List<Host> hosts,
		String index,
		String docType,
		String keyDelimiter,
		String keyNullLiteral,
		SerializationSchema<Row> serializationSchema,
		XContentType contentType,
		ActionRequestFailureHandler failureHandler,
		Map<SinkOption, String> sinkOptions,
		RequestFactory requestFactory) {

	this.isAppendOnly = isAppendOnly;
	this.schema = TableSchemaUtils.checkNoGeneratedColumns(schema);
	this.hosts = Preconditions.checkNotNull(hosts);
	this.index = Preconditions.checkNotNull(index);
	this.keyDelimiter = Preconditions.checkNotNull(keyDelimiter);
	this.keyNullLiteral = Preconditions.checkNotNull(keyNullLiteral);
	this.docType = Preconditions.checkNotNull(docType);
	this.serializationSchema = Preconditions.checkNotNull(serializationSchema);
	this.contentType = Preconditions.checkNotNull(contentType);
	this.failureHandler = Preconditions.checkNotNull(failureHandler);
	this.sinkOptions = Preconditions.checkNotNull(sinkOptions);
	this.requestFactory = Preconditions.checkNotNull(requestFactory);
}
 
Example 5
Source File: KafkaTableSinkBase.java    From flink with Apache License 2.0 5 votes vote down vote up
protected KafkaTableSinkBase(
		TableSchema schema,
		String topic,
		Properties properties,
		Optional<FlinkKafkaPartitioner<Row>> partitioner,
		SerializationSchema<Row> serializationSchema) {
	this.schema = TableSchemaUtils.checkNoGeneratedColumns(schema);
	this.topic = Preconditions.checkNotNull(topic, "Topic must not be null.");
	this.properties = Preconditions.checkNotNull(properties, "Properties must not be null.");
	this.partitioner = Preconditions.checkNotNull(partitioner, "Partitioner must not be null.");
	this.serializationSchema = Preconditions.checkNotNull(serializationSchema, "Serialization schema must not be null.");
}
 
Example 6
Source File: CollectStreamTableSink.java    From flink with Apache License 2.0 5 votes vote down vote up
public CollectStreamTableSink(
		InetAddress targetAddress,
		int targetPort,
		TypeSerializer<Tuple2<Boolean, Row>> serializer,
		TableSchema tableSchema) {
	this.targetAddress = targetAddress;
	this.targetPort = targetPort;
	this.serializer = serializer;
	this.tableSchema = TableSchemaUtils.checkNoGeneratedColumns(tableSchema);
}
 
Example 7
Source File: CollectBatchTableSink.java    From flink with Apache License 2.0 4 votes vote down vote up
public CollectBatchTableSink(String accumulatorName, TypeSerializer<Row> serializer, TableSchema tableSchema) {
	this.accumulatorName = accumulatorName;
	this.serializer = serializer;
	this.tableSchema = TableSchemaUtils.checkNoGeneratedColumns(tableSchema);
}
 
Example 8
Source File: TestTableSourceFactoryBase.java    From flink with Apache License 2.0 4 votes vote down vote up
public TestTableSource(TableSchema schema, String property, String proctime, List<RowtimeAttributeDescriptor> rowtime) {
	this.schema = TableSchemaUtils.checkNoGeneratedColumns(schema);
	this.property = property;
	this.proctime = proctime;
	this.rowtime = rowtime;
}
 
Example 9
Source File: TestTableSinkFactoryBase.java    From flink with Apache License 2.0 4 votes vote down vote up
public TestTableSink(TableSchema schema, String property) {
	this.schema = TableSchemaUtils.checkNoGeneratedColumns(schema);
	this.property = property;
}
 
Example 10
Source File: FlinkPravegaTableSink.java    From flink-connectors with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a Pravega {@link AppendStreamTableSink}.
 *
 * <p>Each row is written to a Pravega stream with a routing key based on the {@code routingKeyFieldName}.
 * The specified field must of type {@code STRING}.
 *
 * @param writerFactory                A factory for the stream writer.
 * @param outputFormatFactory          A factory for the output format.
 * @param schema                       The table schema of the sink.
 */
protected FlinkPravegaTableSink(Function<TableSchema, FlinkPravegaWriter<Row>> writerFactory,
                                Function<TableSchema, FlinkPravegaOutputFormat<Row>> outputFormatFactory,
                                TableSchema schema) {
    this.writerFactory = Preconditions.checkNotNull(writerFactory, "writerFactory");
    this.outputFormatFactory = Preconditions.checkNotNull(outputFormatFactory, "outputFormatFactory");
    this.schema = TableSchemaUtils.checkNoGeneratedColumns(schema);
}