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

Scalar function date_add(signature: ScalarFuncSig_AddDateStringInt) has different behaviour between TiDB and TiFlash. #27336

Closed
LittleFall opened this issue Aug 18, 2021 · 6 comments
Assignees
Labels

Comments

@LittleFall
Copy link
Contributor

LittleFall commented Aug 18, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table t;
create table t(a char(20));
alter table t set tiflash replica 1;
set tidb_enforce_mpp=1;
insert into t values('210101');

mysql> explain select DATE_ADD(a, INTERVAL 1 day ) from t;
+---------------------------+---------+--------------+---------------+--------------------------------------+
| id                        | estRows | task         | access object | operator info                        |
+---------------------------+---------+--------------+---------------+--------------------------------------+
| TableReader_11            | 1.00    | root         |               | data:ExchangeSender_10               |
| └─ExchangeSender_10       | 1.00    | cop[tiflash] |               | ExchangeType: PassThrough            |
|   └─Projection_4          | 1.00    | cop[tiflash] |               | date_add(test.t.a, 1, DAY)->Column#3 |
|     └─TableFullScan_9     | 1.00    | cop[tiflash] | table:t       | keep order:false, stats:pseudo       |
+---------------------------+---------+--------------+---------------+--------------------------------------+
4 rows in set (0.01 sec)

mysql> select /*+ read_from_storage(tiflash[t]) */ DATE_ADD(a, INTERVAL 1 day ) from t;
+------------------------------+
| DATE_ADD(a, INTERVAL 1 day ) |
+------------------------------+
| NULL                         |
+------------------------------+
1 row in set (0.02 sec)

mysql> select /*+ read_from_storage(tikv[t]) */ DATE_ADD(a, INTERVAL 1 day ) from t;
+------------------------------+
| DATE_ADD(a, INTERVAL 1 day ) |
+------------------------------+
| 2021-01-02                   |
+------------------------------+
1 row in set (0.00 sec)

2. What did you expect to see? (Required)

result is same.

3. What did you see instead (Required)

result is different.

4. What is your TiDB version? (Required)

v5.1.1

@LittleFall LittleFall added type/bug The issue is confirmed as a bug. component/expression labels Aug 18, 2021
@LittleFall
Copy link
Contributor Author

scalar function date_add is default in blacklist.

@LittleFall
Copy link
Contributor Author

LittleFall commented Aug 18, 2021

date_sub has the same issue.

@LittleFall
Copy link
Contributor Author

/assign @mengxin9014

@mengxin9014
Copy link
Contributor

/assign @mengxin9014

@JaySon-Huang
Copy link
Contributor

Another case from AskTUG: https://asktug.com/t/topic/152922
@mengxin9014 @LittleFall

@windtalker
Copy link
Contributor

This issue is fixed by #28133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants