Skip to content

Conversation

@mildek
Copy link
Collaborator

@mildek mildek commented Dec 9, 2025

No description provided.

Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch from b76ceb9 to e3ea18f Compare December 9, 2025 12:44
…rotocol

Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch from 1238242 to 8ce67ec Compare December 9, 2025 12:47
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch 2 times, most recently from 61090fb to e6af9f8 Compare December 11, 2025 09:48
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch from e6af9f8 to aa8a87b Compare December 11, 2025 09:49
@mildek mildek marked this pull request as draft December 11, 2025 15:23
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch 2 times, most recently from ee61ade to 2b8dfca Compare January 14, 2026 13:46
Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch from 2b8dfca to 1f4ab48 Compare January 14, 2026 13:50
@mildek mildek marked this pull request as ready for review January 14, 2026 14:45
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>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch from 9632b13 to e9d65cb Compare January 15, 2026 11:52
…ty on Windows

Signed-off-by: Krzysztof Milde <Krzysztof.Milde@Point72.com>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch from 29a3554 to acd75a1 Compare January 15, 2026 12:52
@mildek mildek requested a review from timkpaine January 15, 2026 13:16
@timkpaine timkpaine added type: enhancement Issues and PRs related to improvements to existing features adapter: kafka Issues and PRs related to the Apache Kafka adapter labels Jan 15, 2026
@timkpaine timkpaine dismissed their stale review January 15, 2026 14:34

all good now

# 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,
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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)
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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

Copy link
Collaborator Author

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?

Copy link
Collaborator

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?

Copy link
Member

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>
@mildek mildek requested a review from AdamGlustein February 3, 2026 15:24
  - 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>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch 3 times, most recently from 9a57ddb to e4fc53c Compare February 5, 2026 14:09
- 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>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch 5 times, most recently from 376e271 to b9a26a8 Compare February 5, 2026 16:45
- 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>
@mildek mildek force-pushed the feat/add-kafka-avro-protocol branch from b9a26a8 to 3ece184 Compare February 5, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adapter: kafka Issues and PRs related to the Apache Kafka adapter type: enhancement Issues and PRs related to improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants