kamcheungting-db commented on code in PR #1069: URL: https://github.com/apache/iceberg-cpp/pull/1069#discussion_r4733424816
########## src/iceberg/view_metadata.h: ########## @@ -0,0 +1,124 @@ +/* + * 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 + +/// \file iceberg/view_metadata.h +/// View metadata for Iceberg views. + +#include <cstdint> +#include <memory> +#include <string> +#include <unordered_map> +#include <vector> + +#include "iceberg/iceberg_export.h" +#include "iceberg/result.h" +#include "iceberg/type_fwd.h" +#include "iceberg/util/timepoint.h" +#include "iceberg/view_version.h" + +namespace iceberg { + +/// \brief Represents a view history entry, which records a change to the +/// current version of a view. +struct ICEBERG_EXPORT ViewHistoryEntry { + /// The timestamp in milliseconds of the change to the current version. + TimePointMs timestamp_ms; + /// ID of the view version that was made current. + int32_t version_id; + + /// \brief Compare two view history entries for equality. + friend bool operator==(const ViewHistoryEntry& lhs, const ViewHistoryEntry& rhs) { + return lhs.timestamp_ms == rhs.timestamp_ms && lhs.version_id == rhs.version_id; + } +}; + +/// \brief Represents the metadata for an Iceberg view. +/// +/// View metadata follows view format version 1. Table-format schema +/// restrictions are deliberately not applied to the view's schemas: view +/// schemas are projections of the referenced tables' columns and may use +/// types or nullability that table data would reject. +struct ICEBERG_EXPORT ViewMetadata { + static constexpr int8_t kDefaultViewFormatVersion = 1; + static constexpr int8_t kSupportedViewFormatVersion = 1; + + /// An integer version number for the view format; must be 1. + int8_t format_version; Review Comment: Done. Default-initialized scalar members in `ViewMetadata`, `ViewVersion`, and `ViewHistoryEntry`. Added a default-construction regression test. -- 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]
