Elakiya created FLINK-33425:
-------------------------------

             Summary: Flink SQL doesn't support a inline field in struct type 
as primary key
                 Key: FLINK-33425
                 URL: https://issues.apache.org/jira/browse/FLINK-33425
             Project: Flink
          Issue Type: New Feature
          Components: Table SQL / API
    Affects Versions: 1.16.2
            Reporter: Elakiya


I have a Kafka topic named employee which uses confluent avro schema and will 
emit the payload as below:

{
"employee": {
"id": "123456",
"name": "sampleName"
}
}
I am using the upsert-kafka connector to consume the events from the above 
Kafka topic as below using the Flink SQL DDL statement, also here I want to use 
the id field as the Primary key. But I am unable to use the id field since it 
is inside the object and currently Flink doesn't support this feature. I am 
using Apache Flink 16.2 and its dependent versions

DDL Statement:
String statement = "CREATE TABLE Employee (\r\n" +
"  employee  ROW(id STRING, name STRING\r\n" +
"  ),\r\n" +
"  PRIMARY KEY ([employee.id|http://employee.id/]) NOT ENFORCED\r\n" +
") WITH (\r\n" +
"  'connector' = 'upsert-kafka',\r\n" +
"  'topic' = 'employee',\r\n" +
"  'properties.bootstrap.servers' = 'kafka-cp-kafka:9092',\r\n" +
"  'key.format' = 'raw',\r\n" +
"  'value.format' = 'avro-confluent',\r\n" +
"  'value.avro-confluent.url' = 
'[http://kafka-cp-schema-registry:8081|http://kafka-cp-schema-registry:8081/]',\r\n"
 +
")";
A new feature to use the property of a Row datatype (in this case employee.id) 
as a primary key  would be helpful in many scenarios.
Let me know if more details are required.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to