Skip to content

Delete statement need inPredicate support #4008

@caiconghui

Description

@caiconghui

Is your feature request related to a problem? Please describe.
Now, delete stament doesn't support inPredicate.

Describe the solution you'd like
Support inPredicate in delete statement.
mysql> SELECT * FROM test_alpha;
+---------------------+--------------+--------------+
| month | service_name | cluster_name |
+---------------------+--------------+--------------+
| 2020-04-01 00:00:00 | shop NN1 8 | xxxxx |
| 2020-04-01 00:00:00 | shop NN1 8 | xxxxx |
| 2020-04-01 00:00:00 | shop21 | xxxxx |
| 2020-04-01 00:00:00 | shop22 | xxxxx |
+---------------------+--------------+--------------+
4 rows in set (0.01 sec)

mysql> SELECT * FROM test_beta;
+---------------------+--------------+--------------+
| month | service_name | cluster_name |
+---------------------+--------------+--------------+
| 2020-04-01 00:00:00 | shop NN1 8 | xxxxx |
| 2020-04-01 00:00:00 | shop NN1 8 | xxxxx |
| 2020-04-01 00:00:00 | shop21 | xxxxx |
| 2020-04-01 00:00:00 | shop22 | xxxxx |
+---------------------+--------------+--------------+
4 rows in set (0.01 sec)

mysql> delete from test_alpha partition p202004 where service_name not in ("shop21", "shop22");
Query OK, 0 rows affected (0.13 sec)
{'label':'delete_6b3f32b8-18d2-4676-af72-64951de3a3cb', 'status':'VISIBLE', 'txnId':'10'}

mysql> delete from test_beta partition p202004 where service_name not in ("shop21", "shop22");
Query OK, 0 rows affected (0.14 sec)
{'label':'delete_54647f82-cabd-4f5d-9e56-efc56c23ee9c', 'status':'VISIBLE', 'txnId':'12'}

mysql> select * from test_beta;
+---------------------+--------------+--------------+
| month | service_name | cluster_name |
+---------------------+--------------+--------------+
| 2020-04-01 00:00:00 | shop21 | xxxxx |
| 2020-04-01 00:00:00 | shop22 | xxxxx |
+---------------------+--------------+--------------+
2 rows in set (0.01 sec)

mysql> select * from test_alpha;
+---------------------+--------------+--------------+
| month | service_name | cluster_name |
+---------------------+--------------+--------------+
| 2020-04-01 00:00:00 | shop21 | xxxxx |
| 2020-04-01 00:00:00 | shop22 | xxxxx |
+---------------------+--------------+--------------+
2 rows in set (0.01 sec)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sqlIssues or PRs related to SQLkind/featureCategorizes issue or PR as related to a new feature.kind/improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions