@@ -41,7 +41,7 @@ namespace iceberg {
4141// / \brief Interface for a data type for a field.
4242class ICEBERG_EXPORT Type : public iceberg::util::Formattable {
4343 public:
44- virtual ~Type () = default ;
44+ ~Type () override = default ;
4545
4646 // / \brief Get the type ID.
4747 [[nodiscard]] virtual TypeId type_id () const = 0;
@@ -79,14 +79,20 @@ class ICEBERG_EXPORT NestedType : public Type {
7979 // / \brief Get a view of the child fields.
8080 [[nodiscard]] virtual std::span<const SchemaField> fields () const = 0;
8181 // / \brief Get a field by field ID.
82+ // /
83+ // / \note This is O(1) complexity.
8284 [[nodiscard]] virtual std::optional<std::reference_wrapper<const SchemaField>>
8385 GetFieldById (int32_t field_id) const = 0 ;
8486 // / \brief Get a field by index.
87+ // /
88+ // / \note This is O(1) complexity.
8589 [[nodiscard]] virtual std::optional<std::reference_wrapper<const SchemaField>>
8690 GetFieldByIndex (int32_t index) const = 0 ;
8791 // / \brief Get a field by name (case-sensitive). Behavior is undefined if
8892 // / the field name is not unique; prefer GetFieldById or GetFieldByIndex
8993 // / when possible.
94+ // /
95+ // / \note This is currently O(n) complexity.
9096 [[nodiscard]] virtual std::optional<std::reference_wrapper<const SchemaField>>
9197 GetFieldByName (std::string_view name) const = 0 ;
9298};
@@ -99,7 +105,7 @@ class ICEBERG_EXPORT NestedType : public Type {
99105class ICEBERG_EXPORT StructType : public NestedType {
100106 public:
101107 explicit StructType (std::vector<SchemaField> fields);
102- ~StructType () = default ;
108+ ~StructType () override = default ;
103109
104110 TypeId type_id () const override ;
105111 std::string ToString () const override ;
@@ -129,7 +135,7 @@ class ICEBERG_EXPORT ListType : public NestedType {
129135 explicit ListType (SchemaField element);
130136 // / \brief Construct a list of the given element type.
131137 ListType (int32_t field_id, std::shared_ptr<Type> type, bool optional);
132- ~ListType () = default ;
138+ ~ListType () override = default ;
133139
134140 TypeId type_id () const override ;
135141 std::string ToString () const override ;
@@ -157,7 +163,7 @@ class ICEBERG_EXPORT MapType : public NestedType {
157163 // / \brief Construct a map of the given key/value fields. The field names
158164 // / should be "key" and "value", respectively.
159165 explicit MapType (SchemaField key, SchemaField value);
160- ~MapType () = default ;
166+ ~MapType () override = default ;
161167
162168 const SchemaField& key () const ;
163169 const SchemaField& value () const ;
@@ -189,7 +195,7 @@ class ICEBERG_EXPORT MapType : public NestedType {
189195class ICEBERG_EXPORT BooleanType : public PrimitiveType {
190196 public:
191197 BooleanType () = default ;
192- ~BooleanType () = default ;
198+ ~BooleanType () override = default ;
193199
194200 TypeId type_id () const override ;
195201 std::string ToString () const override ;
@@ -202,7 +208,7 @@ class ICEBERG_EXPORT BooleanType : public PrimitiveType {
202208class ICEBERG_EXPORT IntType : public PrimitiveType {
203209 public:
204210 IntType () = default ;
205- ~IntType () = default ;
211+ ~IntType () override = default ;
206212
207213 TypeId type_id () const override ;
208214 std::string ToString () const override ;
@@ -215,7 +221,7 @@ class ICEBERG_EXPORT IntType : public PrimitiveType {
215221class ICEBERG_EXPORT LongType : public PrimitiveType {
216222 public:
217223 LongType () = default ;
218- ~LongType () = default ;
224+ ~LongType () override = default ;
219225
220226 TypeId type_id () const override ;
221227 std::string ToString () const override ;
@@ -229,7 +235,7 @@ class ICEBERG_EXPORT LongType : public PrimitiveType {
229235class ICEBERG_EXPORT FloatType : public PrimitiveType {
230236 public:
231237 FloatType () = default ;
232- ~FloatType () = default ;
238+ ~FloatType () override = default ;
233239
234240 TypeId type_id () const override ;
235241 std::string ToString () const override ;
@@ -243,7 +249,7 @@ class ICEBERG_EXPORT FloatType : public PrimitiveType {
243249class ICEBERG_EXPORT DoubleType : public PrimitiveType {
244250 public:
245251 DoubleType () = default ;
246- ~DoubleType () = default ;
252+ ~DoubleType () override = default ;
247253
248254 TypeId type_id () const override ;
249255 std::string ToString () const override ;
@@ -259,7 +265,7 @@ class ICEBERG_EXPORT DecimalType : public PrimitiveType {
259265
260266 // / \brief Construct a decimal type with the given precision and scale.
261267 DecimalType (int32_t precision, int32_t scale);
262- ~DecimalType () = default ;
268+ ~DecimalType () override = default ;
263269
264270 // / \brief Get the precision (the number of decimal digits).
265271 [[nodiscard]] int32_t precision () const ;
@@ -283,7 +289,7 @@ class ICEBERG_EXPORT DecimalType : public PrimitiveType {
283289class ICEBERG_EXPORT DateType : public PrimitiveType {
284290 public:
285291 DateType () = default ;
286- ~DateType () = default ;
292+ ~DateType () override = default ;
287293
288294 TypeId type_id () const override ;
289295 std::string ToString () const override ;
@@ -297,7 +303,7 @@ class ICEBERG_EXPORT DateType : public PrimitiveType {
297303class ICEBERG_EXPORT TimeType : public PrimitiveType {
298304 public:
299305 TimeType () = default ;
300- ~TimeType () = default ;
306+ ~TimeType () override = default ;
301307
302308 TypeId type_id () const override ;
303309 std::string ToString () const override ;
@@ -321,7 +327,7 @@ class ICEBERG_EXPORT TimestampBase : public PrimitiveType {
321327class ICEBERG_EXPORT TimestampType : public TimestampBase {
322328 public:
323329 TimestampType () = default ;
324- ~TimestampType () = default ;
330+ ~TimestampType () override = default ;
325331
326332 bool is_zoned () const override ;
327333 TimeUnit time_unit () const override ;
@@ -338,7 +344,7 @@ class ICEBERG_EXPORT TimestampType : public TimestampBase {
338344class ICEBERG_EXPORT TimestampTzType : public TimestampBase {
339345 public:
340346 TimestampTzType () = default ;
341- ~TimestampTzType () = default ;
347+ ~TimestampTzType () override = default ;
342348
343349 bool is_zoned () const override ;
344350 TimeUnit time_unit () const override ;
@@ -354,7 +360,7 @@ class ICEBERG_EXPORT TimestampTzType : public TimestampBase {
354360class ICEBERG_EXPORT BinaryType : public PrimitiveType {
355361 public:
356362 BinaryType () = default ;
357- ~BinaryType () = default ;
363+ ~BinaryType () override = default ;
358364
359365 TypeId type_id () const override ;
360366 std::string ToString () const override ;
@@ -368,7 +374,7 @@ class ICEBERG_EXPORT BinaryType : public PrimitiveType {
368374class ICEBERG_EXPORT StringType : public PrimitiveType {
369375 public:
370376 StringType () = default ;
371- ~StringType () = default ;
377+ ~StringType () override = default ;
372378
373379 TypeId type_id () const override ;
374380 std::string ToString () const override ;
@@ -381,8 +387,8 @@ class ICEBERG_EXPORT StringType : public PrimitiveType {
381387class ICEBERG_EXPORT FixedType : public PrimitiveType {
382388 public:
383389 // / \brief Construct a fixed type with the given length.
384- FixedType (int32_t length);
385- ~FixedType () = default ;
390+ explicit FixedType (int32_t length);
391+ ~FixedType () override = default ;
386392
387393 // / \brief The length (the number of bytes to store).
388394 [[nodiscard]] int32_t length () const ;
@@ -402,7 +408,7 @@ class ICEBERG_EXPORT FixedType : public PrimitiveType {
402408class ICEBERG_EXPORT UuidType : public PrimitiveType {
403409 public:
404410 UuidType () = default ;
405- ~UuidType () = default ;
411+ ~UuidType () override = default ;
406412
407413 TypeId type_id () const override ;
408414 std::string ToString () const override ;
0 commit comments