Skip to content

Commit 69cf0e8

Browse files
author
xiao.dong
committed
remove v4
1 parent 657ba67 commit 69cf0e8

File tree

7 files changed

+24
-129
lines changed

7 files changed

+24
-129
lines changed
File renamed without changes.

src/iceberg/manifest_writer.cc

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "iceberg/v1_metadata.h"
2727
#include "iceberg/v2_metadata.h"
2828
#include "iceberg/v3_metadata.h"
29-
#include "iceberg/v4_metadata.h"
3029

3130
namespace iceberg {
3231

@@ -67,14 +66,6 @@ class ManifestWriterImpl : public ManifestWriter {
6766
std::unique_ptr<ManifestEntryAdapter> adapter_;
6867
};
6968

70-
std::shared_ptr<Schema> ParseSchema(std::shared_ptr<Schema> partition_schema) {
71-
auto manifest_entry_schema =
72-
ManifestEntry::TypeFromPartitionType(std::move(partition_schema));
73-
auto fields_span = manifest_entry_schema->fields();
74-
std::vector<SchemaField> fields(fields_span.begin(), fields_span.end());
75-
return std::make_shared<Schema>(fields);
76-
}
77-
7869
Result<std::unique_ptr<Writer>> OpenFileWriter(std::string_view location,
7970
const std::shared_ptr<Schema> schema,
8071
std::shared_ptr<FileIO> file_io) {
@@ -89,7 +80,12 @@ Result<std::unique_ptr<Writer>> OpenFileWriter(std::string_view location,
8980
Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV1Writer(
9081
std::optional<int64_t> snapshot_id, std::string_view manifest_location,
9182
std::shared_ptr<FileIO> file_io, std::shared_ptr<Schema> partition_schema) {
92-
auto schema = ParseSchema(partition_schema);
83+
// TODO(xiao.dong) parse v1 schema
84+
auto manifest_entry_schema =
85+
ManifestEntry::TypeFromPartitionType(std::move(partition_schema));
86+
auto fields_span = manifest_entry_schema->fields();
87+
std::vector<SchemaField> fields(fields_span.begin(), fields_span.end());
88+
auto schema = std::make_shared<Schema>(fields);
9389
ICEBERG_ASSIGN_OR_RAISE(auto writer,
9490
OpenFileWriter(manifest_location, schema, std::move(file_io)));
9591
auto adapter = std::make_unique<ManifestEntryAdapterV1>(snapshot_id, std::move(schema));
@@ -99,7 +95,12 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV1Writer(
9995
Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer(
10096
std::optional<int64_t> snapshot_id, std::string_view manifest_location,
10197
std::shared_ptr<FileIO> file_io, std::shared_ptr<Schema> partition_schema) {
102-
auto schema = ParseSchema(partition_schema);
98+
// TODO(xiao.dong) parse v2 schema
99+
auto manifest_entry_schema =
100+
ManifestEntry::TypeFromPartitionType(std::move(partition_schema));
101+
auto fields_span = manifest_entry_schema->fields();
102+
std::vector<SchemaField> fields(fields_span.begin(), fields_span.end());
103+
auto schema = std::make_shared<Schema>(fields);
103104
ICEBERG_ASSIGN_OR_RAISE(auto writer,
104105
OpenFileWriter(manifest_location, schema, std::move(file_io)));
105106
auto adapter = std::make_unique<ManifestEntryAdapterV2>(snapshot_id, std::move(schema));
@@ -110,26 +111,19 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV3Writer(
110111
std::optional<int64_t> snapshot_id, std::optional<int64_t> first_row_id,
111112
std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
112113
std::shared_ptr<Schema> partition_schema) {
113-
auto schema = ParseSchema(partition_schema);
114+
// TODO(xiao.dong) parse v3 schema
115+
auto manifest_entry_schema =
116+
ManifestEntry::TypeFromPartitionType(std::move(partition_schema));
117+
auto fields_span = manifest_entry_schema->fields();
118+
std::vector<SchemaField> fields(fields_span.begin(), fields_span.end());
119+
auto schema = std::make_shared<Schema>(fields);
114120
ICEBERG_ASSIGN_OR_RAISE(auto writer,
115121
OpenFileWriter(manifest_location, schema, std::move(file_io)));
116122
auto adapter = std::make_unique<ManifestEntryAdapterV3>(snapshot_id, first_row_id,
117123
std::move(schema));
118124
return std::make_unique<ManifestWriterImpl>(std::move(writer), std::move(adapter));
119125
}
120126

121-
Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV4Writer(
122-
std::optional<int64_t> snapshot_id, std::optional<int64_t> first_row_id,
123-
std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
124-
std::shared_ptr<Schema> partition_schema) {
125-
auto schema = ParseSchema(partition_schema);
126-
ICEBERG_ASSIGN_OR_RAISE(auto writer,
127-
OpenFileWriter(manifest_location, schema, std::move(file_io)));
128-
auto adapter = std::make_unique<ManifestEntryAdapterV4>(snapshot_id, first_row_id,
129-
std::move(schema));
130-
return std::make_unique<ManifestWriterImpl>(std::move(writer), std::move(adapter));
131-
}
132-
133127
/// \brief Write manifest files to a manifest list file.
134128
class ManifestListWriterImpl : public ManifestListWriter {
135129
public:
@@ -170,6 +164,7 @@ class ManifestListWriterImpl : public ManifestListWriter {
170164
Result<std::unique_ptr<ManifestListWriter>> ManifestListWriter::MakeV1Writer(
171165
int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
172166
std::string_view manifest_list_location, std::shared_ptr<FileIO> file_io) {
167+
// TODO(xiao.dong) parse v1 schema
173168
std::vector<SchemaField> fields(ManifestFile::Type().fields().begin(),
174169
ManifestFile::Type().fields().end());
175170
auto schema = std::make_shared<Schema>(fields);
@@ -184,6 +179,7 @@ Result<std::unique_ptr<ManifestListWriter>> ManifestListWriter::MakeV2Writer(
184179
int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
185180
int64_t sequence_number, std::string_view manifest_list_location,
186181
std::shared_ptr<FileIO> file_io) {
182+
// TODO(xiao.dong) parse v2 schema
187183
std::vector<SchemaField> fields(ManifestFile::Type().fields().begin(),
188184
ManifestFile::Type().fields().end());
189185
auto schema = std::make_shared<Schema>(fields);
@@ -198,6 +194,7 @@ Result<std::unique_ptr<ManifestListWriter>> ManifestListWriter::MakeV3Writer(
198194
int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
199195
int64_t sequence_number, std::optional<int64_t> first_row_id,
200196
std::string_view manifest_list_location, std::shared_ptr<FileIO> file_io) {
197+
// TODO(xiao.dong) parse v3 schema
201198
std::vector<SchemaField> fields(ManifestFile::Type().fields().begin(),
202199
ManifestFile::Type().fields().end());
203200
auto schema = std::make_shared<Schema>(fields);
@@ -208,18 +205,4 @@ Result<std::unique_ptr<ManifestListWriter>> ManifestListWriter::MakeV3Writer(
208205
return std::make_unique<ManifestListWriterImpl>(std::move(writer), std::move(adapter));
209206
}
210207

211-
Result<std::unique_ptr<ManifestListWriter>> ManifestListWriter::MakeV4Writer(
212-
int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
213-
int64_t sequence_number, std::optional<int64_t> first_row_id,
214-
std::string_view manifest_list_location, std::shared_ptr<FileIO> file_io) {
215-
std::vector<SchemaField> fields(ManifestFile::Type().fields().begin(),
216-
ManifestFile::Type().fields().end());
217-
auto schema = std::make_shared<Schema>(fields);
218-
ICEBERG_ASSIGN_OR_RAISE(
219-
auto writer, OpenFileWriter(manifest_list_location, schema, std::move(file_io)));
220-
auto adapter = std::make_unique<ManifestFileAdapterV4>(
221-
snapshot_id, parent_snapshot_id, sequence_number, first_row_id, std::move(schema));
222-
return std::make_unique<ManifestListWriterImpl>(std::move(writer), std::move(adapter));
223-
}
224-
225208
} // namespace iceberg

src/iceberg/manifest_writer.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,6 @@ class ICEBERG_EXPORT ManifestWriter {
7777
std::optional<int64_t> snapshot_id, std::optional<int64_t> first_row_id,
7878
std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
7979
std::shared_ptr<Schema> partition_schema);
80-
81-
/// \brief Creates a writer for a manifest file.
82-
/// \param snapshot_id ID of the snapshot.
83-
/// \param first_row_id First row ID of the snapshot.
84-
/// \param manifest_location Path to the manifest file.
85-
/// \param file_io File IO implementation to use.
86-
/// \return A Result containing the writer or an error.
87-
static Result<std::unique_ptr<ManifestWriter>> MakeV4Writer(
88-
std::optional<int64_t> snapshot_id, std::optional<int64_t> first_row_id,
89-
std::string_view manifest_location, std::shared_ptr<FileIO> file_io,
90-
std::shared_ptr<Schema> partition_schema);
9180
};
9281

9382
/// \brief Write manifest files to a manifest list file.
@@ -142,19 +131,6 @@ class ICEBERG_EXPORT ManifestListWriter {
142131
int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
143132
int64_t sequence_number, std::optional<int64_t> first_row_id,
144133
std::string_view manifest_list_location, std::shared_ptr<FileIO> file_io);
145-
146-
/// \brief Creates a writer for the manifest list.
147-
/// \param snapshot_id ID of the snapshot.
148-
/// \param parent_snapshot_id ID of the parent snapshot.
149-
/// \param sequence_number Sequence number of the snapshot.
150-
/// \param first_row_id First row ID of the snapshot.
151-
/// \param manifest_list_location Path to the manifest list file.
152-
/// \param file_io File IO implementation to use.
153-
/// \return A Result containing the writer or an error.
154-
static Result<std::unique_ptr<ManifestListWriter>> MakeV4Writer(
155-
int64_t snapshot_id, std::optional<int64_t> parent_snapshot_id,
156-
int64_t sequence_number, std::optional<int64_t> first_row_id,
157-
std::string_view manifest_list_location, std::shared_ptr<FileIO> file_io);
158134
};
159135

160136
} // namespace iceberg

src/iceberg/v1_metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
/// \file iceberg/v1_metadata.h
2323

24+
#include "iceberg/manifest_adapter.h"
2425
#include "iceberg/manifest_entry.h"
2526
#include "iceberg/manifest_list.h"
26-
#include "iceberg/metadata_adapter.h"
2727

2828
namespace iceberg {
2929

src/iceberg/v2_metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
/// \file iceberg/v2_metadata.h
2323

24+
#include "iceberg/manifest_adapter.h"
2425
#include "iceberg/manifest_entry.h"
2526
#include "iceberg/manifest_list.h"
26-
#include "iceberg/metadata_adapter.h"
2727

2828
namespace iceberg {
2929

src/iceberg/v3_metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
/// \file iceberg/v3_metadata.h
2323

24+
#include "iceberg/manifest_adapter.h"
2425
#include "iceberg/manifest_entry.h"
2526
#include "iceberg/manifest_list.h"
26-
#include "iceberg/metadata_adapter.h"
2727

2828
namespace iceberg {
2929

src/iceberg/v4_metadata.h

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)