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

*: check sc.IgnoreZeroInDate when parsing string or number to date/datetime/timestamp #4732

Merged
merged 9 commits into from Oct 11, 2017

Conversation

Projects
None yet
4 participants
@XuHuaiyu
Contributor

XuHuaiyu commented Oct 10, 2017

fix #4653

  1. add an IgnoreZeroInDate attribute in StatementContext
  2. check sc.IgnoreZeroInDate when parse string or number to date/datetime/timestamp

PTAL @coocood @winkyao @zz-jason

XuHuaiyu added some commits Oct 10, 2017

1. add an IgnoreZeroInDate attribute in StatementContext
2. check sc.IgnoreZeroInDate when parse string or number to date/datetime/timestamp
Merge branch 'master' of https://github.com/pingcap/tidb into xhy/new…
…function

Conflicts:
	expression/builtin_cast.go
	expression/builtin_time_test.go
	expression/helper.go
@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli

shenli Oct 10, 2017

Member

Should we also update coprocessor?

Member

shenli commented Oct 10, 2017

Should we also update coprocessor?

@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli

shenli Oct 10, 2017

Member

CI is failed.

Member

shenli commented Oct 10, 2017

CI is failed.

@XuHuaiyu

This comment has been minimized.

Show comment
Hide comment
@XuHuaiyu

XuHuaiyu Oct 10, 2017

Contributor

\cc @AndreMouche @hicqu
Coprocessor may also need to update this.

Contributor

XuHuaiyu commented Oct 10, 2017

\cc @AndreMouche @hicqu
Coprocessor may also need to update this.

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason

zz-jason Oct 10, 2017

Member

/run-all-test

Member

zz-jason commented Oct 10, 2017

/run-all-test

@@ -513,7 +513,7 @@ func (b *builtinCastIntAsTimeSig) evalTime(row []types.Datum) (res types.Time, i
if isNull || err != nil {
return res, isNull, errors.Trace(err)
}
res, err = types.ParseTimeFromNum(val, b.tp.Tp, b.tp.Decimal)
res, err = types.ParseTimeFromNum(sc, val, b.tp.Tp, b.tp.Decimal)

This comment has been minimized.

@zz-jason

zz-jason Oct 10, 2017

Member

we should check err firstly before using res ?

@zz-jason

zz-jason Oct 10, 2017

Member

we should check err firstly before using res ?

@@ -816,7 +817,7 @@ func (b *builtinCastDecimalAsTimeSig) evalTime(row []types.Datum) (res types.Tim
if isNull || err != nil {
return res, isNull, errors.Trace(err)
}
res, err = types.ParseTime(string(val.ToString()), b.tp.Tp, b.tp.Decimal)
res, err = types.ParseTime(sc, string(val.ToString()), b.tp.Tp, b.tp.Decimal)

This comment has been minimized.

@zz-jason

zz-jason Oct 10, 2017

Member

ditto

@zz-jason
@@ -969,7 +971,7 @@ func (b *builtinCastStringAsTimeSig) evalTime(row []types.Datum) (res types.Time
if isNull || err != nil {
return res, isNull, errors.Trace(err)
}
res, err = types.ParseTime(val, b.tp.Tp, b.tp.Decimal)
res, err = types.ParseTime(sc, val, b.tp.Tp, b.tp.Decimal)

This comment has been minimized.

@zz-jason

zz-jason Oct 10, 2017

Member

ditto

@zz-jason
@@ -1265,7 +1267,7 @@ func (b *builtinCastJSONAsTimeSig) evalTime(row []types.Datum) (res types.Time,
if err != nil {
return res, false, errors.Trace(err)
}
res, err = types.ParseTime(s, b.tp.Tp, b.tp.Decimal)
res, err = types.ParseTime(sc, s, b.tp.Tp, b.tp.Decimal)

This comment has been minimized.

@zz-jason

zz-jason Oct 10, 2017

Member

ditto

@zz-jason
@XuHuaiyu

This comment has been minimized.

Show comment
Hide comment
@XuHuaiyu
Contributor

XuHuaiyu commented Oct 10, 2017

@coocood

This comment has been minimized.

Show comment
Hide comment
@coocood

coocood Oct 10, 2017

Member

LGTM

Member

coocood commented Oct 10, 2017

LGTM

XuHuaiyu added some commits Oct 11, 2017

@XuHuaiyu

This comment has been minimized.

Show comment
Hide comment
@XuHuaiyu

XuHuaiyu Oct 11, 2017

Contributor

PTAL @zz-jason
This commit should be merged with pingcap/tidb-test#368 toghther.

Contributor

XuHuaiyu commented Oct 11, 2017

PTAL @zz-jason
This commit should be merged with pingcap/tidb-test#368 toghther.

@XuHuaiyu

This comment has been minimized.

Show comment
Hide comment
@XuHuaiyu

XuHuaiyu Oct 11, 2017

Contributor

/run-all-test

Contributor

XuHuaiyu commented Oct 11, 2017

/run-all-test

@XuHuaiyu

This comment has been minimized.

Show comment
Hide comment
@XuHuaiyu

XuHuaiyu Oct 11, 2017

Contributor

/run-common-test
/run-integration-common-test

Contributor

XuHuaiyu commented Oct 11, 2017

/run-common-test
/run-integration-common-test

@XuHuaiyu XuHuaiyu merged commit 7d2804e into master Oct 11, 2017

11 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on master at 72.615%
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
jenkins-ci-tidb/common-test Jenkins job succeeded.
Details
jenkins-ci-tidb/integration-common-test Jenkins job succeeded.
Details
jenkins-ci-tidb/integration-ddl-test Jenkins job succeeded.
Details
jenkins-ci-tidb/mybatis-test Jenkins job succeeded.
Details
jenkins-ci-tidb/sqllogic-test Jenkins job succeeded.
Details
jenkins-ci-tidb/unit-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@XuHuaiyu XuHuaiyu deleted the xhy/newfunction branch Oct 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment