Chris Roush
02/01/2024, 4:22 PMROW() to flatten JSON fields as defined here 🧵
CREATE TABLE my_record (
`event` STRING,
`data` ROW(
`id` INT, -- <-- PARTITION BY THIS FIELD
),
proctime PROCTIME()
) WITH (
'connector' = 'kafka',
'topic' = 'my_record_topic',
'properties.bootstrap.servers' = 'my.host.com:443',
'properties.security.protocol' = 'SSL',
'properties.group.id' = 'testGroup',
'scan.startup.mode' = 'earliest-offset',
'sink.parallelism' = '1',
'format' = 'json'
);
SELECT id, proctime FROM (
SELECT
my_record.data.id AS id,
my_record.proctime,
-- For some reason, row number is always 1 for every event message in the topic
ROW_NUMBER() OVER (PARTITION BY my_record.data.id ORDER BY my_record.proctime DESC) AS row_num
FROM
my_record
)
WHERE row_num = 1;Chris Roush
02/01/2024, 4:22 PMdata.value in the results:
{
"data": {
"id": 1,
"value": "foo"
}
}Chris Roush
02/01/2024, 4:23 PMROW_NUMBER() value doesn’t seem to properly partition over the multiple events having data.id = 1, and the resulting row_num is always 1 for each event in the topicChris Roush
02/01/2024, 4:24 PMid in this example?Martijn Visser
02/01/2024, 5:56 PMChris Roush
02/01/2024, 6:18 PMMatan Perelmuter
02/02/2024, 12:46 PMChris Roush
02/02/2024, 3:16 PMtableau output via the flink client gateway:
SET 'sql-client.execution.result-mode' = 'tableau';Matan Perelmuter
02/02/2024, 3:21 PMMatan Perelmuter
02/02/2024, 3:21 PMChris Roush
02/02/2024, 3:26 PMU- and U+ in the +/- column. Not sure what that column represents. The kafka events are sourced from CDC via debeziumMatan Perelmuter
02/02/2024, 3:34 PMChris Roush
02/02/2024, 3:38 PMChris Roush
02/02/2024, 3:38 PMChris Roush
02/02/2024, 3:47 PMtableau and table mode via the clientChris Roush
02/02/2024, 3:47 PMMatan Perelmuter
02/02/2024, 3:48 PMChris Roush
02/02/2024, 3:49 PMChris Roush
02/02/2024, 9:49 PM