Skip to content
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

Merged
merged 43 commits into from
Aug 28, 2017
Merged

Conversation

hicqu
Copy link
Contributor

@hicqu hicqu commented Aug 23, 2017

No description provided.

@@ -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| {
Copy link
Member

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.

.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))
Copy link
Member

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.

let tz = if tp == types::TIMESTAMP {
ctx.tz
} else {
FixedOffset::east(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

@BusyJay BusyJay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@AndreMouche AndreMouche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hicqu hicqu merged commit 6c8eeb8 into master Aug 28, 2017
@hicqu hicqu deleted the qupeng/expr-time branch August 28, 2017 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants