[flash 411] use compatible new datetime/ date#224
Conversation
|
/run-integration-tests |
|
/run-integration-tests |
1 similar comment
|
/run-integration-tests |
solotzg
left a comment
There was a problem hiding this comment.
Maybe you can try string_view and std::move.
| return idx; | ||
| } | ||
|
|
||
| std::vector<String> parseDateFormat(String format) |
There was a problem hiding this comment.
trimInPlace is defined as template<S> S& trimInPlace(S& str). If I pass a const ref, it will cause a compile error
| using FunctionToYYYYMMDDhhmmss = FunctionDateOrDateTimeToSomething<DataTypeUInt64, ToYYYYMMDDhhmmssImpl>; | ||
|
|
||
| using FunctionAddSeconds = FunctionDateOrDateTimeAddInterval<AddSecondsImpl>; | ||
| using FunctionAddMinutes = FunctionDateOrDateTimeAddInterval<AddMinutesImpl>; |
There was a problem hiding this comment.
looks like all the existing date/datetime udfs do not work for new datetime/date?
| { | ||
|
|
||
| const char * s = buf.position(); | ||
| if (s + 19 <= buf.buffer().end()) |
There was a problem hiding this comment.
where is the pessimistic path?
| UInt64 ymd = ((UInt64)values.year * 13 + values.month) << 5 | values.day_of_month; | ||
| UInt64 hms = (UInt64)hour << 12 | minute << 6 | second; | ||
| copy = (ymd << 17 | hms) << 24; | ||
| auto plain_text = orig.safeGet<String>(); |
There was a problem hiding this comment.
Why get String from the orig filed? The orig field is the internal representation in TiFlash, and TiFlash does not use String to represent the date/datetime
There was a problem hiding this comment.
It's only used by test. User insert datetime/date by string literal
| M(Double, 5, Float, Float64, false) \ | ||
| M(Null, 6, Nil, Nothing, false) \ | ||
| M(Timestamp, 7, Int, DateTime, false) \ | ||
| M(Timestamp, 7, Int, MyDateTime, false) \ |
There was a problem hiding this comment.
Why timestamp is mapped to MyDateTime instead of MyTimestamp?
|
Does this pr support session level timezone? And in Mysql/TiDB only the values of the Timestamp data type is affected by time zone, does TiFlash follow this principle? |
| String toString() const; | ||
| }; | ||
|
|
||
| struct MyDate : public MyTimeBase |
There was a problem hiding this comment.
MyDate inherits from MyTimeBase may introduce too much overhead. Can we use a lightweight class?
There was a problem hiding this comment.
TiDB use uint64 to store date type, we can optimize it in the future.
|
@windtalker I will support timestamp and timezone in next pr |
|
/rebuild |
|
/run-integration-tests tiflash=hanfei-new-datetime |
1 similar comment
|
/run-integration-tests tiflash=hanfei-new-datetime |
|
@windtalker PTAL again |
| MyDate, | ||
| MyDateTime, | ||
| MyTimeStamp, | ||
| MyTime |
There was a problem hiding this comment.
MyTime is mapping TypeDuration in MyTimeType enum? Better to use the same suffix, MyTime => MyDuration or TypeDuration => TypeTime
There was a problem hiding this comment.
I'd like to keep consistent with MySQL Grammar
| DECLARE_DICT_GET_TRAITS(UInt32, DataTypeDate) | ||
| DECLARE_DICT_GET_TRAITS(Int64, DataTypeDateTime) | ||
| DECLARE_DICT_GET_TRAITS(UInt16, DataTypeDate) | ||
| DECLARE_DICT_GET_TRAITS(UInt32, DataTypeDateTime) |
There was a problem hiding this comment.
why new type is not declared here?
There was a problem hiding this comment.
FunctionsExternalDictionaries.h has no relation with our own logic.
|
/run-integration-tests tiflash=hanfei-new-datetime |
| template <TP tp, typename = void> | ||
| struct DatumOp | ||
| { | ||
| static void unflatten(const Field &, std::optional<Field> &) {} |
There was a problem hiding this comment.
Don't remove unflattern/flattern methods, we are using them to deal with sign mismatch of Enum type between TiDB and TiFlash.
Just remove the unnecessary specialization version of Datum for Date/DateTime.
|
/run-integration-tests tiflash=hanfei-new-datetime |
|
/run-integration-tests tiflash=hanfei-new-datetime |
Signed-off-by: Wish <breezewish@outlook.com> Co-authored-by: JaySon <tshent@qq.com>
Signed-off-by: Wish <breezewish@outlook.com> Co-authored-by: JaySon <tshent@qq.com>
Signed-off-by: Wish <breezewish@outlook.com> Co-authored-by: JaySon <tshent@qq.com>
No description provided.