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
Commits
Jump to file or symbol
Failed to load files and symbols.
+5 −12
Diff settings

Always

Just for now

Viewing a subset of changes. View all

fix

  • Loading branch information...
hicqu committed Aug 23, 2017
commit 284350b2c4f4b6af1eff9668a5c5fb7838b6e6af
@@ -364,22 +364,15 @@ impl Expression {
.map(Datum::F64)
.map(|e| Expression::new_const(e, tp))
.map_err(Error::from),
ExprType::MysqlTime => {
let ts = expr.get_val().decode_u64();
expr.get_val()
ExprType::MysqlTime => expr.get_val()
.decode_u64()
.and_then(|n| {
let tz = FixedOffset::east(0);
let tm = Time::from_packed_u64(n, types::DATETIME, MAX_FSP, &tz)
.map(|t| {
t.
})
tm.get_fs
.and_then(|ts| {

This comment has been minimized.

@BusyJay

BusyJay Aug 24, 2017

Contributor

ts is confusing considering this is not a timestamp actually.

@BusyJay

BusyJay Aug 24, 2017

Contributor

ts is confusing considering this is not a timestamp actually.

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))

This comment has been minimized.

@BusyJay

BusyJay Aug 24, 2017

Contributor

Should use timezone from context.

@BusyJay

BusyJay Aug 24, 2017

Contributor

Should use timezone from context.

})
.map(|t| Expression::new_const(Datum::Time(t), tp))
.map_err(Error::from),
}
ExprType::MysqlDuration => expr.get_val()
.decode_i64()
.and_then(|n| Duration::from_nanos(n, MAX_FSP))
ProTip! Use n and p to navigate between commits in a pull request.