xndai commented on code in PR #1128:
URL: https://github.com/apache/iceberg-cpp/pull/1128#discussion_r4814046493


##########
src/iceberg/stats/content_stats_util.h:
##########
@@ -0,0 +1,174 @@
+/*
+ * 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/stats/content_stats_util.h
+/// \brief Field IDs and types of the v4 `content_stats` struct.
+///
+/// See the "Content Stats" section of the Iceberg table spec.
+
+#include <cstdint>
+#include <memory>
+#include <optional>
+#include <span>
+#include <string_view>
+
+#include "iceberg/iceberg_export.h"
+#include "iceberg/metrics_config.h"
+#include "iceberg/result.h"
+#include "iceberg/type_fwd.h"
+
+namespace iceberg {
+
+/// \brief Utilities to derive the v4 `content_stats` struct from a table 
schema.
+///
+/// In v4, a manifest entry's column stats are one struct, `content_stats`, 
with an
+/// optional *field stats struct* per table field (e.g. `lower_bound`, 
`value_count`).
+/// The field IDs inside `content_stats` are computed from the table field 
IDs. The
+/// terms below are the spec's ("Content Stats" section):
+///
+/// - **stats ID**: the field ID of any field inside `content_stats`, either a 
field
+///   stats struct or one of its stats. Stats IDs are a separate ID space from 
table
+///   field IDs, reserved in [9_000, 200_000_000).
+/// - **base-id**: the first stats ID of a table field's range of 200 stats 
IDs,
+///   `10_000 + 200 * field-id`. The field stats struct itself uses the 
base-id.
+///   Reserved metadata fields use fixed base-ids (9000, 9200).

Review Comment:
   The comment makes it look like an open interval. but the code is correct 
that it's [9000, 9200). Fixed the comment.



-- 
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]

Reply via email to