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

Support otfMetadata in Kinesis firehose response metadata for iceberg table routing #576

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
16 changes: 15 additions & 1 deletion events/firehose.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ const (
KinesisFirehoseTransformedStateProcessingFailed = "ProcessingFailed"
)

// Constants used for otf operation for the record
const (
KinesisFirehoseOtfOperationInsert = "insert"
KinesisFirehoseOtfOperationUpdate = "update"
KinesisFirehoseOtfOperationDelete = "delete"
)

type KinesisFirehoseResponse struct {
Records []KinesisFirehoseResponseRecord `json:"records"`
}
Expand All @@ -37,7 +44,14 @@ type KinesisFirehoseResponseRecord struct {
}

type KinesisFirehoseResponseRecordMetadata struct {
PartitionKeys map[string]string `json:"partitionKeys"`
PartitionKeys map[string]string `json:"partitionKeys"`
OTFMetadata KinesisFirehoseResponseOTFMetadata `json:"otfMetadata"`
}

type KinesisFirehoseResponseOTFMetadata struct {
DestinationTableName string `json:"destinationTableName"`
DestinationDatabaseName string `json:"destinationDatabaseName"`
Operation string `json:"operation"`
}

type KinesisFirehoseRecordMetadata struct {
Expand Down
19 changes: 17 additions & 2 deletions events/testdata/kinesis-firehose-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
"recordId": "record1",
"result": "TRANSFORMED_STATE_OK",
"metadata": {
"partitionKeys": {}
"partitionKeys": {},
"otfMetadata": {
"destinationTableName": "",
"destinationDatabaseName": "",
"operation": ""
}
}
},
{
"data": "SGVsbG8gV29ybGQ=",
"recordId": "record2",
"result": "TRANSFORMED_STATE_DROPPED",
"metadata": {
"partitionKeys": {}
"partitionKeys": {},
"otfMetadata": {
"destinationTableName": "",
"destinationDatabaseName": "",
"operation": ""
}
}
},
{
Expand All @@ -24,6 +34,11 @@
"partitionKeys": {
"iamKey1": "iamValue1",
"iamKey2": "iamValue2"
},
"otfMetadata": {
"destinationTableName": "",
"destinationDatabaseName": "",
"operation": ""
}
}
}
Expand Down
Loading