lidavidm commented on code in PR #54:
URL: https://github.com/apache/iceberg-cpp/pull/54#discussion_r2020381683


##########
src/iceberg/partition_spec.h:
##########
@@ -0,0 +1,73 @@
+/*
+ * 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/partition_spec.h
+/// Partition specs for Iceberg tables.
+
+#include <cstdint>
+#include <string>
+#include <vector>
+#include <span>
+
+#include "iceberg/iceberg_export.h"
+#include "iceberg/partition_field.h"
+
+namespace iceberg {
+
+/// \brief A partition spec for a Table.
+///
+/// A partition spec is a list of partition fields, along with a unique 
integer ID.  A
+/// Table may have different partition specs over its lifetime due to 
partition spec
+/// evolution.
+class ICEBERG_EXPORT PartitionSpec {
+ public:
+  virtual ~PartitionSpec() = default;
+  PartitionSpec(int32_t spec_id, std::vector<PartitionField> fields);
+  /// \brief Get the spec ID.
+  [[nodiscard]] int32_t spec_id() const;
+  /// \brief Get a view of the partition fields.
+  [[nodiscard]] virtual std::span<const PartitionField> fields() const;
+  /// \brief Get a field by field ID.

Review Comment:
   Should we clarify whether these are source/transform field IDs?



##########
src/iceberg/partition_field.h:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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/partition_field.h
+/// A partition field in a partition spec
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <string_view>
+
+#include "iceberg/iceberg_export.h"
+#include "iceberg/type_fwd.h"
+#include "iceberg/util/formattable.h"
+
+namespace iceberg {
+
+/// \brief a field with its transform.
+class ICEBERG_EXPORT PartitionField : public util::Formattable {
+ public:
+  /// \brief Construct a field.
+  /// \param[in] source_id The source field ID.
+  /// \param[in] field_id The partition field ID.
+  /// \param[in] name The partition field name.
+  /// \param[in] transformType The transform type.
+  PartitionField(int32_t source_id, int32_t field_id, std::string name, 
TransformType transformType);
+
+  /// \brief Get the source field ID.
+  [[nodiscard]] int32_t source_field_id() const;
+
+  /// \brief Get the partition field ID.
+  [[nodiscard]] int32_t field_id() const;
+
+  /// \brief Get the partition field name.
+  [[nodiscard]] std::string_view name() const;
+
+  /// \brief Get the transform type.
+  [[nodiscard]] TransformType transform_type() const;

Review Comment:
   Java stores the full transform, not the type; do we need to do the same?



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

Reply via email to