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

feat: support random partition rule #1193

Merged
merged 8 commits into from
Sep 7, 2023

Conversation

ShiKaiWi
Copy link
Member

@ShiKaiWi ShiKaiWi commented Sep 4, 2023

Rationale

Currently, hash/key rule are the only supported rules for partition table. However, it will lead to small write batches if the user tries to use primary key or all tags as the partition key for a uniform distribution. And it is known that the small write batches hurt write performance badly.

Actually, for a partition table in append mode with primary key or all tags as partition key, most of the queries to this table will fan out to all the partitions because the partition key won't be provided in most cases. So what is the gain from the cost (the massive small write batches) to do such complex partition?

It will work much better if a simple partition rule is supported, by which a random partition is chosen for a given write request.

Detailed Changes

  • Introduce RandomPartitionRule
  • Add a new method called validate_create_table to TableEngine trait

Test Plan

Add unit test to apply RandomPartitionRule for a partition table in different mode.

@ShiKaiWi ShiKaiWi force-pushed the feat-support-partition-no-rule branch 2 times, most recently from 080b7f4 to c702375 Compare September 5, 2023 11:02
table_engine/src/partition/rule/df_adapter/mod.rs Outdated Show resolved Hide resolved
table_engine/src/engine.rs Outdated Show resolved Hide resolved
query_frontend/src/parser.rs Outdated Show resolved Hide resolved
@ShiKaiWi ShiKaiWi force-pushed the feat-support-partition-no-rule branch from 55cc18a to 3c05f0e Compare September 7, 2023 02:20
@ShiKaiWi ShiKaiWi force-pushed the feat-support-partition-no-rule branch from 3c05f0e to 36e48d4 Compare September 7, 2023 05:45
Copy link
Contributor

@Rachelint Rachelint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShiKaiWi ShiKaiWi merged commit 1252192 into apache:main Sep 7, 2023
6 checks passed
@ShiKaiWi ShiKaiWi deleted the feat-support-partition-no-rule branch September 7, 2023 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants