Skip to content

Different hour result between non-vectorized and vectorized expression #28643

@wshwsh12

Description

@wshwsh12

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table t;
create table t(a time(4));
insert into t values("-700:10:10.123456111");
select hour(a) from t;
set tidb_enable_vectorized_expression = off;
select hour(a) from t;

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

[tidb]>  select hour(a) from t;
+---------+
| hour(a) |
+---------+
|     700 |
+---------+
1 row in set (0.001 sec)

3. What did you see instead (Required)

[tidb]> create table t(a time(4));
Query OK, 0 rows affected (0.004 sec)

[tidb]> insert into t values("-700:10:10.123456111");
Query OK, 1 row affected (0.001 sec)

[tidb]> select hour(a) from t;
+---------+
| hour(a) |
+---------+
|    -700 |
+---------+
1 row in set (0.001 sec)

[tidb]> set tidb_enable_vectorized_expression = off;
Query OK, 0 rows affected (0.000 sec)

[tidb]>  select hour(a) from t;
+---------+
| hour(a) |
+---------+
|     700 |
+---------+
1 row in set (0.001 sec)

4. What is your TiDB version? (Required)

master(a9a3b3c)

Metadata

Metadata

Assignees

No one assigned

    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/criticalsig/executionSIG executiontype/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