Skip to content

Results are different when tidb_enable_vectorized_expression is off #29434

@guo-shaoge

Description

@guo-shaoge

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1;
create table t1(c1 datetime);
insert into t1 values('2021-12-12 10:10:10.000');
set tidb_enable_vectorized_expression = on;
select greatest(c1, '99999999999999') from t1;
set tidb_enable_vectorized_expression = off;
select greatest(c1, '99999999999999') from t1;

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

Result should be same.

3. What did you see instead (Required)

mysql> set tidb_enable_vectorized_expression = on;
Query OK, 0 rows affected (0.01 sec)

mysql> select greatest(datetime_1, '999999999999') from test_GREATEST;
+--------------------------------------+
| greatest(datetime_1, '999999999999') |
+--------------------------------------+
| 999999999999                         |
+--------------------------------------+
1 row in set, 1 warning (0.04 sec)

mysql> set tidb_enable_vectorized_expression = off;
Query OK, 0 rows affected (0.01 sec)

mysql> select greatest(datetime_1, '999999999999') from test_GREATEST;
+--------------------------------------+
| greatest(datetime_1, '999999999999') |
+--------------------------------------+
| 2021-10-20 10:10:10                  |
+--------------------------------------+
1 row in set, 1 warning (1.94 sec)

4. What is your TiDB version? (Required)

mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                              |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.3.0-alpha-1317-ga0cd121f19
Edition: Community
Git Commit Hash: a0cd121f19ef6d33b26b8bcc19a177e7c920291f
Git Branch: master
UTC Build Time: 2021-11-04 00:24:48
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.03 sec)

Metadata

Metadata

Assignees

Labels

affects-4.0This bug affects 4.0.x versions.affects-5.0This bug affects 5.0.x versions.affects-5.1This bug affects 5.1.x versions.affects-5.2This bug affects 5.2.x versions.severity/majortype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions