Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add idempotencekey ksql #520

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .ksql/ALL_01_POSTAL_SNAPSHOT_OSLO_STREAM_V2.ksql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE OR REPLACE STREAM IF NOT EXISTS postal_snapshot_oslo_stream_v2 (
messagekey varchar KEY,
headers ARRAY<STRUCT<key STRING, value BYTES>> HEADERS,
`@context` varchar,
`@type` varchar,
identificator STRUCT<id varchar, naamruimte varchar, objectId varchar, versieId varchar>,
gemeente STRUCT<objectId varchar, detail varchar, gemeentenaam STRUCT<geografischenaam STRUCT<spelling varchar, taal varchar>>>,
postnamen Array<STRUCT<geografischeNaam STRUCT<spelling varchar, taal varchar>>>,
postInfoStatus varchar)
WITH (KAFKA_TOPIC='postal.snapshot.oslo', VALUE_FORMAT='JSON');
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ CREATE OR REPLACE STREAM IF NOT EXISTS postal_snapshot_oslo_stream_flatten_integ
IDENTIFICATOR->ID as "PuriId",
IDENTIFICATOR->NAAMRUIMTE as "Namespace",
IDENTIFICATOR->VERSIEID as "VersionString",
PARSE_TIMESTAMP(IDENTIFICATOR->VERSIEID, 'yyyy-MM-dd''T''HH:mm:ssXXX', 'UTC') as "VersionTimestamp"
PARSE_TIMESTAMP(IDENTIFICATOR->VERSIEID, 'yyyy-MM-dd''T''HH:mm:ssXXX', 'UTC') as "VersionTimestamp",
CAST(FROM_BYTES(FILTER(headers, (x) => (x->key = 'IdempotenceKey'))[1]->VALUE, 'utf8') AS BIGINT) as "IdempotenceKey"

FROM POSTAL_SNAPSHOT_OSLO_STREAM
FROM POSTAL_SNAPSHOT_OSLO_STREAM_V2
PARTITION BY REDUCE(SPLIT(URL_EXTRACT_PATH(MESSAGEKEY), '/'), '', (S, X) => X);
Loading