wgtmac commented on code in PR #53: URL: https://github.com/apache/iceberg-cpp/pull/53#discussion_r2020725819
########## src/iceberg/schema_internal.cc: ########## @@ -0,0 +1,193 @@ +/* + * 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. + */ + +#include "iceberg/schema_internal.h" + +#include <format> +#include <optional> +#include <string> + +#include "iceberg/expected.h" +#include "iceberg/schema.h" + +namespace iceberg { + +namespace { + +constexpr const char* kArrowExtensionName = "ARROW:extension:name"; +constexpr const char* kArrowExtensionMetadata = "ARROW:extension:metadata"; + +// Convert an Iceberg type to Arrow schema. Return value is Nanoarrow error code. +ArrowErrorCode ConvertToArrowSchema(const Type& type, ArrowSchema* schema, bool optional, Review Comment: That makes sense. Actually there are in different namespaces (the former one is in the anonymous namespace). I have renamed them to `ToArrowSchema` to be consistent. W.r.t. the order of arguments, those with default values must be placed at the end. Since they are all internal functions, I have just removed any default argument and put the out param to the end. ########## src/iceberg/schema_internal.cc: ########## @@ -0,0 +1,193 @@ +/* + * 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. + */ + +#include "iceberg/schema_internal.h" + +#include <format> +#include <optional> +#include <string> + +#include "iceberg/expected.h" +#include "iceberg/schema.h" + +namespace iceberg { + +namespace { + +constexpr const char* kArrowExtensionName = "ARROW:extension:name"; +constexpr const char* kArrowExtensionMetadata = "ARROW:extension:metadata"; + +// Convert an Iceberg type to Arrow schema. Return value is Nanoarrow error code. +ArrowErrorCode ConvertToArrowSchema(const Type& type, ArrowSchema* schema, bool optional, Review Comment: That makes sense. Actually they are in different namespaces (the former one is in the anonymous namespace). I have renamed them to `ToArrowSchema` to be consistent. W.r.t. the order of arguments, those with default values must be placed at the end. Since they are all internal functions, I have just removed any default argument and put the out param to the end. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org