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

fix: handle complex types when generating Avro values #94

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

yvrng
Copy link
Contributor

@yvrng yvrng commented Sep 23, 2024

When using the Produce task, we are only able to send objects with a simple structure. The current code does not handle complex types correctly, such as enums, unions, lists, maps, etc.

This commit improves handling of complex Avro types in Kafka by introducing MapToGenericRecordSerializer a better GenericRecord serialization.

Note: Further work may be required to handle fixed values (which only accept byte[]) and unions (currently using the first non-null type, which allow support for optional values but not polymorphism).

@loicmathieu
Copy link
Member

Can you add a new tests that didn't pass without this change?

@yvrng
Copy link
Contributor Author

yvrng commented Sep 23, 2024

I've added a collection of unit tests for all complex types, and for some common combinations.

Copy link
Member

@loicmathieu loicmathieu left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you very much!

@loicmathieu loicmathieu merged commit 082b302 into kestra-io:master Sep 23, 2024
1 check passed
Skraye pushed a commit that referenced this pull request Oct 3, 2024
* fix: handle complex types when generating Avro values

* chore: add TODO comment

* fix: handle null value

* test: add unit tests

* test: add unit tests
Skraye pushed a commit that referenced this pull request Oct 4, 2024
* fix: handle complex types when generating Avro values

* chore: add TODO comment

* fix: handle null value

* test: add unit tests

* test: add unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants