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

incorrect execution summary of table scan #5625

Closed
SeaRise opened this issue Aug 15, 2022 · 0 comments · Fixed by #5624
Closed

incorrect execution summary of table scan #5625

SeaRise opened this issue Aug 15, 2022 · 0 comments · Fixed by #5624
Assignees
Labels
severity/minor type/bug The issue is confirmed as a bug.

Comments

@SeaRise
Copy link
Contributor

SeaRise commented Aug 15, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)


CREATE TABLE `test`.`test` (
  `COL1` smallint(28) unsigned DEFAULT NULL,
  `COL2` varchar(20) DEFAULT NULL,
  `COL4` datetime DEFAULT NULL,
  `COL3` bigint(20) DEFAULT NULL,
  `COL5` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
ALTER TABLE `test`.`test` SET TIFLASH REPLICA 1;

insert into test.test values
(1, 1, '2012-01-01', 1, 1),
(2, 2, '2012-01-01', 2, 2),
(2, 2, '2012-01-01', 2, 2),
(3, 3, '2012-01-01', 3, 3),
(3, 3, '2012-01-01', 3, 3),
(3, 3, '2012-01-01', 3, 3),
(4, 4, '2012-01-01', 4, 4),
(4, 4, '2012-01-01', 4, 4),
(4, 4, '2012-01-01', 4, 4),
(4, 4, '2012-01-01', 4, 4),
(5, 5, '2012-01-01', 5, 5),
(5, 5, '2012-01-01', 5, 5),
(5, 5, '2012-01-01', 5, 5),
(5, 5, '2012-01-01', 5, 5),
(5, 5, '2012-01-01', 5, 5);

explain analyze  select sum(COL1), sum(COL3) from ( select sum(col2) c, COL1, COL3 from test group by COL1, COL3 ) t group by c;

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

+----------------------------------------------+---------+---------+--------------+---------------+--------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+
| id                                           | estRows | actRows | task         | access object | execution info                                                                             | operator info                                                                                                                                       | memory | disk |
+----------------------------------------------+---------+---------+--------------+---------------+--------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+
| TableReader_56                               | 12.00   | 5       | root         |               | time:5.17s, loops:2, cop_task: {num: 1, max: 0s, proc_keys: 0, copr_cache_hit_ratio: 0.00} | data:ExchangeSender_55                                                                                                                              | N/A    | N/A  |
| └─ExchangeSender_55                          | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:4.89s, loops:1, threads:20}                                             | ExchangeType: PassThrough                                                                                                                           | N/A    | N/A  |
|   └─Projection_54                            | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:4.89s, loops:1, threads:20}                                             | Column#8, Column#9                                                                                                                                  | N/A    | N/A  |
|     └─HashAgg_10                             | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:4.89s, loops:1, threads:20}                                             | group by:Column#36, funcs:sum(Column#34)->Column#8, funcs:sum(Column#35)->Column#9                                                                  | N/A    | N/A  |
|       └─Projection_74                        | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:4.88s, loops:1, threads:20}                                             | cast(test.test.col1, decimal(5,0) UNSIGNED BINARY)->Column#34, cast(test.test.col3, decimal(20,0) BINARY)->Column#35, Column#7                      | N/A    | N/A  |
|         └─ExchangeReceiver_47                | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:4.88s, loops:1, threads:20}                                             |                                                                                                                                                     | N/A    | N/A  |
|           └─ExchangeSender_46                | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:4.87s, loops:1, threads:20}                                             | ExchangeType: HashPartition, Hash Cols: [name: Column#7, collate: binary]                                                                           | N/A    | N/A  |
|             └─Projection_45                  | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:4.87s, loops:1, threads:20}                                             | Column#7, test.test.col1, test.test.col3                                                                                                            | N/A    | N/A  |
|               └─HashAgg_43                   | 12.00   | 5       | mpp[tiflash] |               | tiflash_task:{time:4.87s, loops:1, threads:20}                                             | group by:Column#32, Column#33, funcs:sum(Column#29)->Column#7, funcs:firstrow(Column#30)->test.test.col1, funcs:firstrow(Column#31)->test.test.col3 | N/A    | N/A  |
|                 └─Projection_73              | 15.00   | 15      | mpp[tiflash] |               | tiflash_task:{time:4.86s, loops:1, threads:20}                                             | cast(test.test.col2, double BINARY)->Column#29, test.test.col1, test.test.col3, test.test.col1, test.test.col3                                      | N/A    | N/A  |
|                   └─ExchangeReceiver_29      | 15.00   | 15      | mpp[tiflash] |               | tiflash_task:{time:4.86s, loops:1, threads:20}                                             |                                                                                                                                                     | N/A    | N/A  |
|                     └─ExchangeSender_28      | 15.00   | 15      | mpp[tiflash] |               | tiflash_task:{time:4.87s, loops:1, threads:1}                                              | ExchangeType: HashPartition, Hash Cols: [name: test.test.col1, collate: binary], [name: test.test.col3, collate: binary]                            | N/A    | N/A  |
|                       └─TableFullScan_27     | 15.00   | 15      | mpp[tiflash] | table:test    | tiflash_task:{time:4.87s, loops:1, threads:1}                                              | keep order:false, stats:pseudo                                                                                                                      | N/A    | N/A  |
+----------------------------------------------+---------+---------+--------------+---------------+--------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+

3. What did you see instead (Required)

+----------------------------------------------+----------+---------+--------------+---------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+
| id                                           | estRows  | actRows | task         | access object | execution info                                                                               | operator info                                                                                                                                       | memory | disk |
+----------------------------------------------+----------+---------+--------------+---------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+
| TableReader_56                               | 8000.00  | 5       | root         |               | time:284.6ms, loops:2, cop_task: {num: 1, max: 0s, proc_keys: 0, copr_cache_hit_ratio: 0.00} | data:ExchangeSender_55                                                                                                                              | N/A    | N/A  |
| └─ExchangeSender_55                          | 8000.00  | 5       | mpp[tiflash] |               | tiflash_task:{time:256.7ms, loops:1, threads:20}                                             | ExchangeType: PassThrough                                                                                                                           | N/A    | N/A  |
|   └─Projection_54                            | 8000.00  | 5       | mpp[tiflash] |               | tiflash_task:{time:256.7ms, loops:1, threads:20}                                             | Column#8, Column#9                                                                                                                                  | N/A    | N/A  |
|     └─HashAgg_10                             | 8000.00  | 5       | mpp[tiflash] |               | tiflash_task:{time:256.7ms, loops:1, threads:20}                                             | group by:Column#36, funcs:sum(Column#34)->Column#8, funcs:sum(Column#35)->Column#9                                                                  | N/A    | N/A  |
|       └─Projection_74                        | 8000.00  | 5       | mpp[tiflash] |               | tiflash_task:{time:246.7ms, loops:1, threads:20}                                             | cast(test.test.col1, decimal(5,0) UNSIGNED BINARY)->Column#34, cast(test.test.col3, decimal(20,0) BINARY)->Column#35, Column#7                      | N/A    | N/A  |
|         └─ExchangeReceiver_47                | 8000.00  | 5       | mpp[tiflash] |               | tiflash_task:{time:246.7ms, loops:1, threads:20}                                             |                                                                                                                                                     | N/A    | N/A  |
|           └─ExchangeSender_46                | 8000.00  | 5       | mpp[tiflash] |               | tiflash_task:{time:216.8ms, loops:1, threads:20}                                             | ExchangeType: HashPartition, Hash Cols: [name: Column#7, collate: binary]                                                                           | N/A    | N/A  |
|             └─Projection_45                  | 8000.00  | 5       | mpp[tiflash] |               | tiflash_task:{time:216.8ms, loops:1, threads:20}                                             | Column#7, test.test.col1, test.test.col3                                                                                                            | N/A    | N/A  |
|               └─HashAgg_43                   | 8000.00  | 5       | mpp[tiflash] |               | tiflash_task:{time:216.8ms, loops:1, threads:20}                                             | group by:Column#32, Column#33, funcs:sum(Column#29)->Column#7, funcs:firstrow(Column#30)->test.test.col1, funcs:firstrow(Column#31)->test.test.col3 | N/A    | N/A  |
|                 └─Projection_73              | 10000.00 | 15      | mpp[tiflash] |               | tiflash_task:{time:156.8ms, loops:1, threads:20}                                             | cast(test.test.col2, double BINARY)->Column#29, test.test.col1, test.test.col3, test.test.col1, test.test.col3                                      | N/A    | N/A  |
|                   └─ExchangeReceiver_29      | 10000.00 | 15      | mpp[tiflash] |               | tiflash_task:{time:138.8ms, loops:1, threads:20}                                             |                                                                                                                                                     | N/A    | N/A  |
|                     └─ExchangeSender_28      | 10000.00 | 15      | mpp[tiflash] |               | tiflash_task:{time:119.3ms, loops:1, threads:1}                                              | ExchangeType: HashPartition, Hash Cols: [name: test.test.col1, collate: binary], [name: test.test.col3, collate: binary]                            | N/A    | N/A  |
|                       └─TableFullScan_27     | 10000.00 | 30      | mpp[tiflash] | table:test    | tiflash_task:{time:119.3ms, loops:2, threads:2}                                              | keep order:false, stats:pseudo                                                                                                                      | N/A    | N/A  |
+----------------------------------------------+----------+---------+--------------+---------------+----------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+--------+------+

4. What is your TiFlash version? (Required)

master

@SeaRise SeaRise added type/bug The issue is confirmed as a bug. severity/minor labels Aug 15, 2022
@SeaRise SeaRise self-assigned this Aug 15, 2022
ti-chi-bot pushed a commit that referenced this issue Aug 16, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
close #5625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant