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

Agg cannot pushdown to tiflash when there are expression index #41380

Open
guo-shaoge opened this issue Feb 14, 2023 · 0 comments
Open

Agg cannot pushdown to tiflash when there are expression index #41380

guo-shaoge opened this issue Feb 14, 2023 · 0 comments
Assignees
Labels
affects-7.0 affects-7.1 affects-7.5 affects-8.1 may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 may-affects-6.4 may-affects-6.5 may-affects-6.6 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@guo-shaoge
Copy link
Collaborator

guo-shaoge commented Feb 14, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. run following sql
drop table if exists t2;
create table t2(c1 int, c2 varchar(100));
insert into t2 values(1, 'xhy'), (2, 'abc');
alter table t2 set tiflash replica 1;
  1. check tiflash_replica is avaiable.
  2. add expression index
alter table t2 add index idx2((lower(c2)));
  1. Use nth_paln to check all available plans:
explain select /*+ nth_plan(1) */ count(c1) from t2 where lower(c2) = 'abc';

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

Can generate plan that Agg can pushdown to tiflash.

3. What did you see instead (Required)

There is no plan that Selection and HashAgg pushdown to tiflash.

MySQL [test]> explain select /*+ nth_plan(2) */ count(c1) from t2 where lower(c2) = 'abc';
+------------------------------+----------+--------------+---------------+-----------------------------------+
| id                           | estRows  | task         | access object | operator info                     |
+------------------------------+----------+--------------+---------------+-----------------------------------+
| HashAgg_7                    | 1.00     | root         |               | funcs:count(test.t2.c1)->Column#5 |
| └─Selection_17               | 8000.00  | root         |               | eq(lower(test.t2.c2), "abc")      |
|   └─Projection_16            | 10000.00 | root         |               | test.t2.c1, lower(test.t2.c2)     |
|     └─TableReader_15         | 10000.00 | root         |               | data:TableFullScan_14             |
|       └─TableFullScan_14     | 10000.00 | cop[tiflash] | table:t2      | keep order:false, stats:pseudo    |
+------------------------------+----------+--------------+---------------+-----------------------------------+
5 rows in set (0.002 sec)

4. What is your TiDB version? (Required)

MySQL [test]> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                               |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.5.0
Edition: Community
Git Commit Hash: 77776e17159e9c6faf6aeedf3085a7a2524d3205
Git Branch: heads/refs/tags/v6.5.0
UTC Build Time: 2022-12-05 13:50:22
GoVersion: go1.19.3
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@guo-shaoge guo-shaoge added the type/bug The issue is confirmed as a bug. label Feb 14, 2023
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 may-affects-6.4 may-affects-6.5 may-affects-6.6 labels Feb 14, 2023
@guo-shaoge guo-shaoge added sig/planner SIG: Planner and removed sig/execution SIG execution labels Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.0 affects-7.1 affects-7.5 affects-8.1 may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 may-affects-6.4 may-affects-6.5 may-affects-6.6 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

5 participants