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 issue that TimeIsNull is not compatible with MySQL #10753

Closed
wants to merge 2 commits into from

Conversation

qw4990
Copy link
Contributor

@qw4990 qw4990 commented Jun 10, 2019

What problem does this PR solve?

Fix #9763.

TimeIsNull in TiDB doesn't check if these DATETIME columns are declared as NOT NULL.
But In MySQL:

For DATE and DATETIME columns that are declared as NOT NULL, 
you can find the special date '0000-00-00' by using a statement like this:
"SELECT * FROM tbl_name WHERE date_column IS NULL"

This PR needs to be merged after pingcap/tipb#121.

For TiKV, since

  1. TimeIsNull is not pushed down to TiKV, and
  2. there is some problem(can't upgrade dependency tipb in tikv tikv/tikv#4864) to let tipb can't be upgraded in TiKV,

we don't fix TimeIsNull on TiKV.

What is changed and how it works?

Check if these DATETIME columns are declared as NOT NULL.

Check List

Tests

  • Unit test

@qw4990
Copy link
Contributor Author

qw4990 commented Jun 10, 2019

We have to merge pingcap/tipb#121 firstly to let idc-jenkins-ci-tidb/build pass.

Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

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

What's result of the following case:

The column can contains NULL.
But we filter NULL out at some places.
Like the SQL: select * from (select * from t where date_col is not null) t where date_col is null;

Why i mention this case is because that we'll maintain the NOT NULL during planning phase. Currently the flag is false when building the TIME IS NULL. It or another field will be true in the future.

@qw4990
Copy link
Contributor Author

qw4990 commented Jun 20, 2019

Wait for #10790 and use it to solve this problem instead of introducing a new function signature.

@qw4990 qw4990 closed this Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null datetime is not compatible with MySQL
2 participants