-
Notifications
You must be signed in to change notification settings - Fork 76
added Avro support for KafkaAdapter #645
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
b76ceb9 to
e3ea18f
Compare
…rotocol Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
1238242 to
8ce67ec
Compare
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
61090fb to
e6af9f8
Compare
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
e6af9f8 to
aa8a87b
Compare
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
ee61ade to
2b8dfca
Compare
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
2b8dfca to
1f4ab48
Compare
The avro-cpp library added in this PR uses fmt, which requires the /utf-8 compiler flag on Windows MSVC to handle Unicode support properly. Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
…ndows. The avro-cpp library from conda-forge defines fmt::formatter<avro::Name> with a non-const format() method, but fmt v12 requires it to be const. This commit adds a const-correct version of the formatter that is used on Windows (MSVC) to prevent compilation errors. Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
The avro-cpp library is not yet compatible with fmt v12. The library defines fmt::formatter<avro::Name> with a non-const format() method, but fmt v12 requires it to be const. Homebrew and other package managers use fmt 11.2.0 with avro-cpp, so we pin fmt<12 in the Windows conda environment to avoid compilation errors on Windows CI. Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
Instead of pinning to an older fmt version (which creates version mismatch between platforms), we implement a workaround that provides a const-correct fmt::formatter<avro::Name> specialization on Windows. conda-forge's avro-cpp has an outdated formatter without const, while fmt v11+ requires const. We define the correct version first and suppress the redefinition warning, ensuring compatibility with latest fmt across all platforms. Also regenerated NOTICE file to include avro-cpp license. Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
conda-forge's avro-cpp defines fmt::formatter with non-const format() method, but fmt v11+ requires const. Create a centralized AvroIncludes.h wrapper that: 1. Temporarily sets FMT_VERSION to 80000 (below 90000 threshold) to prevent avro from defining its broken formatters 2. Includes all avro headers 3. Restores FMT_VERSION and defines const-correct formatters for both avro::Name and avro::Type This can be removed once conda-forge updates avro-cpp. Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
9632b13 to
e9d65cb
Compare
…ty on Windows Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
29a3554 to
acd75a1
Compare
cpp/cmake/modules/FindAvro.cmake
Outdated
| # conda-forge's avro-cpp has fmt::formatter specializations with non-const | ||
| # format() methods, but fmt v12+ requires const. This causes MSVC error C2766. | ||
| # | ||
| # Solution: On Windows, we check if the avro headers have this bug, and if so, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you not just check for the bug by looking at what version of avro-cpp you are building against?
I am also not a fan of this patch, if the Windows version is too old to be compatible with the current env then I'd rather just skip it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see us checking the code directly and not the avro-cpp version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Earlier I wasn't 100% sure if we could reliably extract the version, but turns out we can. Also updated the vcpkg submodule to 1.12.1 which apparently has the fmt fix upstream, so we don't need the patch anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, so we can also get rid of the version logic in the FindAvro.cmake too then right.
|
|
||
| # Link Avro library | ||
| if(CSP_USE_VCPKG) | ||
| target_link_libraries(csp_kafka_adapter PUBLIC unofficial::avro-cpp::avrocpp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall state of avro packaging (both in conda and vcpkg) really gives me hesitation on adding it as a build-time dependency of csp. I'd much prefer if we could split this out into it's own project, but not sure how feasible that is given our adapter ABI is still a WIP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Kafka adapter with Avro support is already fully optional (CSP_BUILD_KAFKA_ADAPTER=ON/OFF). With this PR, on Windows conda-forge builds where avro-cpp is incompatible, it automatically disables itself with a clear warning - no build failures, no patches, just graceful degradation. I agree the avro packaging situation is frustrating. Once the adapter ABI stabilizes, splitting this into a separate project would make sense. For now, keeping it optional within CSP seems like the pragmatic path - users who need Kafka/Avro can enable it, others aren't affected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I assume we are going to build CSP (for distribution) with Avro enabled, just like we build with Kafka enabled currently. So it's not optional from the perspective of the userm who installs pre-built csp from conda/pypi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we wait then for ABI to stabilize before merging it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can merge it as an experimental feature and if avro becomes a nuisance in our build pipeline we can always re-evaluate/remove it. @timkpaine what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will eventually support separate adapters but for now i think its better to support everything we support on every platform, and not do platform-specific stuff. There should be no incompatible platform as this has caused problems in the past and makes life annoying for users.
- Define CSP_AVRO_TARGET cmake variable to avoid repeating vcpkg checks - Remove braces from one-line loops (style) - Remove assert_values_equal helper - Avro preserves exact float values - Simplify FindAvro.cmake - disable Kafka adapter when avro-cpp has fmt bug - Make DepsKafkaAdapter optional in root CMakeLists.txt Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
- Skip Kafka adapter on Windows if avro-cpp < 1.12.1 - Update vcpkg submodule to 1.12.1 (has upstream fmt fix) - Rename CSP_AVRO_TARGET to AVRO_LIBRARIES Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
9a57ddb to
e4fc53c
Compare
- Extract version from library soname on conda-forge - Skip Kafka adapter on Windows if avro-cpp < 1.12.1 or version unknown - Make Avro compilation conditional with CSP_USE_AVRO define - Add vcpkg.json override to use avro-cpp 1.12.1 without full submodule update - Rename CSP_AVRO_TARGET to AVRO_LIBRARIES for consistency Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
376e271 to
b9a26a8
Compare
- Update vcpkg submodule to f9d8eecab9 which has avro-cpp 1.12.1 - Update vcpkg.json baseline to match - Update setup.py VCPKG_SHA to match - Add version check in FindDepsKafkaAdapter.cmake to gracefully skip Kafka adapter on Windows if avro-cpp < 1.12.1 Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
b9a26a8 to
3ece184
Compare
No description provided.