From 6f4cb585fe67bda660e19f3ba7ecc45f7c8a29c0 Mon Sep 17 00:00:00 2001 From: Li Feiyang Date: Fri, 7 Nov 2025 15:47:49 +0800 Subject: [PATCH] refactor: use StructType instead of Schema for partition schema --- 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 42606fbf7..1e9085255 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> ManifestReader::Make( const ManifestFile& manifest, std::shared_ptr file_io, - std::shared_ptr partition_schema) { - auto manifest_entry_schema = ManifestEntry::TypeFromPartitionType(partition_schema); + std::shared_ptr partition_schema) { + auto manifest_entry_schema = + ManifestEntry::TypeFromPartitionType(std::move(partition_schema)); std::shared_ptr schema = FromStructType(std::move(*manifest_entry_schema), std::nullopt); @@ -51,8 +53,9 @@ Result> ManifestReader::Make( Result> ManifestReader::Make( std::string_view manifest_location, std::shared_ptr file_io, - std::shared_ptr partition_schema) { - auto manifest_entry_schema = ManifestEntry::TypeFromPartitionType(partition_schema); + std::shared_ptr partition_schema) { + auto manifest_entry_schema = + ManifestEntry::TypeFromPartitionType(std::move(partition_schema)); auto fields_span = manifest_entry_schema->fields(); std::vector fields(fields_span.begin(), fields_span.end()); auto schema = std::make_shared(fields); diff --git a/src/iceberg/manifest_reader.h b/src/iceberg/manifest_reader.h index 7dc0a2077..4c046cdca 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> Make( const ManifestFile& manifest, std::shared_ptr file_io, - std::shared_ptr partition_schema); + std::shared_ptr 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> Make( std::string_view manifest_location, std::shared_ptr file_io, - std::shared_ptr partition_schema); + std::shared_ptr partition_schema); }; /// \brief Read manifest files from a manifest list file.