github-actions[bot] commented on code in PR #25966:
URL: https://github.com/apache/doris/pull/25966#discussion_r1372987171
##########
be/src/vec/functions/date_time_transforms.h:
##########
@@ -213,14 +213,17 @@ struct DateFormatImpl {
// TODO: This function should be depend on arguments not always nullable
template <typename DateType>
struct FromUnixTimeImpl {
- using FromType = Int32;
-
+ using FromType = Int64;
+ //
https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_from-unixtime
+ // Keep consistent with MySQL
+ static const int64_t TIMESTAMP_VALID_MAX = 32536771199;
static constexpr auto name = "from_unixtime";
static inline auto execute(FromType val, StringRef format,
ColumnString::Chars& res_data,
size_t& offset, const cctz::time_zone&
time_zone) {
DateType dt;
- if (format.size > 128 || val < 0 || val > INT_MAX ||
!dt.from_unixtime(val, time_zone)) {
+ if (format.size > 128 || val < 0 || val > TIMESTAMP_VALID_MAX ||
Review Comment:
warning: 128 is a magic number; consider replacing it with a named constant
[readability-magic-numbers]
```cpp
if (format.size > 128 || val < 0 || val > TIMESTAMP_VALID_MAX ||
^
```
--
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]