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

[Debezium] Better support around JSON arrays #1072

Merged
merged 6 commits into from
Dec 12, 2024
Merged

[Debezium] Better support around JSON arrays #1072

merged 6 commits into from
Dec 12, 2024

Conversation

Tang8330
Copy link
Contributor

@Tang8330 Tang8330 commented Dec 12, 2024

Debezium will emit

{
    "type": "array",
    "items": {
        "type": "string",
        "optional": true,
        "name": "io.debezium.data.Json",
        "version": 1
    },
    "optional": true,
    "field": "attributes"
}

As the field object if the value contains an array of JSON objects. We were previously not doing anything with this information.

As such, we were mainly returning an array of JSON strings (which is what Debezium emits). This PR adds the ability for us to check the items.name and if it's JSON, we'll add an additional step to parse the JSON string into an object.

@Tang8330 Tang8330 marked this pull request as ready for review December 12, 2024 01:26
@Tang8330 Tang8330 requested a review from a team as a code owner December 12, 2024 01:26
@Tang8330 Tang8330 changed the title [Relational] Better support around JSON arrays [Debezium] Better support around JSON arrays Dec 12, 2024
type Field struct {
Type FieldType `json:"type"`
Optional bool `json:"optional"`
Default any `json:"default"`
FieldName string `json:"field"`
DebeziumType SupportedDebeziumType `json:"name"`
Parameters map[string]any `json:"parameters"`
// [Items] is only populated if the literal type is an array.
Items Item `json:"items"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Items being plural is a little confusing here, maybe we could call this ItemsMetadata?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sg

@Tang8330 Tang8330 merged commit cdd524f into master Dec 12, 2024
3 checks passed
@Tang8330 Tang8330 deleted the debug branch December 12, 2024 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants