This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch branch-0.15
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit c9d30107a01aa60c019b9ed22a76675dafa967fb
Author: HappenLee <happen...@hotmail.com>
AuthorDate: Mon Nov 8 21:56:14 2021 +0800

    [Bug] Change DateTimeValue Memmory Layout To Old (#7022)
    
    Change DateTimeValue Memmory Layout To Old to fix compatibility problems
---
 be/src/runtime/datetime_value.h | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/be/src/runtime/datetime_value.h b/be/src/runtime/datetime_value.h
index 12aa25e..9ddb1fa 100644
--- a/be/src/runtime/datetime_value.h
+++ b/be/src/runtime/datetime_value.h
@@ -167,12 +167,12 @@ public:
     DateTimeValue()
             : _neg(0),
               _type(TIME_DATETIME),
-              _second(0),
-              _minute(0),
               _hour(0),
-              _day(0),
-              _month(0),
+              _minute(0),
+              _second(0),
               _year(0),
+              _month(0),
+              _day(0),
               _microsecond(0) {}
 
     explicit DateTimeValue(int64_t t) { from_date_int64(t); }
@@ -625,15 +625,17 @@ private:
     bool from_date_format_str(const char* format, int format_len, const char* 
value, int value_len,
                               const char** sub_val_end);
 
-    // 1 bits for neg. 3 bits for type. 12bit for second
+    // NOTICE: it's dangerous if you want to modify the memory structure of 
datetime
+    // which will cause problem in serialization/deserialization of RowBatch.
+    // 1 bits for neg. 3 bits for type. 12bit for hour
     uint16_t _neg : 1;  // Used for time value.
     uint16_t _type : 3; // Which type of this value.
-    uint16_t _second : 12;
+    uint16_t _hour : 12;
     uint8_t _minute;
-    uint8_t _hour;
-    uint8_t _day;
-    uint8_t _month;
+    uint8_t _second;
     uint16_t _year;
+    uint8_t _month;
+    uint8_t _day;
     // TODO(zc): used for nothing
     uint64_t _microsecond;
 
@@ -641,12 +643,12 @@ private:
                   uint32_t microsecond, uint16_t year, uint8_t month, uint8_t 
day)
             : _neg(neg),
               _type(type),
-              _second(second),
-              _minute(minute),
               _hour(hour),
-              _day(day),
-              _month(month),
+              _minute(minute),
+              _second(second),
               _year(year),
+              _month(month),
+              _day(day),
               _microsecond(microsecond) {}
 
     // RE2 obj is thread safe

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to