xinyiZzz commented on code in PR #38215:
URL: https://github.com/apache/doris/pull/38215#discussion_r1688107589
##########
be/src/vec/data_types/serde/data_type_datetimev2_serde.cpp:
##########
@@ -112,13 +114,23 @@ void DataTypeDateTimeV2SerDe::write_column_to_arrow(const
IColumn& column, const
binary_cast<UInt64,
DateV2Value<DateTimeV2ValueType>>(col_data[i]);
datetime_val.unix_timestamp(×tamp, ctz);
- if (scale > 3) {
+ if (scale > 0) {
uint32_t microsecond = datetime_val.microsecond();
- timestamp = (timestamp * 1000000) + microsecond;
- } else if (scale > 0) {
- uint32_t millisecond = datetime_val.microsecond() / 1000;
- timestamp = (timestamp * 1000) + millisecond;
+
+ if (scale > 3) {
+ timestamp = (timestamp * 1000000) + microsecond;
+ } else {
+ uint32_t millisecond = microsecond / 1000;
+ timestamp = (timestamp * 1000) + millisecond;
+ }
+ } else {
+ timestamp *= 1000000;
}
+ timestamp -= std::chrono::duration_cast<std::chrono::seconds>(
Review Comment:
sub `1970` timestamp does not seem to be the root cause,
it seems to be a problem caused by incorrect `DATETIME` `scale`.
--
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]