Vitor Leal
07/31/2023, 3:52 PMMartijn Visser
07/31/2023, 3:53 PMMartijn Visser
07/31/2023, 3:54 PMVitor Leal
07/31/2023, 3:56 PMCREATE TABLE table1 (
...
) WITH (
'connector' = 'kafka',
'topic' = 'topic1',
'properties.bootstrap.servers' = 'localhost:9092',
'properties.group.id' = 'testGroup',
'scan.startup.mode' = 'earliest-offset',
'format' = 'csv'
);
CREATE TABLE table2 (
...
) WITH (
'connector' = 'kafka',
'topic' = 'topic2',
'properties.bootstrap.servers' = 'localhost:9092',
'properties.group.id' = 'testGroup',
'scan.startup.mode' = 'earliest-offset',
'format' = 'csv'
);
and I then submit a job that uses both tables to compute something, then will I end up with one consumer?Vitor Leal
07/31/2023, 4:00 PMsap1ens
07/31/2023, 4:01 PMWith the Datastreams API, as far as I know, I can create a single Kafka source that reads N topics, and then split the messages received using OutputTags. It’s a bit more work. I was wondering if the Table API sort of does that already.No, you’ll end up with N consumers. You can only optimize it by resorting to the DataStream API, splitting messages and converting individual streams to tables.
Vitor Leal
07/31/2023, 4:01 PMVitor Leal
07/31/2023, 4:03 PMsap1ens
07/31/2023, 4:04 PMDavid Anderson
07/31/2023, 5:13 PMVitor Leal
07/31/2023, 5:14 PMVitor Leal
07/31/2023, 5:14 PMVitor Leal
07/31/2023, 5:17 PMvariant column (not sure if something like this exists in Flink) and then create views, filtering by nameVitor Leal
07/31/2023, 5:19 PMCREATE TABLE alltopics (
name STRING,
data VARIANT
) WITH (
'connector' = 'kafka',
'topic.list' = 'topic1,topic2',
'properties.bootstrap.servers' = 'localhost:9092',
'properties.group.id' = 'testGroup',
'scan.startup.mode' = 'earliest-offset',
'format' = 'json'
);
CREATE VIEW table1 AS SELECT data->field1, data->field2 FROM alltopics WHERE name = 'table1';
CREATE VIEW table2 AS SELECT data->field1, data->field2 FROM alltopics WHERE name = 'table2';Vitor Leal
07/31/2023, 5:20 PMVitor Leal
07/31/2023, 5:23 PMJSON_VALUE though.David Anderson
07/31/2023, 5:54 PM