Skip to content

Commit 407c3d1

Browse files
authored
refactor: use StructType instead of Schema for partition schema (#298)
1 parent ad5dadc commit 407c3d1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/iceberg/manifest_reader.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@
2424
#include "iceberg/manifest_reader_internal.h"
2525
#include "iceberg/schema.h"
2626
#include "iceberg/schema_internal.h"
27+
#include "iceberg/type.h"
2728
#include "iceberg/util/macros.h"
2829

2930
namespace iceberg {
3031

3132
Result<std::unique_ptr<ManifestReader>> ManifestReader::Make(
3233
const ManifestFile& manifest, std::shared_ptr<FileIO> file_io,
33-
std::shared_ptr<Schema> partition_schema) {
34-
auto manifest_entry_schema = ManifestEntry::TypeFromPartitionType(partition_schema);
34+
std::shared_ptr<StructType> partition_schema) {
35+
auto manifest_entry_schema =
36+
ManifestEntry::TypeFromPartitionType(std::move(partition_schema));
3537
std::shared_ptr<Schema> schema =
3638
FromStructType(std::move(*manifest_entry_schema), std::nullopt);
3739

@@ -51,8 +53,9 @@ Result<std::unique_ptr<ManifestReader>> ManifestReader::Make(
5153

5254
Result<std::unique_ptr<ManifestReader>> ManifestReader::Make(
5355
std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
54-
std::shared_ptr<Schema> partition_schema) {
55-
auto manifest_entry_schema = ManifestEntry::TypeFromPartitionType(partition_schema);
56+
std::shared_ptr<StructType> partition_schema) {
57+
auto manifest_entry_schema =
58+
ManifestEntry::TypeFromPartitionType(std::move(partition_schema));
5659
auto fields_span = manifest_entry_schema->fields();
5760
std::vector<SchemaField> fields(fields_span.begin(), fields_span.end());
5861
auto schema = std::make_shared<Schema>(fields);

src/iceberg/manifest_reader.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include "iceberg/iceberg_export.h"
2929
#include "iceberg/result.h"
30+
#include "iceberg/type.h"
3031
#include "iceberg/type_fwd.h"
3132

3233
namespace iceberg {
@@ -44,7 +45,7 @@ class ICEBERG_EXPORT ManifestReader {
4445
/// \return A Result containing the reader or an error.
4546
static Result<std::unique_ptr<ManifestReader>> Make(
4647
const ManifestFile& manifest, std::shared_ptr<FileIO> file_io,
47-
std::shared_ptr<Schema> partition_schema);
48+
std::shared_ptr<StructType> partition_schema);
4849

4950
/// \brief Creates a reader for a manifest file.
5051
/// \param manifest_location Path to the manifest file.
@@ -53,7 +54,7 @@ class ICEBERG_EXPORT ManifestReader {
5354
/// \return A Result containing the reader or an error.
5455
static Result<std::unique_ptr<ManifestReader>> Make(
5556
std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
56-
std::shared_ptr<Schema> partition_schema);
57+
std::shared_ptr<StructType> partition_schema);
5758
};
5859

5960
/// \brief Read manifest files from a manifest list file.

0 commit comments

Comments
 (0)