Versions Compared

Key

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

Status

Current state: Under discussion

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Often users need to adjust 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:

...

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

Configuring behaviour of LIKE:

SQL standard defines a way to configure the behaviour of LIKE clause. SQL standards describes options:

...

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

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

Rejected Alternatives