Skip to content

Commit

Permalink
[Bug] Change DateTimeValue Memmory Layout To Old (apache#7022)
Browse files Browse the repository at this point in the history
Change DateTimeValue Memmory Layout To Old to fix compatibility problems
  • Loading branch information
HappenLee authored and morningman-cmy committed Nov 8, 2021
1 parent 987ca1f commit c9d3010
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions be/src/runtime/datetime_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ class DateTimeValue {
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); }
Expand Down Expand Up @@ -625,28 +625,30 @@ class DateTimeValue {
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;

DateTimeValue(uint8_t neg, uint8_t type, uint8_t hour, uint8_t minute, uint8_t second,
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
Expand Down

0 comments on commit c9d3010

Please sign in to comment.