wgtmac commented on code in PR #150: URL: https://github.com/apache/iceberg-cpp/pull/150#discussion_r2227874325
########## src/iceberg/avro/avro_register.h: ########## @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#pragma once + +#include <avro/LogicalType.hh> Review Comment: We should not expose avro headers. Perhaps define `MapLogicalType` in the avro_schema_util_internal.h? ########## src/iceberg/avro/avro_register.h: ########## @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#pragma once + +#include <avro/LogicalType.hh> + +namespace iceberg::avro { + +struct MapLogicalType : public ::avro::CustomLogicalType { + MapLogicalType() : ::avro::CustomLogicalType("map") {} +}; + +void RegisterLogicalTypes(); Review Comment: Do we need to add `ICEBERG_BUNDLE_EXPORT`? ########## src/iceberg/avro/avro_schema_util.cc: ########## @@ -49,17 +49,12 @@ constexpr std::string_view kValueIdProp = "value-id"; constexpr std::string_view kElementIdProp = "element-id"; constexpr std::string_view kAdjustToUtcProp = "adjust-to-utc"; -struct MapLogicalType : public ::avro::CustomLogicalType { - MapLogicalType() : ::avro::CustomLogicalType("map") {} -}; - ::avro::LogicalType GetMapLogicalType() { static std::once_flag flag{}; std::call_once(flag, []() { // Register the map logical type with the avro custom logical type registry. // See https://github.com/apache/avro/pull/3326 for details. - ::avro::CustomLogicalTypeRegistry::instance().registerType( - "map", [](const std::string&) { return std::make_shared<MapLogicalType>(); }); + RegisterLogicalTypes(); Review Comment: Should we move once_flag and call_once into RegisterLogicalTypes? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
