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

The Tiflash mode is not supporting for ENUM data type #51097

Open
2b1sh opened this issue Feb 12, 2024 · 2 comments
Open

The Tiflash mode is not supporting for ENUM data type #51097

2b1sh opened this issue Feb 12, 2024 · 2 comments
Labels
sig/execution SIG execution type/enhancement The issue or PR belongs to an enhancement.

Comments

@2b1sh
Copy link

2b1sh commented Feb 12, 2024

Bug Report

I have deployed a TiDB cluster and created a table that having datatype ENUM that is read by Tikv instead of TiFlash

1. Minimal reproduce step (Required)

MySQL [test]> use test;

MySQL [test]> create table user(id int PRIMARY KEY AUTO_INCREMENT,name VARCHAR(20),age INT,gender ENUM('male','female'));


MySQL [test]> alter table user set tiflash replica 1;

MySQL [test]> select * from information_schema.tiflash_replica where table_schema="test" and table_name="user";
+--------------+------------+----------+---------------+-----------------+-----------+----------+
| TABLE_SCHEMA | TABLE_NAME | TABLE_ID | REPLICA_COUNT | LOCATION_LABELS | AVAILABLE | PROGRESS |
+--------------+------------+----------+---------------+-----------------+-----------+----------+
| test         | user       |     7028 |             1 |                 |         1 |        1 |
+--------------+------------+----------+---------------+-----------------+-----------+----------+

MySQL [test]> select @@tidb_enforce_mpp;
+--------------------+
| @@tidb_enforce_mpp |
+--------------------+
|                  1 |
+--------------------+
1 row in set (0.01 sec)

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

Whenever I filter the select by any other field name the data is loaded by tiflash

MySQL [test]> explain select * from user where age=29;
+-----------------------+---------+--------------+---------------+--------------------------------------------------------------------------+
| id                    | estRows | task         | access object | operator info                                                            |
+-----------------------+---------+--------------+---------------+--------------------------------------------------------------------------+
| TableReader_10        | 10.00   | root         |               | data:TableFullScan_8                                                     |
| └─TableFullScan_8     | 10.00   | cop[tiflash] | table:user    | pushed down filter:eq(test.user.age, 29), keep order:false, stats:pseudo |
+-----------------------+---------+--------------+---------------+--------------------------------------------------------------------------+
2 rows in set, 1 warning (0.00 sec)

I'm Expecting the same for the field that having datatype ENUM.

3. What did you see instead (Required)

Instead i'm getting the results as below. It's not read by the tiflash.

MySQL [test]> explain select * from user where gender='male';
+-------------------------+----------+-----------+---------------+--------------------------------+
| id                      | estRows  | task      | access object | operator info                  |
+-------------------------+----------+-----------+---------------+--------------------------------+
| TableReader_7           | 10.00    | root      |               | data:Selection_6               |
| └─Selection_6           | 10.00    | cop[tikv] |               | eq(test.user.gender, "male")   |
|   └─TableFullScan_5     | 10000.00 | cop[tikv] | table:user    | keep order:false, stats:pseudo |
+-------------------------+----------+-----------+---------------+--------------------------------+
3 rows in set, 2 warnings (0.00 sec)

MySQL [test]> show warnings;
+---------+------+------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                      |
+---------+------+------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1105 | Expression about 'test.user.gender' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'. |
| Warning | 1105 | Expression about 'test.user.gender' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'. |
+---------+------+------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

MySQL [test]> explain select /*+ READ_FROM_STORAGE(TIFLASH[master]) */ * from user where gender='male';
+-------------------------+----------+-----------+---------------+--------------------------------+
| id                      | estRows  | task      | access object | operator info                  |
+-------------------------+----------+-----------+---------------+--------------------------------+
| TableReader_7           | 10.00    | root      |               | data:Selection_6               |
| └─Selection_6           | 10.00    | cop[tikv] |               | eq(test.user.gender, "male")   |
|   └─TableFullScan_5     | 10000.00 | cop[tikv] | table:user    | keep order:false, stats:pseudo |
+-------------------------+----------+-----------+---------------+--------------------------------+
3 rows in set, 2 warnings (0.01 sec)

4. What is your TiDB version? (Required)

MySQL [(none)]> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v7.1.1
Edition: Community
Git Commit Hash: cf441574864be63938524e7dfcf7cc659edc3dd8
Git Branch: heads/refs/tags/v7.1.1
UTC Build Time: 2023-07-19 10:16:40
GoVersion: go1.20.6
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
1 row in set (0.01 sec)
@2b1sh 2b1sh added the type/bug The issue is confirmed as a bug. label Feb 12, 2024
@2b1sh 2b1sh changed the title The Tiflash MPP mode is not supporting for ENUM data type The Tiflash mode is not supporting for ENUM data type Feb 14, 2024
@jebter jebter added the sig/execution SIG execution label Feb 17, 2024
@windtalker
Copy link
Contributor

It is a known issue, actually TiFlash does not support most calculations on Enum column. So it is kind of expected behavior. The issue is an enhancement request rather than a bug.

@windtalker windtalker added type/enhancement The issue or PR belongs to an enhancement. and removed type/bug The issue is confirmed as a bug. labels Feb 18, 2024
@SeaRise
Copy link
Contributor

SeaRise commented Feb 18, 2024

related issue: pingcap/tiflash#1880

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

4 participants