-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
coprocessor, dag: support decode Time from tipb.Expr #2199
Conversation
src/coprocessor/dag/expr/mod.rs
Outdated
@@ -379,6 +380,15 @@ impl Expression { | |||
.map(Datum::F64) | |||
.map(|e| Expression::new_const(e, tp)) | |||
.map_err(Error::from), | |||
ExprType::MysqlTime => expr.get_val() | |||
.decode_u64() | |||
.and_then(|ts| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts
is confusing considering this is not a timestamp actually.
src/coprocessor/dag/expr/mod.rs
Outdated
.and_then(|ts| { | ||
let fsp = expr.get_field_type().get_decimal() as i8; | ||
let tp = expr.get_field_type().get_tp() as u8; | ||
Time::from_packed_u64(ts, tp, fsp, &FixedOffset::east(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use timezone from context.
src/coprocessor/dag/expr/mod.rs
Outdated
let tz = if tp == types::TIMESTAMP { | ||
ctx.tz | ||
} else { | ||
FixedOffset::east(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to TiDB, all timestamp should be adjust to timezone UTC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's correct. All time should be converted to the tz specified in context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.