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

[Enhancement] Append LIST partition info when list table partitions by rest api. #53382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

plotor
Copy link
Contributor

@plotor plotor commented Nov 29, 2024

Why I'm doing:

You can learn about the background from PR #52682.

What I'm doing:

This PR is a supplement to #41938, and append LIST partition info when list table's partitions by RESTful API. For example, for the following LIST partition table:

CREATE TABLE `tb_list_partition` (
  `c0` bigint(20) NOT NULL COMMENT "cc0",
  `c1` datetime NOT NULL COMMENT "cc1",
  `c2` varchar(32) NOT NULL COMMENT "cc2",
  `c3` decimal(32, 8) NULL DEFAULT "0" COMMENT "cc3",
  `c4` array<int(11)> NULL COMMENT "cc4",
  `c5` struct<C4_a int(11), c4_b struct<c4_b_1 varchar(65533)>> NULL COMMENT "cc5",
  `c6` map<bigint(20),map<int(11),varchar(65533)>> NOT NULL COMMENT "cc6",
  `c7` json NOT NULL COMMENT "cc7",
  `c8` bitmap NOT NULL COMMENT "cc8",
  `c9` hll NOT NULL COMMENT "cc9",
  INDEX idx_bitmap (`c9`) USING BITMAP COMMENT ''
) ENGINE=OLAP
PRIMARY KEY(`c0`, `c1`, `c2`)
PARTITION BY LIST(`c2`)(
  PARTITION p1 VALUES IN ('beijing'),
  PARTITION p2 VALUES IN ('shanghai', 'hangzhou'),
  PARTITION p3 VALUES IN ('guangzhou', 'shenzhen'),
  PARTITION p4 VALUES IN ('chengdu', 'chongqing')
)
DISTRIBUTED BY HASH(`c0`) BUCKETS 8
PROPERTIES (
"enable_persistent_index" = "true",
"replication_num" = "3"
);

The /api/v2/catalogs/{catalog}/databases/{db}/tables/{table}/partition API will return the LIST partition information through the inKeys field:

{
    "result": {
        "pageNum": 0,
        "pageSize": 100,
        "pages": 1,
        "total": 4,
        "items": [
            {
                "id": 10321,
                "name": "p1",
                "bucketNum": 8,
                "distributionType": "HASH",
                "visibleVersion": 1,
                "visibleVersionTime": 1732870030714,
                "nextVersion": 2,
                "inKeys": [
                    [
                        "beijing"
                    ]
                ],
                "tablets": [
                    ...
                ]
            },
            {
                "id": 10322,
                "name": "p2",
                "bucketNum": 8,
                "distributionType": "HASH",
                "visibleVersion": 1,
                "visibleVersionTime": 1732870030715,
                "nextVersion": 2,
                "inKeys": [
                    [
                        "shanghai"
                    ],
                    [
                        "hangzhou"
                    ]
                ],
                "tablets": [
                    ...
                ]
            },
            {
                "id": 10323,
                "name": "p3",
                "bucketNum": 8,
                "distributionType": "HASH",
                "visibleVersion": 1,
                "visibleVersionTime": 1732870030715,
                "nextVersion": 2,
                "inKeys": [
                    [
                        "guangzhou"
                    ],
                    [
                        "shenzhen"
                    ]
                ],
                "tablets": [
                    ...
                ]
            },
            {
                "id": 10324,
                "name": "p4",
                "bucketNum": 8,
                "distributionType": "HASH",
                "visibleVersion": 1,
                "visibleVersionTime": 1732870030715,
                "nextVersion": 2,
                "inKeys": [
                    [
                        "chengdu"
                    ],
                    [
                        "chongqing"
                    ]
                ],
                "tablets": [
                    ...
                ]
            }
        ]
    },
    "code": "0",
    "message": "OK"
}

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@plotor plotor requested review from a team as code owners November 29, 2024 11:28
@wanpengfei-git wanpengfei-git requested a review from a team November 29, 2024 11:29
@mergify mergify bot assigned plotor Nov 29, 2024
@plotor plotor force-pushed the zhenchao-bypass-list-partition-20241129 branch 2 times, most recently from 5bbb397 to 69b386e Compare December 2, 2024 03:05
Copy link

github-actions bot commented Dec 2, 2024

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Dec 2, 2024

[FE Incremental Coverage Report]

fail : 30 / 41 (73.17%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/load/loadv2/SparkLoadPendingTask.java 0 3 00.00% [394, 395, 396]
🔵 com/starrocks/http/rest/TableQueryPlanAction.java 2 7 28.57% [223, 224, 266, 282, 290]
🔵 com/starrocks/load/PartitionUtils.java 13 16 81.25% [220, 221, 222]
🔵 com/starrocks/http/rest/v2/vo/PartitionInfoView.java 15 15 100.00% []

Copy link

github-actions bot commented Dec 2, 2024

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@plotor plotor force-pushed the zhenchao-bypass-list-partition-20241129 branch from 69b386e to ef6b979 Compare December 4, 2024 07:25
Copy link

sonarcloud bot commented Dec 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants