Hugo Ricateau
11/13/2024, 2:48 PM-U operations are materialised as new inserts, while they should be ignored: the update being represented by the subsequent +U operation, and the previous state being already known from the previous `+I`/`+U` operation;
• The -D operations are materialised the same way, while they should insert a new row with null values.
Has anyone ever encountered such a problem, and how did he manage to solve it? Maybe I am not employing the correct strategy to produce a SCD2 stream from the CDC of my raw source table; maybe one managed to properly implement this feature another way?Hugo Ricateau
11/13/2024, 2:49 PMCREATE OR REPLACE TABLE driver_cdc (
uuid VARCHAR(40) PRIMARY KEY NOT ENFORCED,
rider VARCHAR(20),
driver VARCHAR(20),
fare DOUBLE,
city VARCHAR(20),
update_ts TIMESTAMP(3) METADATA FROM 'op_ts',
WATERMARK FOR update_ts AS update_ts
) WITH (
'connector' = 'postgres-cdc',
'hostname' = 'postgres',
'port' = '5432',
'username' = 'postgres',
'password' = 'postgres',
'database-name' = 'mydb',
'schema-name' = 'public',
'table-name' = 'driver',
'decoding.plugin.name' = 'pgoutput',
'slot.name' = 'flink',
'debezium.snapshot.mode' = 'never'
);
tracking the CDC of the following PostgreSQL table:
CREATE OR REPLACE TABLE driver (
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
rider VARCHAR(20),
driver VARCHAR(20),
fare DOUBLE PRECISION,
city VARCHAR(20)
);
ALTER TABLE public.driver REPLICA IDENTITY FULL;
Here is the definition of the sink, along with the streaming job:
CREATE OR REPLACE TABLE driver_s3 (
uuid VARCHAR(40),
rider VARCHAR(20),
driver VARCHAR(20),
fare DOUBLE,
city VARCHAR(20),
update_ts TIMESTAMP(3)
) WITH (
'format-version' = '2'
);
INSERT INTO driver_s3 SELECT * FROM default_catalog.default_database.driver_cdc;
that is defined in the following Iceberg catalog:
CREATE CATALOG s3_catalog WITH (
'type' = 'iceberg',
'catalog-type' = 'hive',
'warehouse' = 's3a://<bucket>/<repository>',
'property-version' = '1'
);