Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Test fail in copr-test #57500

Closed
wshwsh12 opened this issue Nov 19, 2024 · 3 comments
Closed

Test fail in copr-test #57500

wshwsh12 opened this issue Nov 19, 2024 · 3 comments
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@wshwsh12
Copy link
Contributor

wshwsh12 commented Nov 19, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

After #57343 merged

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

Test case: sql/randgen/10_agg.sql

Statement: #370 -  SELECT SUM( '18:06:20.037342' + `col_year` ) AS field1 FROM `table1000_int_autoinc` WHERE LOG( `col_float_unsigned_key`, LPAD( `col_float_unsigned_key`, `col_time`, '2032-08-14 23:07:20.038862' ) ) GROUP BY `col_bigint` * `col_char_255` ORDER BY `col_bigint` * `col_char_255` /* QNO 376 CON_ID 1137 */ ;

NoPushDown Output: 

field1

79137

18

2025

2021

18

2033

2027

18

18

2021

2025

2036

2018

2036

18

2018

2018

18

2022

2022

2018

2023

146437

26438

2019

18

NULL

2027

NULL

2027

18

4044

18

2020

2027

2018

4047

2026

18

2018

18

18

2018

2023

2024

NULL

2019

2025

2027

2022

2025

2030

2023

2018

18

18

2024

2016

2024

2033

2019

2018

2021

18

2027

18

2026

2024

2025





WithPushDown Output: 

field1

79137

18

2025

2021

18

2033

2027

18

18

2021

2025

2036

2018

2036

18

2018

2018

18

2022

2022

2018

2023

26438

146437

2019

18

NULL

2027

NULL

2027

18

4044

18

2020

2027

2018

4047

2026

18

2018

18

18

2018

2023

2024

NULL

2019

2025

2027

2022

2025

2030

2023

2018

18

18

2024

2016

2024

2033

2019

2018

2021

18

2027

18

2026

2024

2025

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

@wshwsh12
Copy link
Contributor Author

Case1:

tidb> create table t(a double);
Query OK, 0 rows affected (0.09 sec)

tidb> insert into t values(0);
Query OK, 1 row affected (0.02 sec)

tidb> insert into t select -a from t;
Query OK, 1 row affected (0.02 sec)
Records: 1  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 4 rows affected (0.01 sec)
Records: 4  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 8 rows affected (0.01 sec)
Records: 8  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 16 rows affected (0.01 sec)
Records: 16  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 32 rows affected (0.02 sec)
Records: 32  Duplicates: 0  Warnings: 0

tidb>  select /*+ stream_agg() */ count(1) from t group by a;
+----------+
| count(1) |
+----------+
|       64 |
+----------+
1 row in set (0.01 sec)

tidb>  select /*+ hash_agg() */ count(1),a  from t group by a;
+----------+------+
| count(1) | a    |
+----------+------+
|       32 |    0 |
|       32 |   -0 |
+----------+------+
2 rows in set (0.00 sec)

Case2:

tidb> insert into t select -a from t;
Query OK, 64 rows affected (0.01 sec)
Records: 64  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 128 rows affected (0.01 sec)
Records: 128  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 256 rows affected (0.02 sec)
Records: 256  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 512 rows affected (0.04 sec)
Records: 512  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 1024 rows affected (0.03 sec)
Records: 1024  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 2048 rows affected (0.02 sec)
Records: 2048  Duplicates: 0  Warnings: 0

tidb> insert into t select -a from t;
Query OK, 4096 rows affected (0.09 sec)
Records: 4096  Duplicates: 0  Warnings: 0

tidb>  select /*+ hash_agg() */ count(1),a  from t group by a;
+----------+------+
| count(1) | a    |
+----------+------+
|     8192 |    0 |
+----------+------+
1 row in set (0.01 sec)

tidb>  select /*+ stream_agg() */ count(1) from t group by a;
+----------+
| count(1) |
+----------+
|     2048 |
|     1024 |
|     1024 |
|     4096 |
+----------+
4 rows in set (0.00 sec)

tidb>

@wshwsh12
Copy link
Contributor Author

Case3:

tidb> drop table t;
Query OK, 0 rows affected (0.04 sec)

tidb> create table t(a double, b double, index idx(a));
Query OK, 0 rows affected (0.01 sec)

tidb> insert into t values(0,0);
Query OK, 1 row affected (0.01 sec)

tidb> insert into t select -a,-b from t;
Query OK, 1 row affected (0.00 sec)
Records: 1  Duplicates: 0  Warnings: 0

tidb> select * from t use index(idx) where a = 0;
+------+------+
| a    | b    |
+------+------+
|    0 |    0 |
+------+------+
1 row in set (0.00 sec)

tidb> select * from t use index(idx) where a = -0;
+------+------+
| a    | b    |
+------+------+
|    0 |    0 |
+------+------+
1 row in set (0.00 sec)

tidb> select * from t use index(idx) where a != 0;
+------+------+
| a    | b    |
+------+------+
|   -0 |   -0 |
+------+------+
1 row in set (0.00 sec)

tidb> select * from t use index(idx) where a != -0;
+------+------+
| a    | b    |
+------+------+
|   -0 |   -0 |
+------+------+
1 row in set (0.00 sec)

@wshwsh12
Copy link
Contributor Author

Now the pr have been revert. Close this issue

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant