gty404 commented on code in PR #267:
URL: https://github.com/apache/iceberg-cpp/pull/267#discussion_r2446512544


##########
src/iceberg/util/temporal_util.cc:
##########
@@ -20,6 +20,7 @@
 #include "iceberg/util/temporal_util.h"
 
 #include <chrono>
+#include <cstdint>

Review Comment:
   <cstdint> has already been added by the header



##########
src/iceberg/util/temporal_util.h:
##########
@@ -38,6 +53,24 @@ class ICEBERG_EXPORT TemporalUtils {
 
   /// \brief Extract a timestamp hour, as hours from 1970-01-01 00:00:00
   static Result<Literal> ExtractHour(const Literal& literal);
+
+  /// \brief Construct a Calendar date without timezone or time
+  static int32_t CreateDate(const TemporalParts& parts);

Review Comment:
   Should these functions return a `Result<>`, returning an error message when 
the parameters in TemporalParts are invalid?



##########
src/iceberg/util/temporal_util.h:
##########
@@ -19,12 +19,27 @@
 
 #pragma once
 
+#include <cstdint>
+
 #include "iceberg/iceberg_export.h"
 #include "iceberg/result.h"
 #include "iceberg/type_fwd.h"
 
 namespace iceberg {
 
+struct ICEBERG_EXPORT TemporalParts {
+  int32_t year{0};
+  uint16_t month{0};
+  uint16_t day{0};
+  int32_t hour{0};
+  int32_t minute{0};
+  int32_t second{0};
+  int32_t microsecond{0};
+  int32_t nanosecond{0};
+  // e.g. -480 for PST (UTC-8:00), +480 for Asia/Shanghai (UTC+8:00)
+  int32_t tz_offset_minutes;

Review Comment:
   Initialize with a default value or use optional to avoid UB ?



##########
src/iceberg/util/temporal_util.h:
##########
@@ -19,12 +19,27 @@
 
 #pragma once
 
+#include <cstdint>
+
 #include "iceberg/iceberg_export.h"
 #include "iceberg/result.h"
 #include "iceberg/type_fwd.h"
 
 namespace iceberg {
 
+struct ICEBERG_EXPORT TemporalParts {
+  int32_t year{0};
+  uint16_t month{0};
+  uint16_t day{0};

Review Comment:
   consider uint8_t or std::chrono::month/std::chrono::day as the type of 
month/day ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to