WIP:types: fix isDateFormat function bugs#27575
WIP:types: fix isDateFormat function bugs#27575mengxin9014 wants to merge 18 commits intopingcap:masterfrom
Conversation
|
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
|
/run-all-tests |
wjhuang2016
left a comment
There was a problem hiding this comment.
The returning type is wrong.
TiDB:
mysql> select DATE_ADD(a, INTERVAL 1 day ) from t ;
Field 1: `DATE_ADD(a, INTERVAL 1 day )`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: DATETIME
Collation: binary (63)
Length: 29
Max_length: 19
Decimals: 31
Flags: NOT_NULL BINARY
+------------------------------+
| DATE_ADD(a, INTERVAL 1 day ) |
+------------------------------+
| 2020-12-10 00:00:00 |
+------------------------------+
1 row in set (0.00 sec)
MySQL:
mysql> select DATE_ADD(a, INTERVAL 1 day ) from t ;
Field 1: `DATE_ADD(a, INTERVAL 1 day )`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: STRING
Collation: utf8mb4_0900_ai_ci (255)
Length: 116
Max_length: 10
Decimals: 31
Flags:
+------------------------------+
| DATE_ADD(a, INTERVAL 1 day ) |
+------------------------------+
| 2020-12-10 |
+------------------------------+
1 row in set (0.01 sec)
…nto dev/fixIsDateFormatBug
…into dev/fixIsDateFormatBug
|
/run-check_dev_2 |
|
/run-check_dev_2 |
3 similar comments
|
/run-check_dev_2 |
|
/run-check_dev_2 |
|
/run-check_dev_2 |
What problem does this PR solve?
Issue Number: close #27573
Problem Summary:
fix the bug that a string like "20129" will not be judged as date type
change date_add and date_sub string_(int/string/real/decimal) function return type to string
What is changed and how it works?
Proposal: xxx
What's Changed:
time.go
expression/builtin_time.go
expression/builtin_time_test.go
expression/builtin_time_vec_generated.go
types/time_test.go
cmd/explaintest/r/tpch.result
How it Works:
if the length of a string with no separator is 5, it will be date type
if use date_add or date_sub string_(int/string/real/decimal) function will return string type
Check List
Tests
Release note