Skip to content

Commit d69d437

Browse files
committed
Revert "chore: add MakeRequiredField/MakeOptionalField to resolve lengthy lines"
This reverts commit 7612e4a881966fbc7dc16a6d2ddeef181bc99c42.
1 parent 481e682 commit d69d437

File tree

3 files changed

+85
-73
lines changed

3 files changed

+85
-73
lines changed

src/iceberg/manifest_entry.h

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -190,57 +190,78 @@ struct ICEBERG_EXPORT DataFile {
190190
/// present
191191
std::optional<int64_t> content_size_in_bytes;
192192

193-
inline static const SchemaField kContent = MakeRequiredField<IntType>(134, "content");
193+
inline static const SchemaField kContent =
194+
SchemaField::MakeRequired(134, "content", std::make_shared<IntType>());
194195
inline static const SchemaField kFilePath =
195-
MakeRequiredField<StringType>(100, "file_path");
196+
SchemaField::MakeRequired(100, "file_path", std::make_shared<StringType>());
196197
inline static const SchemaField kFileFormat =
197-
MakeRequiredField<IntType>(101, "file_format");
198+
SchemaField::MakeRequired(101, "file_format", std::make_shared<IntType>());
198199
inline static const SchemaField kRecordCount =
199-
MakeRequiredField<LongType>(103, "record_count");
200+
SchemaField::MakeRequired(103, "record_count", std::make_shared<LongType>());
200201
inline static const SchemaField kFileSize =
201-
MakeRequiredField<LongType>(104, "file_size_in_bytes");
202-
inline static const SchemaField kColumnSizes = MakeOptionalField<MapType>(
202+
SchemaField::MakeRequired(104, "file_size_in_bytes", std::make_shared<LongType>());
203+
inline static const SchemaField kColumnSizes = SchemaField::MakeOptional(
203204
108, "column_sizes",
204-
MakeRequiredField<IntType>(117, std::string(MapType::kKeyName)),
205-
MakeRequiredField<LongType>(118, std::string(MapType::kValueName)));
206-
inline static const SchemaField kValueCounts = MakeOptionalField<MapType>(
205+
std::make_shared<MapType>(
206+
SchemaField::MakeRequired(117, std::string(MapType::kKeyName),
207+
std::make_shared<IntType>()),
208+
SchemaField::MakeRequired(118, std::string(MapType::kValueName),
209+
std::make_shared<LongType>())));
210+
inline static const SchemaField kValueCounts = SchemaField::MakeOptional(
207211
109, "value_counts",
208-
MakeRequiredField<IntType>(119, std::string(MapType::kKeyName)),
209-
MakeRequiredField<LongType>(120, std::string(MapType::kValueName)));
210-
inline static const SchemaField kNullValueCounts = MakeOptionalField<MapType>(
212+
std::make_shared<MapType>(
213+
SchemaField::MakeRequired(119, std::string(MapType::kKeyName),
214+
std::make_shared<IntType>()),
215+
SchemaField::MakeRequired(120, std::string(MapType::kValueName),
216+
std::make_shared<LongType>())));
217+
inline static const SchemaField kNullValueCounts = SchemaField::MakeOptional(
211218
110, "null_value_counts",
212-
MakeRequiredField<IntType>(121, std::string(MapType::kKeyName)),
213-
MakeRequiredField<LongType>(122, std::string(MapType::kValueName)));
214-
inline static const SchemaField kNanValueCounts = MakeOptionalField<MapType>(
219+
std::make_shared<MapType>(
220+
SchemaField::MakeRequired(121, std::string(MapType::kKeyName),
221+
std::make_shared<IntType>()),
222+
SchemaField::MakeRequired(122, std::string(MapType::kValueName),
223+
std::make_shared<LongType>())));
224+
inline static const SchemaField kNanValueCounts = SchemaField::MakeOptional(
215225
137, "nan_value_counts",
216-
MakeRequiredField<IntType>(138, std::string(MapType::kKeyName)),
217-
MakeRequiredField<LongType>(139, std::string(MapType::kValueName)));
218-
inline static const SchemaField kLowerBounds = MakeOptionalField<MapType>(
226+
std::make_shared<MapType>(
227+
SchemaField::MakeRequired(138, std::string(MapType::kKeyName),
228+
std::make_shared<IntType>()),
229+
SchemaField::MakeRequired(139, std::string(MapType::kValueName),
230+
std::make_shared<LongType>())));
231+
inline static const SchemaField kLowerBounds = SchemaField::MakeOptional(
219232
125, "lower_bounds",
220-
MakeRequiredField<IntType>(126, std::string(MapType::kKeyName)),
221-
MakeRequiredField<BinaryType>(127, std::string(MapType::kValueName)));
222-
inline static const SchemaField kUpperBounds = MakeOptionalField<MapType>(
233+
std::make_shared<MapType>(
234+
SchemaField::MakeRequired(126, std::string(MapType::kKeyName),
235+
std::make_shared<IntType>()),
236+
SchemaField::MakeRequired(127, std::string(MapType::kValueName),
237+
std::make_shared<BinaryType>())));
238+
inline static const SchemaField kUpperBounds = SchemaField::MakeOptional(
223239
128, "upper_bounds",
224-
MakeRequiredField<IntType>(129, std::string(MapType::kKeyName)),
225-
MakeRequiredField<BinaryType>(130, std::string(MapType::kValueName)));
240+
std::make_shared<MapType>(
241+
SchemaField::MakeRequired(129, std::string(MapType::kKeyName),
242+
std::make_shared<IntType>()),
243+
SchemaField::MakeRequired(130, std::string(MapType::kValueName),
244+
std::make_shared<BinaryType>())));
226245
inline static const SchemaField kKeyMetadata =
227-
MakeOptionalField<BinaryType>(131, "key_metadata");
228-
inline static const SchemaField kSplitOffsets = MakeOptionalField<ListType>(
246+
SchemaField::MakeOptional(131, "key_metadata", std::make_shared<BinaryType>());
247+
inline static const SchemaField kSplitOffsets = SchemaField::MakeOptional(
229248
132, "split_offsets",
230-
MakeRequiredField<LongType>(133, std::string(ListType::kElementName)));
231-
inline static const SchemaField kEqualityIds = MakeOptionalField<ListType>(
249+
std::make_shared<ListType>(SchemaField::MakeRequired(
250+
133, std::string(ListType::kElementName), std::make_shared<LongType>())));
251+
inline static const SchemaField kEqualityIds = SchemaField::MakeOptional(
232252
135, "equality_ids",
233-
MakeRequiredField<IntType>(136, std::string(ListType::kElementName)));
253+
std::make_shared<ListType>(SchemaField::MakeRequired(
254+
136, std::string(ListType::kElementName), std::make_shared<IntType>())));
234255
inline static const SchemaField kSortOrderId =
235-
MakeOptionalField<IntType>(140, "sort_order_id");
256+
SchemaField::MakeOptional(140, "sort_order_id", std::make_shared<IntType>());
236257
inline static const SchemaField kFirstRowId =
237-
MakeOptionalField<LongType>(142, "first_row_id");
238-
inline static const SchemaField kReferencedDataFile =
239-
MakeOptionalField<StringType>(143, "referenced_data_file");
258+
SchemaField::MakeOptional(142, "first_row_id", std::make_shared<LongType>());
259+
inline static const SchemaField kReferencedDataFile = SchemaField::MakeOptional(
260+
143, "referenced_data_file", std::make_shared<StringType>());
240261
inline static const SchemaField kContentOffset =
241-
MakeOptionalField<LongType>(144, "content_offset");
242-
inline static const SchemaField kContentSize =
243-
MakeOptionalField<LongType>(145, "content_size_in_bytes");
262+
SchemaField::MakeOptional(144, "content_offset", std::make_shared<LongType>());
263+
inline static const SchemaField kContentSize = SchemaField::MakeOptional(
264+
145, "content_size_in_bytes", std::make_shared<LongType>());
244265

245266
static std::shared_ptr<StructType> Type(std::shared_ptr<StructType> partition_type);
246267
};
@@ -269,13 +290,14 @@ struct ICEBERG_EXPORT ManifestEntry {
269290
/// File path, partition tuple, metrics, ...
270291
DataFile data_file;
271292

272-
inline static const SchemaField kStatus = MakeRequiredField<IntType>(0, "status");
293+
inline static const SchemaField kStatus =
294+
SchemaField::MakeRequired(0, "status", std::make_shared<IntType>());
273295
inline static const SchemaField kSnapshotId =
274-
MakeOptionalField<LongType>(1, "snapshot_id");
296+
SchemaField::MakeOptional(1, "snapshot_id", std::make_shared<LongType>());
275297
inline static const SchemaField kSequenceNumber =
276-
MakeOptionalField<LongType>(3, "sequence_number");
298+
SchemaField::MakeOptional(3, "sequence_number", std::make_shared<LongType>());
277299
inline static const SchemaField kFileSequenceNumber =
278-
MakeOptionalField<LongType>(4, "file_sequence_number");
300+
SchemaField::MakeOptional(4, "file_sequence_number", std::make_shared<LongType>());
279301

280302
static std::shared_ptr<StructType> TypeFromPartitionType(
281303
std::shared_ptr<StructType> partition_type);

src/iceberg/manifest_list.h

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ struct ICEBERG_EXPORT PartitionFieldSummary {
8181
std::optional<std::vector<uint8_t>> upper_bound;
8282

8383
inline static const SchemaField kConsTainsNull =
84-
MakeRequiredField<BooleanType>(509, "contains_null");
84+
SchemaField::MakeRequired(509, "contains_null", std::make_shared<BooleanType>());
8585
inline static const SchemaField kContainsNaN =
86-
MakeOptionalField<BooleanType>(518, "contains_nan");
86+
SchemaField::MakeOptional(518, "contains_nan", std::make_shared<BooleanType>());
8787
inline static const SchemaField kLowerBound =
88-
MakeOptionalField<BinaryType>(510, "lower_bound");
88+
SchemaField::MakeOptional(510, "lower_bound", std::make_shared<BinaryType>());
8989
inline static const SchemaField kUpperBound =
90-
MakeOptionalField<BinaryType>(511, "upper_bound");
90+
SchemaField::MakeOptional(511, "upper_bound", std::make_shared<BinaryType>());
9191

9292
static const StructType& Type();
9393
};
@@ -165,38 +165,40 @@ struct ICEBERG_EXPORT ManifestFile {
165165
bool has_deleted_files() const { return deleted_files_count.value_or(-1) > 0; }
166166

167167
inline static const SchemaField kManifestPath =
168-
MakeRequiredField<StringType>(500, "manifest_path");
168+
SchemaField::MakeRequired(500, "manifest_path", std::make_shared<StringType>());
169169
inline static const SchemaField kManifestLength =
170-
MakeRequiredField<LongType>(501, "manifest_length");
170+
SchemaField::MakeRequired(501, "manifest_length", std::make_shared<LongType>());
171171
inline static const SchemaField kPartitionSpecId =
172-
MakeRequiredField<IntType>(502, "partition_spec_id");
173-
inline static const SchemaField kContent = MakeOptionalField<IntType>(517, "content");
172+
SchemaField::MakeRequired(502, "partition_spec_id", std::make_shared<IntType>());
173+
inline static const SchemaField kContent =
174+
SchemaField::MakeOptional(517, "content", std::make_shared<IntType>());
174175
inline static const SchemaField kSequenceNumber =
175-
MakeOptionalField<LongType>(515, "sequence_number");
176+
SchemaField::MakeOptional(515, "sequence_number", std::make_shared<LongType>());
176177
inline static const SchemaField kMinSequenceNumber =
177-
MakeOptionalField<LongType>(516, "min_sequence_number");
178+
SchemaField::MakeOptional(516, "min_sequence_number", std::make_shared<LongType>());
178179
inline static const SchemaField kAddedSnapshotId =
179-
MakeRequiredField<LongType>(503, "added_snapshot_id");
180+
SchemaField::MakeRequired(503, "added_snapshot_id", std::make_shared<LongType>());
180181
inline static const SchemaField kAddedFilesCount =
181-
MakeOptionalField<IntType>(504, "added_files_count");
182+
SchemaField::MakeOptional(504, "added_files_count", std::make_shared<IntType>());
182183
inline static const SchemaField kExistingFilesCount =
183-
MakeOptionalField<IntType>(505, "existing_files_count");
184+
SchemaField::MakeOptional(505, "existing_files_count", std::make_shared<IntType>());
184185
inline static const SchemaField kDeletedFilesCount =
185-
MakeOptionalField<IntType>(506, "deleted_files_count");
186+
SchemaField::MakeOptional(506, "deleted_files_count", std::make_shared<IntType>());
186187
inline static const SchemaField kAddedRowsCount =
187-
MakeOptionalField<LongType>(512, "added_rows_count");
188+
SchemaField::MakeOptional(512, "added_rows_count", std::make_shared<LongType>());
188189
inline static const SchemaField kExistingRowsCount =
189-
MakeOptionalField<LongType>(513, "existing_rows_count");
190+
SchemaField::MakeOptional(513, "existing_rows_count", std::make_shared<LongType>());
190191
inline static const SchemaField kDeletedRowsCount =
191-
MakeOptionalField<LongType>(514, "deleted_rows_count");
192-
inline static const SchemaField kPartitions = MakeOptionalField<ListType>(
192+
SchemaField::MakeOptional(514, "deleted_rows_count", std::make_shared<LongType>());
193+
inline static const SchemaField kPartitions = SchemaField::MakeOptional(
193194
507, "partitions",
194-
MakeRequiredField<StructType>(508, std::string(ListType::kElementName),
195-
PartitionFieldSummary::Type()));
195+
std::make_shared<ListType>(SchemaField::MakeRequired(
196+
508, std::string(ListType::kElementName),
197+
std::make_shared<StructType>(PartitionFieldSummary::Type()))));
196198
inline static const SchemaField kKeyMetadata =
197-
MakeOptionalField<BinaryType>(519, "key_metadata");
199+
SchemaField::MakeOptional(519, "key_metadata", std::make_shared<BinaryType>());
198200
inline static const SchemaField kFirstRowId =
199-
MakeOptionalField<LongType>(520, "first_row_id");
201+
SchemaField::MakeOptional(520, "first_row_id", std::make_shared<LongType>());
200202

201203
static const StructType& Type();
202204
};

src/iceberg/schema_field.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,4 @@ class ICEBERG_EXPORT SchemaField : public iceberg::util::Formattable {
9191
std::string doc_;
9292
};
9393

94-
template <typename T, typename... Args>
95-
inline SchemaField MakeRequiredField(int id, std::string name, Args&&... args) {
96-
return SchemaField::MakeRequired(id, std::move(name),
97-
std::make_shared<T>(std::forward<Args>(args)...));
98-
}
99-
100-
template <typename T, typename... Args>
101-
inline SchemaField MakeOptionalField(int id, std::string name, Args&&... args) {
102-
return SchemaField::MakeOptional(id, std::move(name),
103-
std::make_shared<T>(std::forward<Args>(args)...));
104-
}
105-
10694
} // namespace iceberg

0 commit comments

Comments
 (0)