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

planner: Fix Empty string has different meanings in SELECT and UPDATE #27954

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

yuqi1129
Copy link
Contributor

@yuqi1129 yuqi1129 commented Sep 10, 2021

What problem does this PR solve?

Issue Number: close #27648

Problem Summary:

What is changed and how it works?

Proposal: xxx

What's Changed:

How it Works:

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
Copy link
Member

ti-chi-bot commented Sep 10, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • time-and-fate

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 release-note-none size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 10, 2021
@yuqi1129
Copy link
Contributor Author

/cc @xiongjiwei @lzmhhh123

@xiongjiwei xiongjiwei changed the title core: Fix Empty string has different meanings in SELECT and UPDATE planner: Fix Empty string has different meanings in SELECT and UPDATE Sep 23, 2021
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 24, 2021
Copy link
Member

@time-and-fate time-and-fate left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 24, 2021
@ti-chi-bot
Copy link
Member

@yuqi1129: PR needs rebase.

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 kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 27, 2021
@xiongjiwei
Copy link
Contributor

seems has been fixed by #28229

@yuqi1129
Copy link
Contributor Author

@xiongjiwei , As you have commented, #28229 issue have introduced a new problem, maybe we should consider this two issue both and come up with a solution.

@@ -986,7 +986,11 @@ func (b *PlanBuilder) buildSelection(ctx context.Context, p LogicalPlan, where a
for _, item := range cnfItems {
if con, ok := item.(*expression.Constant); ok && con.DeferredExpr == nil && con.ParamMarker == nil {
ret, _, err := expression.EvalBool(b.ctx, expression.CNFExprs{con}, chunk.Row{})
Copy link
Member

Choose a reason for hiding this comment

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

Seems the EvalBool behavior is not the same with MySQL

mysql> /* s1 */ select * from t where ' ';
Empty set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+--------------------------------------+
| Level   | Code | Message                              |
+---------+------+--------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: '' |
+---------+------+--------------------------------------+
1 row in set (0.01 sec)
mysql> /* s1 */ select * from t where ' ';
Empty set (0.00 sec)

The first one is the TiDB's. You can see that MySQL doesn't throw warning out.
This could be a problem if we use a strict SQL mode. MySQL would success and TiDB would fail

@yudongusa
Copy link

@yuqi1129 @xiongjiwei @winoros any update on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty string has different meanings in SELECT and UPDATE in a transaction
6 participants