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

expression: fix cast(-num as datetime) to return null instead of error #10368

Merged
merged 8 commits into from
May 8, 2019

Conversation

qw4990
Copy link
Contributor

@qw4990 qw4990 commented May 6, 2019

What problem does this PR solve?

Fix #9769

What is changed and how it works?

Call handleInvalidTimeError to handle errors.

Check List

Tests

  • Unit test

{0, types.NewIntDatum(0), types.KindInt64, "0"},
{0, types.NewIntDatum(-1), types.KindInt64, "0"},
{0, types.NewIntDatum(12345), types.KindInt64, "0"},
//{0, types.NewIntDatum(0), types.KindInt64, "0"},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is another bug(#10361) and I will fix it by another PR.

result.Check(testkit.Rows("0"))
result = tk.MustQuery("SELECT UNIX_TIMESTAMP(12345);")
result.Check(testkit.Rows("0"))
//result = tk.MustQuery("SELECT UNIX_TIMESTAMP(-1);")
Copy link
Contributor Author

@qw4990 qw4990 May 6, 2019

Choose a reason for hiding this comment

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

This is another bug(#10361) and I will fix it by another PR.

@codecov
Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #10368 into master will decrease coverage by 0.0214%.
The diff coverage is 50%.

@@               Coverage Diff                @@
##             master     #10368        +/-   ##
================================================
- Coverage   77.3669%   77.3454%   -0.0215%     
================================================
  Files           412        412                
  Lines         85702      85687        -15     
================================================
- Hits          66305      66275        -30     
- Misses        14363      14383        +20     
+ Partials       5034       5029         -5

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented May 8, 2019

/run-all-tests

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM

@XuHuaiyu XuHuaiyu changed the title expression: fix issue that cast is not compatible with MySQL expression: fix cast(-num as datetime) to return null instead of error May 8, 2019
@XuHuaiyu XuHuaiyu added the status/LGT1 Indicates that a PR has LGTM 1. label May 8, 2019
Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@alivxxx
Copy link
Contributor

alivxxx commented May 8, 2019

/run-all-tests

@alivxxx alivxxx added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 8, 2019
@qw4990
Copy link
Contributor Author

qw4990 commented May 8, 2019

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cast date error
3 participants