@@ -83,7 +83,7 @@ class ICEBERG_EXPORT NestedType : public Type {
8383 GetFieldById (int32_t field_id) const = 0 ;
8484 // / \brief Get a field by index.
8585 [[nodiscard]] virtual std::optional<std::reference_wrapper<const SchemaField>>
86- GetFieldByIndex (int i ) const = 0 ;
86+ GetFieldByIndex (int32_t index ) const = 0 ;
8787 // / \brief Get a field by name.
8888 [[nodiscard]] virtual std::optional<std::reference_wrapper<const SchemaField>>
8989 GetFieldByName (std::string_view name) const = 0 ;
@@ -212,27 +212,43 @@ class ICEBERG_EXPORT TimeType : public PrimitiveType {
212212 bool Equals (const Type& other) const override ;
213213};
214214
215+ // / \brief A base class for any timestamp time (irrespective of unit or
216+ // / timezone).
217+ class ICEBERG_EXPORT TimestampBase : public PrimitiveType {
218+ public:
219+ // / \brief Is this type zoned or naive?
220+ [[nodiscard]] virtual bool is_zoned () const = 0;
221+ // / \brief The time resolution.
222+ [[nodiscard]] virtual TimeUnit time_unit () const = 0;
223+ };
224+
215225// / \brief A data type representing a timestamp in microseconds without
216226// / reference to a timezone.
217- class ICEBERG_EXPORT TimestampType : public PrimitiveType {
227+ class ICEBERG_EXPORT TimestampType : public TimestampBase {
218228 public:
219229 TimestampType () = default ;
220230 ~TimestampType () = default ;
221231
232+ bool is_zoned () const override ;
233+ TimeUnit time_unit () const override ;
234+
222235 TypeId type_id () const override ;
223236 std::string ToString () const override ;
224237
225238 protected:
226239 bool Equals (const Type& other) const override ;
227240};
228241
229- // / \brief A data type representing a timestamp in microseconds in a
230- // / particular timezone .
231- class ICEBERG_EXPORT TimestampTzType : public PrimitiveType {
242+ // / \brief A data type representing a timestamp as microseconds since the
243+ // / epoch in UTC .
244+ class ICEBERG_EXPORT TimestampTzType : public TimestampBase {
232245 public:
233246 TimestampTzType () = default ;
234247 ~TimestampTzType () = default ;
235248
249+ bool is_zoned () const override ;
250+ TimeUnit time_unit () const override ;
251+
236252 TypeId type_id () const override ;
237253 std::string ToString () const override ;
238254
@@ -325,7 +341,7 @@ class ICEBERG_EXPORT ListType : public NestedType {
325341 std::optional<std::reference_wrapper<const SchemaField>> GetFieldById (
326342 int32_t field_id) const override ;
327343 std::optional<std::reference_wrapper<const SchemaField>> GetFieldByIndex (
328- int i ) const override ;
344+ int32_t index ) const override ;
329345 std::optional<std::reference_wrapper<const SchemaField>> GetFieldByName (
330346 std::string_view name) const override ;
331347
@@ -356,7 +372,7 @@ class ICEBERG_EXPORT MapType : public NestedType {
356372 std::optional<std::reference_wrapper<const SchemaField>> GetFieldById (
357373 int32_t field_id) const override ;
358374 std::optional<std::reference_wrapper<const SchemaField>> GetFieldByIndex (
359- int i ) const override ;
375+ int32_t index ) const override ;
360376 std::optional<std::reference_wrapper<const SchemaField>> GetFieldByName (
361377 std::string_view name) const override ;
362378
@@ -379,7 +395,7 @@ class ICEBERG_EXPORT StructType : public NestedType {
379395 std::optional<std::reference_wrapper<const SchemaField>> GetFieldById (
380396 int32_t field_id) const override ;
381397 std::optional<std::reference_wrapper<const SchemaField>> GetFieldByIndex (
382- int i ) const override ;
398+ int32_t index ) const override ;
383399 std::optional<std::reference_wrapper<const SchemaField>> GetFieldByName (
384400 std::string_view name) const override ;
385401
0 commit comments