This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 407c3d1  refactor: use StructType instead of Schema for partition 
schema (#298)
407c3d1 is described below

commit 407c3d169b5fe89784457f463aa8316871ca6610
Author: Li Feiyang <[email protected]>
AuthorDate: Fri Nov 7 16:12:27 2025 +0800

    refactor: use StructType instead of Schema for partition schema (#298)
---
 src/iceberg/manifest_reader.cc | 11 +++++++----
 src/iceberg/manifest_reader.h  |  5 +++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/iceberg/manifest_reader.cc b/src/iceberg/manifest_reader.cc
index 42606fb..1e90852 100644
--- a/src/iceberg/manifest_reader.cc
+++ b/src/iceberg/manifest_reader.cc
@@ -24,14 +24,16 @@
 #include "iceberg/manifest_reader_internal.h"
 #include "iceberg/schema.h"
 #include "iceberg/schema_internal.h"
+#include "iceberg/type.h"
 #include "iceberg/util/macros.h"
 
 namespace iceberg {
 
 Result<std::unique_ptr<ManifestReader>> ManifestReader::Make(
     const ManifestFile& manifest, std::shared_ptr<FileIO> file_io,
-    std::shared_ptr<Schema> partition_schema) {
-  auto manifest_entry_schema = 
ManifestEntry::TypeFromPartitionType(partition_schema);
+    std::shared_ptr<StructType> partition_schema) {
+  auto manifest_entry_schema =
+      ManifestEntry::TypeFromPartitionType(std::move(partition_schema));
   std::shared_ptr<Schema> schema =
       FromStructType(std::move(*manifest_entry_schema), std::nullopt);
 
@@ -51,8 +53,9 @@ Result<std::unique_ptr<ManifestReader>> ManifestReader::Make(
 
 Result<std::unique_ptr<ManifestReader>> ManifestReader::Make(
     std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
-    std::shared_ptr<Schema> partition_schema) {
-  auto manifest_entry_schema = 
ManifestEntry::TypeFromPartitionType(partition_schema);
+    std::shared_ptr<StructType> partition_schema) {
+  auto manifest_entry_schema =
+      ManifestEntry::TypeFromPartitionType(std::move(partition_schema));
   auto fields_span = manifest_entry_schema->fields();
   std::vector<SchemaField> fields(fields_span.begin(), fields_span.end());
   auto schema = std::make_shared<Schema>(fields);
diff --git a/src/iceberg/manifest_reader.h b/src/iceberg/manifest_reader.h
index 7dc0a20..4c046cd 100644
--- a/src/iceberg/manifest_reader.h
+++ b/src/iceberg/manifest_reader.h
@@ -27,6 +27,7 @@
 
 #include "iceberg/iceberg_export.h"
 #include "iceberg/result.h"
+#include "iceberg/type.h"
 #include "iceberg/type_fwd.h"
 
 namespace iceberg {
@@ -44,7 +45,7 @@ class ICEBERG_EXPORT ManifestReader {
   /// \return A Result containing the reader or an error.
   static Result<std::unique_ptr<ManifestReader>> Make(
       const ManifestFile& manifest, std::shared_ptr<FileIO> file_io,
-      std::shared_ptr<Schema> partition_schema);
+      std::shared_ptr<StructType> partition_schema);
 
   /// \brief Creates a reader for a manifest file.
   /// \param manifest_location Path to the manifest file.
@@ -53,7 +54,7 @@ class ICEBERG_EXPORT ManifestReader {
   /// \return A Result containing the reader or an error.
   static Result<std::unique_ptr<ManifestReader>> Make(
       std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
-      std::shared_ptr<Schema> partition_schema);
+      std::shared_ptr<StructType> partition_schema);
 };
 
 /// \brief Read manifest files from a manifest list file.

Reply via email to