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

Tiflash Fail to Execute Query #57656

Open
Dylan0222 opened this issue Nov 24, 2024 · 5 comments
Open

Tiflash Fail to Execute Query #57656

Dylan0222 opened this issue Nov 24, 2024 · 5 comments
Labels
affects-8.4 affects-8.5 This bug affects the 8.5.x(LTS) versions. sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@Dylan0222
Copy link

Dylan0222 commented Nov 24, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

DROP TABLE IF EXISTS person;
CREATE TABLE person (
    id INT NOT NULL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    address_info JSON,
    age DOUBLE GENERATED ALWAYS AS ((id + 100) /2) VIRTUAL
);

ALTER TABLE person SET TIFLASH REPLICA 1;
INSERT INTO person (id, name, address_info) 
VALUES 
    (1, 'Alice', '{"street": "123 Elm St", "city": "Wonderland", "zipcode": "12345"}'),
    (2, 'Bob', '{"street": "456 Oak St", "city": "Nowhere", "zipcode": "67890"}'),
    (3, 'Charlie', '{"street": "789 Pine St", "city": "Somewhere", "zipcode": "11223"}');

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

I find that the returned result is inconsistent across two queries. Moreover, Tiflash cannot even execute this query.

3. What did you see instead (Required)

mysql> SELECT /*+ READ_FROM_STORAGE(tikv[person]) */ age FROM person limit 1;
+------+
| age  |
+------+
| 50.5 |
+------+
1 row in set (0.04 sec)

mysql> SELECT /*+ READ_FROM_STORAGE(tiflash[person]) */ age FROM person limit 1;
ERROR 1815 (HY000): Internal : Can't find a proper physical plan for this query

4. What is your TiDB version? (Required)

TiDB v8.4.0

@Dylan0222 Dylan0222 added the type/bug The issue is confirmed as a bug. label Nov 24, 2024
@Dylan0222
Copy link
Author

/label affects-8.4
/label affects-8.5

@ti-chi-bot ti-chi-bot bot added affects-8.4 affects-8.5 This bug affects the 8.5.x(LTS) versions. labels Nov 24, 2024
@Dylan0222
Copy link
Author

But this query can work well @jebter:
mysql> SELECT /*+ READ_FROM_STORAGE(tikv[person]) */ age FROM person order by age;
+------+
| age |
+------+
| 50.5 |
| 51 |
| 51.5 |
+------+
3 rows in set (0.04 sec)

mysql> SELECT /*+ READ_FROM_STORAGE(tiflash[person]) */ age FROM person order by age;
+------+
| age |
+------+
| 50.5 |
| 51 |
| 51.5 |
+------+
3 rows in set (0.04 sec)

@jebter jebter added the sig/planner SIG: Planner label Nov 26, 2024
@Dylan0222
Copy link
Author

@yibin87 Could you please help check this issue as well? It seems strange that TiFlash cannot execute it. Thank you very much.

@winoros
Copy link
Member

winoros commented Nov 27, 2024

mysql> set @@tidb_enforce_mpp=on;
Query OK, 0 rows affected (0.00 sec)

mysql> select age FROM person limit 1;
+------+
| age  |
+------+
| 50.5 |
+------+
1 row in set (0.00 sec)

mysql> explain select age FROM person limit 1;
+------------------------------+---------+-----------+---------------+--------------------------------+
| id                           | estRows | task      | access object | operator info                  |
+------------------------------+---------+-----------+---------------+--------------------------------+
| Limit_7                      | 1.00    | root      |               | offset:0, count:1              |
| └─Projection_14              | 1.00    | root      |               | test.person.age                |
|   └─TableReader_13           | 1.00    | root      |               | data:Limit_12                  |
|     └─Limit_12               | 1.00    | cop[tikv] |               | offset:0, count:1              |
|       └─TableFullScan_10     | 1.00    | cop[tikv] | table:person  | keep order:false, stats:pseudo |
+------------------------------+---------+-----------+---------------+--------------------------------+
5 rows in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                  |
+---------+------+----------------------------------------------------------------------------------------------------------+
| Warning | 1105 | MPP mode may be blocked because column `test.person.age` is a virtual column which is not supported now. |
+---------+------+----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MPP mode may be blocked because column test.person.age is a virtual column which is not supported now.

@Dylan0222

@winoros winoros added sig/execution SIG execution and removed sig/planner SIG: Planner labels Nov 27, 2024
@yibin87
Copy link
Contributor

yibin87 commented Nov 28, 2024

SELECT /*+ READ_FROM_STORAGE(tiflash[person]) */ age FROM person; works properly, it seems caused by the "limit" operator, we may have some inappropriate limitations here.

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

No branches or pull requests

4 participants