[ 
https://issues.apache.org/jira/browse/FLINK-24050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ingo Bürk updated FLINK-24050:
------------------------------
    Description: 
Currently, primary keys are required to consist solely of physical columns. 
However, there might be scenarios where the actual payload/records do not 
contain a suitable primary key, but a unique identifier is available through 
metadata. In this case it would make sense to define the primary key on such a 
metadata column:
{code:java}
CREATE TABLE T (
  uid STRING METADATA,
  content STRING
  PRIMARY KEY (uid) NOT ENFORCED
) WITH (…)
{code}
A simple example for this would be IMAP: there is nothing unique about any 
single email as a record, but each email in a specific folder on an IMAP server 
has a unique UID (I'm excluding some irrelevant technical details here).

  was:
Currently, primary keys are required to consist solely of physical columns. 
However, there might be scenarios where the actual payload/records do not 
contain a suitable primary key, but a unique identifier is available through 
metadata. In this case it would make sense to define the primary key on such a 
metadata column:
{code:java}
CREATE TABLE T (
  uid METADATA,
  content STRING
  PRIMARY KEY (uid) NOT ENFORCED
) WITH (…)
{code}
A simple example for this would be IMAP: there is nothing unique about any 
single email as a record, but each email in a specific folder on an IMAP server 
has a unique UID (I'm excluding some irrelevant technical details here).


> Support primary keys on metadata columns
> ----------------------------------------
>
>                 Key: FLINK-24050
>                 URL: https://issues.apache.org/jira/browse/FLINK-24050
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / API
>            Reporter: Ingo Bürk
>            Priority: Major
>
> Currently, primary keys are required to consist solely of physical columns. 
> However, there might be scenarios where the actual payload/records do not 
> contain a suitable primary key, but a unique identifier is available through 
> metadata. In this case it would make sense to define the primary key on such 
> a metadata column:
> {code:java}
> CREATE TABLE T (
>   uid STRING METADATA,
>   content STRING
>   PRIMARY KEY (uid) NOT ENFORCED
> ) WITH (…)
> {code}
> A simple example for this would be IMAP: there is nothing unique about any 
> single email as a record, but each email in a specific folder on an IMAP 
> server has a unique UID (I'm excluding some irrelevant technical details 
> here).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to