Fokko commented on code in PR #178: URL: https://github.com/apache/iceberg-cpp/pull/178#discussion_r2297547762
########## src/iceberg/inheritable_metadata.cc: ########## @@ -0,0 +1,106 @@ +/* + * 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/inheritable_metadata.h" + +#include <cassert> +#include <utility> + +#include "iceberg/manifest_entry.h" +#include "iceberg/manifest_list.h" +#include "iceberg/snapshot.h" + +namespace iceberg { + +BaseInheritableMetadata::BaseInheritableMetadata(int32_t spec_id, int64_t snapshot_id, + int64_t sequence_number, + std::string manifest_location) + : spec_id_(spec_id), + snapshot_id_(snapshot_id), + sequence_number_(sequence_number), + manifest_location_(std::move(manifest_location)) {} + +Status BaseInheritableMetadata::Apply(ManifestEntry& entry) { + if (!entry.snapshot_id.has_value()) { + entry.snapshot_id = snapshot_id_; + } + + // In v1 tables, the data sequence number is not persisted and can be safely defaulted + // to 0. + // In v2 tables, the data sequence number should be inherited iff the entry status Review Comment: Nit: You could upgrade a table to V2+, but there could still be V1 metadata in the tree ```suggestion // In v1 metadata, the data sequence number is not persisted and can be safely defaulted // to 0. // In v2 metadata, the data sequence number should be inherited iff the entry status ``` -- 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