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

expression: use ParseTimeFormNum instead of ParseTime #4706

Merged
merged 5 commits into from Oct 9, 2017

Conversation

Projects
None yet
6 participants
@mccxj
Contributor

mccxj commented Oct 2, 2017

dayOfWeek/dayOfMonth/dayOfYear and monthname/dayname with int64 will call call builtinCastIntAsTime, the behavior is diff from mysql. eg. dayOfWeek(123) works fine at mysql, but tidb will cause a error.

so, we should use ParseTimeFormNum instead of ParseTime, it is the code migration version of mysql's number_to_datetime func.

mysql

MySQL [test]> set sql_mode='STRICT_TRANS_TABLES';
Query OK, 0 rows affected, 2 warnings (0.00 sec)

MySQL [test]> delete from t where a=dayOfWeek(123);
Query OK, 1 row affected (0.16 sec)

MySQL [test]> insert into t value(dayOfMonth('2017-00-00'));
Query OK, 1 row affected (0.14 sec)

MySQL [test]> delete from t where a = dayOfMonth(123);
Query OK, 0 rows affected (0.00 sec)

MySQL [test]> delete from t where a = dayOfYear(123);
Query OK, 0 rows affected (0.00 sec)

MySQL [test]> delete from t where a = monthname(123);
Query OK, 2 rows affected (0.13 sec)

MySQL [test]> delete from t where a = dayname(123);
Query OK, 0 rows affected (0.00 sec)
@sre-bot

This comment has been minimized.

Show comment
Hide comment
@sre-bot

sre-bot Oct 2, 2017

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

sre-bot commented Oct 2, 2017

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

@mccxj mccxj changed the title from expression: use ParseDatetimeFormNum instead of ParseTime to expression: use ParseTimeFormNum instead of ParseTime Oct 2, 2017

@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli

shenli Oct 3, 2017

Member

@mccxj Thanks!

Member

shenli commented Oct 3, 2017

@mccxj Thanks!

@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli

shenli Oct 3, 2017

Member

/run-all-tests

Member

shenli commented Oct 3, 2017

/run-all-tests

@shenli

This comment has been minimized.

Show comment
Hide comment
@shenli

shenli Oct 3, 2017

Member

/ok-to-test

Member

shenli commented Oct 3, 2017

/ok-to-test

@zz-jason

This comment has been minimized.

Show comment
Hide comment
@zz-jason

zz-jason Oct 9, 2017

Member

LGTM
@XuHuaiyu PTAL

Member

zz-jason commented Oct 9, 2017

LGTM
@XuHuaiyu PTAL

@zz-jason zz-jason added the status/LGT1 label Oct 9, 2017

@XuHuaiyu

This comment has been minimized.

Show comment
Hide comment
@XuHuaiyu

XuHuaiyu Oct 9, 2017

Contributor

/run-all-test

Contributor

XuHuaiyu commented Oct 9, 2017

/run-all-test

@XuHuaiyu

LGTM

@XuHuaiyu XuHuaiyu added status/LGT2 and removed status/LGT1 labels Oct 9, 2017

@coocood coocood merged commit 17b3a37 into pingcap:master Oct 9, 2017

3 of 4 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
ci/circleci Your tests passed on CircleCI!
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@mccxj mccxj deleted the mccxj:issue-number-to-datetime branch Oct 9, 2017

mccxj added a commit to mccxj/tidb that referenced this pull request Oct 10, 2017

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