Skip to content

[Feature] Support BUCKET(id, ...) query hint to scan specific buckets of an olap table #66077

Open

Description

@Baymine

Search before asking

  • I had searched in the issues and found no similar issues.

Description

Doris already supports a TABLET(id, ...) hint to restrict a scan to specific tablets, e.g. SELECT * FROM tbl TABLET(10086). This is useful for debugging and targeted scans, but it requires the user to first look up raw tablet ids (via SHOW TABLETS), and those ids change across schema changes and differ per partition.

It would be convenient to target buckets by their ordinal instead. Bucket k is stable and meaningful (it is the bucket that the distribution-key hash maps to), so BUCKET(0, 2) lets a user scan the buckets holding specific keys without any tablet-id lookup.

Proposal: add a BUCKET(<int>, ...) table hint that mirrors TABLET(...) at bucket-ordinal granularity:

SELECT * FROM tbl [PARTITION(...)] BUCKET(0, 2) alias;

A bucket id k resolves to the k-th tablet of each selected partition (partition.getBaseIndex().getTablets().get(k)) and reuses the existing manually-specified-tablet scan path. BUCKET and TABLET are mutually exclusive.

Use case

Debugging and targeted scans of specific buckets without having to look up raw tablet ids first.

Related issues

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added a commit that references this issue on Jul 27, 2026
    0b8c65b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions