zhjwpku commented on code in PR #653:
URL: https://github.com/apache/iceberg-cpp/pull/653#discussion_r3289845253
##########
src/iceberg/util/temporal_util.cc:
##########
@@ -21,19 +21,40 @@
#include <chrono>
#include <cstdint>
+#include <limits>
#include <utility>
#include "iceberg/expression/literal.h"
+#include "iceberg/util/int128.h"
namespace iceberg {
namespace {
using namespace std::chrono; // NOLINT
+constexpr int64_t kNanosPerMicro = 1000;
+
constexpr auto kEpochYmd = year{1970} / January / 1;
constexpr auto kEpochDays = sys_days(kEpochYmd);
+inline constexpr int64_t FloorDiv(int64_t dividend, int64_t divisor) {
+ const auto quotient = dividend / divisor;
+ if ((dividend ^ divisor) < 0 && quotient * divisor != dividend) {
+ return quotient - 1;
+ }
+ return quotient;
+}
+
+Result<int64_t> MultiplyExact(int64_t lhs, int64_t rhs) {
Review Comment:
Yeah, I also noticed that most of the utilities in `transform_util.h` seem
to belong more naturally in a temporal_util. I'll create a separate PR to
address these issues.
--
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]