Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status

Current state:  [One of "Under Discussion", "Accepted", "Rejected"] Under discussion

Discussion thread: here (<- link to https://mail-archives.apache.org/mod_mbox/flink-dev/)

JIRA: here (<- link to https: //issues.apache.org/jira/browse/FLINK-XXXX)

Released: <Flink Version>

...

Often users need to adjust

Public Interfaces

Briefly list any new interfaces that will be introduced as part of this proposal or any existing interfaces that will be removed or changed. The purpose of this section is to concisely call out the public contract that will come along with this feature.

A public interface is any change to the following:

...

Binary log format

...

The network protocol and api behavior

...

Any class in the public packages under clientsConfiguration, especially client configuration

  • org/apache/kafka/common/serialization

  • org/apache/kafka/common

  • org/apache/kafka/common/errors

  • org/apache/kafka/clients/producer

  • org/apache/kafka/clients/consumer (eventually, once stable)

...

Monitoring

...

Command line tools and arguments

...

existing tables slightly. This is especially useful when users need to enhance a table created from an external tool (e.g. HIVE) with Flink's specific information such as e.g watermarks. It can also be a useful tool for ETL processes, e.g. merging two tables into a single one with a different connector.  My suggestion would be to support an optional Feature T171, “LIKE clause in table definition” of SQL standard 2008.

Proposed Changes

I suggest introducing a LIKE clause with a following syntax:

...

The supported combinations would be:


INCLUDINGEXCLUDINGOVERWRITING
ALL(tick)(tick)(error)
CONSTRAINTS(tick)(tick)(error)
GENERATED(tick)(tick)(tick)
OPTIONS(tick)(tick)(tick)

The reason why I suggest not to support OVERWRITING CONSTRAINTS is that usually it's rather hard to overwrite only some of the constraints. If the constraint(primary key, unique key) from the base table does not apply to the derived table, in my opinion it is safer to exclude all constraints and redefine them.  We could revisit that in the future, if we see a need to support also OVERWRITING for constraints.

...

Code Block
languagesql
CREATE [TEMPORARY] TABLE base_table_1 (
    id BIGINT,
    name STRING,
	PRIMARY KEY(id)
) WITH (
    ‘connector’: ‘kafka’,
    ‘connector.starting-offset’: ‘12345’,
    ‘format’: ‘json’
)

CREATE [TEMPORARY] TABLE base_table_2 (
    tstmp TIMESTAMP,
	PRIMARY KEY(tstmp)
) WITH (
    ‘connector’: ‘filesystem’,
    ‘format’: ‘csv’,
    ‘format.delimiter’: ‘\t’   
)

CREATE [TEMPORARY] TABLE derived_table (
    LIKE base_table_1 (
		OVERWRITING SOURCE_OPTIONS),
    LIKE base_table_2 (
		EXCLUDING SOURCE_OPTIONS, 
		EXCLUDING CONSTRAINTS),
    WATERMARK FOR tstmp AS tsmp - INTERVAL '5' SECOND
) WITH (
    ‘connector.starting-offset’: ‘0’
)

...

Code Block
languagesql
CREATE [TEMPORARY] TABLE derived_table (
    id BIGINT,
    name STRING,
	tstmp TIMESTAMP,
    WATERMARK FOR tstmp AS tsmp - INTERVAL '5' SECOND,
    PRIMARY KEY(id)
) WITH (
    ‘connector’: ‘kafka’,
    ‘connector.starting-offset’: ‘0’,
    ‘format’: ‘json’
)

Support in Table API

Support of that feature in Table API will require a separate FLIP, as we the connect API requires a rework anyway.

Compatibility, Deprecation, and Migration Plan

  • What impact (if any) will there be on existing users?
  • If we are changing behavior how will we phase out the older behavior?
  • If we need special migration tools, describe them here.
  • When will we remove the existing behavior?

Test Plan

Describe in few sentences how the FLIP will be tested. We are mostly interested in system tests (since unit-tests are specific to implementation details). How will we know that the implementation works as expected? How will we know nothing broke?

Rejected Alternatives

...

It is a new feature with no implication for backwards compatibility.

Rejected Alternatives