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: compatibility is changed #30653

Merged
merged 7 commits into from
Jan 5, 2022
Merged

Conversation

Tangruilin
Copy link
Contributor

@Tangruilin Tangruilin commented Dec 12, 2021

What problem does this PR solve?

Issue Number: close #19150

Problem Summary:

What is changed and how it works?

After ParseDuration in builtinAddStringAndStringSig.evalString , format like *-* will be checked,if the arg1Strmatch this format, it will return isNull

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@ti-chi-bot ti-chi-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Dec 12, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 12, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • dveeden
  • zimulala

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 12, 2021
@sre-bot
Copy link
Contributor

sre-bot commented Dec 12, 2021

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@Tangruilin
Copy link
Contributor Author

/run-check_title

@sre-bot
Copy link
Contributor

sre-bot commented Dec 12, 2021

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@Tangruilin Tangruilin changed the title pkg expression is changed pkg expression: compatibility is changed Dec 12, 2021
@Tangruilin Tangruilin changed the title pkg expression: compatibility is changed expression: compatibility is changed Dec 12, 2021
@Tangruilin
Copy link
Contributor Author

/run-check_title

@Tangruilin
Copy link
Contributor Author

/run-check_dev

@Tangruilin
Copy link
Contributor Author

/run-unit-test

@Tangruilin
Copy link
Contributor Author

when I pull the code, there are 4 test in expression cannot pass

@Tangruilin
Copy link
Contributor Author

/cc @gregwebs Could you help look at it, I do not know why I cannot pass unit_test, and I pull the code without my PR then do make gotest, it will failed, too

@Tangruilin
Copy link
Contributor Author

/cc @foobar Could someone look at it? emmmm....

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

[2021-12-12T13:04:46.677Z] --- FAIL: TestTimeBuiltin (0.51s)
[2021-12-12T13:04:46.677Z]     result.go:50:
[2021-12-12T13:04:46.677Z]         	Error Trace:	result.go:50
 	            				integration_serial_test.go:2170
[2021-12-12T13:04:46.677Z]         	Error:      	Not equal:
[2021-12-12T13:04:46.677Z]         	            	expected: "[2017-01-01 01:01:06 2017-01-01 01:00:56 2017-01-01 01:01:01 2017-01-01 01:01:02.340000]\n"
[2021-12-12T13:04:46.677Z]         	            	actual  : "[2017-01-01 01:01:06 <nil> 2017-01-01 01:01:01 2017-01-01 01:01:02.340000]\n"

How about the case like the test in this TestTimeBuiltin.

mysql> select addtime('2017-01-01 01:01:01', -5);
+------------------------------------+
| addtime('2017-01-01 01:01:01', -5) |
+------------------------------------+
| 2017-01-01 01:00:56                |
+------------------------------------+
1 row in set (0.01 sec)

@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 16, 2021
@Tangruilin
Copy link
Contributor Author

/run-check_dev_2

@sre-bot
Copy link
Contributor

sre-bot commented Dec 21, 2021

Copy link
Contributor

@dveeden dveeden left a comment

Choose a reason for hiding this comment

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

This seems to fix the issue described.

Note that there are still some other corner cases:

MySQL 8.0.27:

mysql> select ADDTIME('2020-05-13 14:01:24', '-10000000');
+---------------------------------------------+
| ADDTIME('2020-05-13 14:01:24', '-10000000') |
+---------------------------------------------+
| 2020-04-08 15:01:25                         |
+---------------------------------------------+
1 row in set, 1 warning (0.00 sec)

Warning (Code 1292): Truncated incorrect time value: '-10000000'

TiDB:

sql> select ADDTIME('2020-05-13 14:01:24', '-10000000');
+---------------------------------------------+
| ADDTIME('2020-05-13 14:01:24', '-10000000') |
+---------------------------------------------+
| NULL                                        |
+---------------------------------------------+
1 row in set, 1 warning (0.0007 sec)
Warning (code 1292): Truncated incorrect time value: '-10000000'

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 21, 2021
@lance6716
Copy link
Contributor

ping @zimulala @bb7133

@@ -5556,6 +5557,16 @@ func (b *builtinAddStringAndStringSig) evalString(row chunk.Row) (result string,
}
return "", true, err
}

check := arg1Str
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be useful to add a comment here about why this is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, In fact I think add the code in func isDuration or create a new func maybeErrDuration may be butter, but isDuration is a util func, I'm afraid to get new wrong, so I add the code here. I may add some cmment or create a new func, but which file may i add the func?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check the other concor case and try to solve them

@Tangruilin
Copy link
Contributor Author

ping @zimulala @bb7133

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 5, 2022
@zimulala
Copy link
Contributor

zimulala commented Jan 5, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 585d649

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 5, 2022
@ti-chi-bot
Copy link
Member

@Tangruilin: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit 1a6564b into pingcap:master Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatibility with MySQL for ADDTIME()
6 participants