File tree Expand file tree Collapse file tree 4 files changed +16
-14
lines changed Expand file tree Collapse file tree 4 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 1919
2020#include " avro_register.h"
2121
22+ #include " iceberg/avro/avro_schema_util_internal.h"
23+
2224namespace iceberg ::avro {
2325
2426void RegisterLogicalTypes () {
25- ::avro::CustomLogicalTypeRegistry::instance ().registerType(
26- " map" , [](const std::string&) { return std::make_shared<MapLogicalType>(); });
27+ static std::once_flag flag{};
28+ std::call_once (flag, []() {
29+ // Register the map logical type with the avro custom logical type registry.
30+ // See https://github.com/apache/avro/pull/3326 for details.
31+ ::avro::CustomLogicalTypeRegistry::instance ().registerType(
32+ " map" , [](const std::string&) { return std::make_shared<MapLogicalType>(); });
33+ });
2734}
2835
2936} // namespace iceberg::avro
Original file line number Diff line number Diff line change 1919
2020#pragma once
2121
22- #include < avro/LogicalType.hh >
22+ #include " iceberg/iceberg_bundle_export.h "
2323
2424namespace iceberg ::avro {
2525
26- struct MapLogicalType : public ::avro::CustomLogicalType {
27- MapLogicalType () : ::avro::CustomLogicalType(" map" ) {}
28- };
29-
30- void RegisterLogicalTypes ();
26+ ICEBERG_BUNDLE_EXPORT void RegisterLogicalTypes ();
3127
3228} // namespace iceberg::avro
Original file line number Diff line number Diff line change @@ -50,12 +50,7 @@ constexpr std::string_view kElementIdProp = "element-id";
5050constexpr std::string_view kAdjustToUtcProp = " adjust-to-utc" ;
5151
5252::avro::LogicalType GetMapLogicalType () {
53- static std::once_flag flag{};
54- std::call_once (flag, []() {
55- // Register the map logical type with the avro custom logical type registry.
56- // See https://github.com/apache/avro/pull/3326 for details.
57- RegisterLogicalTypes ();
58- });
53+ RegisterLogicalTypes ();
5954 return ::avro::LogicalType (std::make_shared<MapLogicalType>());
6055}
6156
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ class ValidSchema;
3434
3535namespace iceberg ::avro {
3636
37+ struct MapLogicalType : public ::avro::CustomLogicalType {
38+ MapLogicalType () : ::avro::CustomLogicalType(" map" ) {}
39+ };
40+
3741// / \brief A visitor that converts an Iceberg type to an Avro node.
3842class ToAvroNodeVisitor {
3943 public:
You can’t perform that action at this time.
0 commit comments