Skip to content

[WIP] Initial support for the Avro "protocol" keyword#56

Open
zeidoo wants to merge 2 commits intolerouxrgd:masterfrom
zeidoo:master
Open

[WIP] Initial support for the Avro "protocol" keyword#56
zeidoo wants to merge 2 commits intolerouxrgd:masterfrom
zeidoo:master

Conversation

@zeidoo
Copy link
Copy Markdown

@zeidoo zeidoo commented Apr 18, 2023

Some folks prefer working with Avro IDL instead of JSON, then convert the IDL to JSON schemas using the avro-tools jar, or a Maven/Gradle plugins. Like this:

cd tests/schemas
java -jar path/to/avro-tools-1.11.1.jar idl ./protocol_simple.avdl ./protocol_simple.avsc

This PR grabs the "types" json element from the generated "protocol" avsc file and uses that instead of using the whole contents of the file as it's the case for "schema" avsc files. Everything else remains the same during generation.

Notes:

  • the added test avsc files were generated from the idl files by manually running the avro-tools command. There's a potential for the idl and avsc to get out of sync if avsc are edited manually.
  • this PR ignores any methods that a protocol may contain
  • it's my first ever rust code, really open to feedback so I can improve

@lerouxrgd
Copy link
Copy Markdown
Owner

Hello,

Thank you for bringing the "protocol" type to my attention.

However I feel that the Protocol struct is something that should be living in apache-avro as it's part of the standard, but I couldn't find it there.
@martin-g Do you know if this is something planned to be supported in the future ?

@zeidoo
Copy link
Copy Markdown
Author

zeidoo commented Apr 18, 2023

I do agree that the protocol struct should be in the Avro module, but it's not.

The commented out fields in the protocol file of this PR are kinda the skeleton of what it should look like.

I put the struct in this project to get things rolling, with the hopes that it gets migrated in the Avro module eventually.

@martin-g
Copy link
Copy Markdown
Contributor

Another user of apache-avro works on that - https://github.com/woile/avdl-rs

The main problem of Apache Avro is that all SDKs need to be released together. And because of this there are 1 or at most 2 releases per year. I proposed once to make it possible to release just a single SDK but there are not many active maintainers of most of the other SDKs.
I'll start a vote explicitly for the Rust SDK. If the vote fails for some reason then I'd suggest any new development like avdl-rs and @zeidoo 's work to be done in a non-Apache Github repo, for faster development and release cycle.

@martin-g
Copy link
Copy Markdown
Contributor

@woile You might be interested in this PR/discussion.

@zeidoo
Copy link
Copy Markdown
Author

zeidoo commented May 10, 2023

I'm not really sure what the conclusions of this discussion are.

Is https://github.com/woile/avdl-rs another lib to generate Rust code from Avro, or is it prototyping in the hopes of merging with the office Apache Avro project?

Should this repo take care of the Avro protocol or redirect that task to @woile's repo?

@woile
Copy link
Copy Markdown

woile commented May 10, 2023

I would be more than happy to merge avdl-rs into the avro package if that's what's wanted, but I haven't had any conversations yet. Contributions to the avdl-rs are more than welcome. I'm now stuck fixing the imports. If you want to try it, download the avrokit from the release page and run avrokit --help (the docs need to be improved). I hope avrokit can provide a better interface than avro-tools

@martin-g
Copy link
Copy Markdown
Contributor

About the "merge to Apache Avro" part: I think it would be great if both rsgen-avro and avdl-rs are sub-projects of Apache Avro SDK one day!
But this is really up to @lerouxrgd and @woile ! Please let me know if you are interested in becoming committers at ASF !
I'd be very happy to have co-maintainers of the apache_avro crates!

The biggest downside of moving the projects to Apache is the long time between releases (explained at #56 (comment)). But if there are more co-maintainers we can push harder for releasing a single SDK, i.e. just the Rust SDK.

@martin-g
Copy link
Copy Markdown
Contributor

Apache Avro Rust SDK has been extracted to https://github.com/apache/avro-rs !

@martin-g
Copy link
Copy Markdown
Contributor

martin-g commented Dec 3, 2024

Another IDL impl in the wild: https://github.com/kvedes/avro-idl
Thank you, @kvedes!

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.

4 participants