Repository navigation
[Opt](sys table) Add a system table column_data_sizes - #56815
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
f0d4f47 to
28c7217
Compare
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
43cb797 to
2216c85
Compare
2216c85 to
12499e2
Compare
94bae35 to
d2cbde1
Compare
7640a13 to
75c443a
Compare
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
ClickBench: Total hot run time: 30.9 s |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
FE Regression Coverage ReportIncrement line coverage |
|
PR approved by at least one committer and no changes requested. |
Add a system table `column_data_sizes` for querying columns' data page sizes: ```sql MySQL [email protected]:information_schema> show create table information_schema.column_data_sizes; +-------------------+------------------------------------------+ | Table | Create Table | +-------------------+------------------------------------------+ | column_data_sizes | CREATE TABLE `column_data_sizes` ( | | | `BACKEND_ID` bigint NULL, | | | `TABLE_ID` bigint NULL, | | | `INDEX_ID` bigint NULL, | | | `PARTITION_ID` bigint NULL, | | | `TABLET_ID` bigint NULL, | | | `ROWSET_ID` varchar(64) NULL, | | | `COLUMN_UNIQUE_ID` int NULL, | | | `COLUMN_NAME` varchar(64) NULL, | | | `COLUMN_TYPE` varchar(64) NULL, | | | `COMPRESSED_DATA_BYTES` bigint NULL, | | | `UNCOMPRESSED_DATA_BYTES` bigint NULL, | | | `RAW_DATA_BYTES` bigint NULL | | | ) ENGINE=SCHEMA; | +-------------------+------------------------------------------+ ``` - **COMPRESSED_DATA_BYTES**: total size of compressed data pages in bytes, for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats - **UNCOMPRESSED_DATA_BYTES**: total size of uncompressed data pages in bytes, for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats - **RAW_DATA_BYTES**: total size of input raw data in bytes(calculated via `XXXPageBuilder`'s `Status add(const uint8_t* vals, size_t* count)` ), for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats To query columns' data page sizes in a table: ```sql SELECT COLUMN_NAME, sum(COMPRESSED_DATA_BYTES) AS compressed_data_bytes, sum(UNCOMPRESSED_DATA_BYTES) AS uncompressed_data_bytes, sum(RAW_DATA_BYTES) as raw_data_bytes FROM information_schema.column_data_sizes WHERE table_id=${TABLE_ID} GROUP BY COLUMN_NAME, COLUMN_TYPE ORDER BY data_size desc; ``` Note: - variant column is not supported. - In cloud mode, only BE local's rowsets will be queried. None - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
Add a system table `column_data_sizes` for querying columns' data page sizes: ```sql MySQL [email protected]:information_schema> show create table information_schema.column_data_sizes; +-------------------+------------------------------------------+ | Table | Create Table | +-------------------+------------------------------------------+ | column_data_sizes | CREATE TABLE `column_data_sizes` ( | | | `BACKEND_ID` bigint NULL, | | | `TABLE_ID` bigint NULL, | | | `INDEX_ID` bigint NULL, | | | `PARTITION_ID` bigint NULL, | | | `TABLET_ID` bigint NULL, | | | `ROWSET_ID` varchar(64) NULL, | | | `COLUMN_UNIQUE_ID` int NULL, | | | `COLUMN_NAME` varchar(64) NULL, | | | `COLUMN_TYPE` varchar(64) NULL, | | | `COMPRESSED_DATA_BYTES` bigint NULL, | | | `UNCOMPRESSED_DATA_BYTES` bigint NULL, | | | `RAW_DATA_BYTES` bigint NULL | | | ) ENGINE=SCHEMA; | +-------------------+------------------------------------------+ ``` - **COMPRESSED_DATA_BYTES**: total size of compressed data pages in bytes, for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats - **UNCOMPRESSED_DATA_BYTES**: total size of uncompressed data pages in bytes, for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats - **RAW_DATA_BYTES**: total size of input raw data in bytes(calculated via `XXXPageBuilder`'s `Status add(const uint8_t* vals, size_t* count)` ), for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats To query columns' data page sizes in a table: ```sql SELECT COLUMN_NAME, sum(COMPRESSED_DATA_BYTES) AS compressed_data_bytes, sum(UNCOMPRESSED_DATA_BYTES) AS uncompressed_data_bytes, sum(RAW_DATA_BYTES) as raw_data_bytes FROM information_schema.column_data_sizes WHERE table_id=${TABLE_ID} GROUP BY COLUMN_NAME, COLUMN_TYPE ORDER BY data_size desc; ``` Note: - variant column is not supported. - In cloud mode, only BE local's rowsets will be queried. None - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
Add a system table `column_data_sizes` for querying columns' data page sizes: ```sql MySQL [email protected]:information_schema> show create table information_schema.column_data_sizes; +-------------------+------------------------------------------+ | Table | Create Table | +-------------------+------------------------------------------+ | column_data_sizes | CREATE TABLE `column_data_sizes` ( | | | `BACKEND_ID` bigint NULL, | | | `TABLE_ID` bigint NULL, | | | `INDEX_ID` bigint NULL, | | | `PARTITION_ID` bigint NULL, | | | `TABLET_ID` bigint NULL, | | | `ROWSET_ID` varchar(64) NULL, | | | `COLUMN_UNIQUE_ID` int NULL, | | | `COLUMN_NAME` varchar(64) NULL, | | | `COLUMN_TYPE` varchar(64) NULL, | | | `COMPRESSED_DATA_BYTES` bigint NULL, | | | `UNCOMPRESSED_DATA_BYTES` bigint NULL, | | | `RAW_DATA_BYTES` bigint NULL | | | ) ENGINE=SCHEMA; | +-------------------+------------------------------------------+ ``` - **COMPRESSED_DATA_BYTES**: total size of compressed data pages in bytes, for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats - **UNCOMPRESSED_DATA_BYTES**: total size of uncompressed data pages in bytes, for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats - **RAW_DATA_BYTES**: total size of input raw data in bytes(calculated via `XXXPageBuilder`'s `Status add(const uint8_t* vals, size_t* count)` ), for complex type(array/map/struct), it's the sum of all leaf scalar column writers' stats To query columns' data page sizes in a table: ```sql SELECT COLUMN_NAME, sum(COMPRESSED_DATA_BYTES) AS compressed_data_bytes, sum(UNCOMPRESSED_DATA_BYTES) AS uncompressed_data_bytes, sum(RAW_DATA_BYTES) as raw_data_bytes FROM information_schema.column_data_sizes WHERE table_id=${TABLE_ID} GROUP BY COLUMN_NAME, COLUMN_TYPE ORDER BY data_size desc; ``` Note: - variant column is not supported. - In cloud mode, only BE local's rowsets will be queried. None - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…57220 #57327 #59075 (#57441) ### What problem does this PR solve? pick: - #56815 - #56846 - #57220 - #57327 - #59075 Clickbench result on alicloud c6.4xlarge machine, Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz ||(baseline) LZ4F, 64KB data page size, 48 bucket, binary_plain_encoding_default_impl=v1, integer_type_default_use_plain_encoding =false| zstd(3), 1MB data page size, 48 bucket, binary_plain_encoding_default_impl=v1, integer_type_default_use_plain_encoding =false | zstd(3), 1MB data page size, 48 bucket, binary_plain_encoding_default_impl=v2, integer_type_default_use_plain_encoding =true | |---|---|---|---| |data size|16.087 GB| 11.016 GB | 8.56 GB | |load time|592s| 555s | 539s | |cold run total| 214.22 s | 177.57 s | 131.4 s | |hot run total| 36.03 s | 39.82 s | 39.05 s | ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
### What problem does this PR solve? Issue Number: None Related PR: apache#56815 Problem Summary: The segment writer stores each column's data page bytes (compressed, uncompressed and raw) in its footer meta, which `information_schema.column_data_sizes` reads. `VariantColumnWriter`, `VariantSubcolumnWriter` and `VariantDocCompactWriter` returned 0 (TODO) from `get_raw_data_bytes()`, `get_total_uncompressed_data_pages_bytes()` and `get_total_compressed_data_pages_bytes()`, so every VARIANT column reported 0 bytes although its data is written by inner writers: the root, the materialized subcolumns and the sparse or doc value columns. The variant writers now sum the three counters over their inner writers, the same way the struct, array and map writers already do. `ColumnWriter::DataBytesGetter` names the getter that the variant writer layers pass down. The footer now stores real data bytes on variant column metas instead of 0, so the 29 checked-in golden Segment files of the 14 variant cases in `segment_flusher_format_test` are regenerated (each grows by 2 to 4 bytes; only those three counters of the variant metas differ). The other 59 golden cases are byte-identical. The footer raw_data_bytes of a variant root is also the first-batch hint of the segment iterator's adaptive batch size predictor when a query reads the whole variant column; it was 0 for variants. Vertical compaction's footer-based batch size estimate still skips variant columns; its stale comment is updated. ### Release note None ### Check List (For Author) - Test: Unit Test (segment_flusher_format_test with the regenerated golden files, variant writer, compaction and segment writer tests) - Behavior changed: Yes. Variant column metas store their data page bytes instead of 0. - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ata_sizes ### What problem does this PR solve? Issue Number: None Related PR: apache#56815 Problem Summary: Cover ordinary and doc mode variants with inline (V2) and external (V3) column meta, before and after a full compaction. The sizes of `id` and `v` must be above 0, and the data pages of all columns must lie within the rowsets' DATA_DISK_SIZE and cover more than half of it; they cover 91%-96%. Without counting the metas embedded in the variant root the V3 tables drop to 35% and 11% after compaction; without resolving the parent unique id the V2 tables drop to 3% and 2%. The table layouts are set explicitly because CI fuzzes the variant defaults and the storage format. ### Release note None ### Check List (For Author) - Test: Regression test - Behavior changed: No - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ata_sizes ### What problem does this PR solve? Issue Number: None Related PR: apache#56815 Problem Summary: Cover ordinary and doc mode variants with inline (V2) and external (V3) column meta, before and after a full compaction. The sizes of `id` and `v` must be above 0, and the data pages of all columns must lie within the rowsets' DATA_DISK_SIZE and cover more than half of it; they cover 91%-96%. Without counting the metas embedded in the variant root the V3 tables drop to 35% and 11% after compaction; without resolving the parent unique id the V2 tables drop to 3% and 2%. The table layouts are set explicitly because CI fuzzes the variant defaults and the storage format. ### Release note None ### Check List (For Author) - Test: Regression test - Behavior changed: No - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ata_sizes ### What problem does this PR solve? Issue Number: None Related PR: apache#56815 Problem Summary: Cover ordinary and doc mode variants with inline (V2) and external (V3) column meta, before and after a full compaction. The sizes of `id` and `v` must be above 0, and the data pages of all columns must lie within the rowsets' DATA_DISK_SIZE and cover more than half of it; they cover 91%-96%. Without counting the metas embedded in the variant root the V3 tables drop to 35% and 11% after compaction; without resolving the parent unique id the V2 tables drop to 3% and 2%. The table layouts are set explicitly because CI fuzzes the variant defaults and the storage format. ### Release note None ### Check List (For Author) - Test: Regression test - Behavior changed: No - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
### What problem does this PR solve? Issue Number: None Related PR: apache#56815 Problem Summary: The segment writer stores each column's data page bytes (compressed, uncompressed and raw) in its footer meta, which `information_schema.column_data_sizes` reads. `VariantColumnWriter`, `VariantSubcolumnWriter` and `VariantDocCompactWriter` returned 0 (TODO) from `get_raw_data_bytes()`, `get_total_uncompressed_data_pages_bytes()` and `get_total_compressed_data_pages_bytes()`, so every VARIANT column reported 0 bytes although its data is written by inner writers: the root, the materialized subcolumns and the sparse or doc value columns. The variant writers now sum the three counters over their inner writers, the same way the struct, array and map writers already do. `ColumnWriter::DataBytesGetter` names the getter that the variant writer layers pass down. The footer now stores real data bytes on variant column metas instead of 0, so the 29 checked-in golden Segment files of the 14 variant cases in `segment_flusher_format_test` are regenerated (each grows by 2 to 4 bytes; only those three counters of the variant metas differ). The other 59 golden cases are byte-identical. The footer raw_data_bytes of a variant root is also the first-batch hint of the segment iterator's adaptive batch size predictor when a query reads the whole variant column; it was 0 for variants. Vertical compaction's footer-based batch size estimate still skips variant columns; its stale comment is updated. ### Release note None ### Check List (For Author) - Test: Unit Test (segment_flusher_format_test with the regenerated golden files, variant writer, compaction and segment writer tests) - Behavior changed: Yes. Variant column metas store their data page bytes instead of 0. - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ata_sizes ### What problem does this PR solve? Issue Number: None Related PR: apache#56815 Problem Summary: Cover ordinary and doc mode variants with inline (V2) and external (V3) column meta, before and after a full compaction. The sizes of `id` and `v` must be above 0, and the data pages of all columns must lie within the rowsets' DATA_DISK_SIZE and cover more than half of it; they cover 91%-96%. Without counting the metas embedded in the variant root the V3 tables drop to 35% and 11% after compaction; without resolving the parent unique id the V2 tables drop to 3% and 2%. The table layouts are set explicitly because CI fuzzes the variant defaults and the storage format. ### Release note None ### Check List (For Author) - Test: Regression test - Behavior changed: No - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
### What problem does this PR solve? Issue Number: None Related PR: apache#56815 Problem Summary: The segment writer stores each column's data page bytes (compressed, uncompressed and raw) in its footer meta, which `information_schema.column_data_sizes` reads. `VariantColumnWriter`, `VariantSubcolumnWriter` and `VariantDocCompactWriter` returned 0 (TODO) from `get_raw_data_bytes()`, `get_total_uncompressed_data_pages_bytes()` and `get_total_compressed_data_pages_bytes()`, so every VARIANT column reported 0 bytes although its data is written by inner writers: the root, the materialized subcolumns and the sparse or doc value columns. The variant writers now sum the three counters over their inner writers, the same way the struct, array and map writers already do. `ColumnWriter::DataBytesGetter` names the getter that the variant writer layers pass down. The footer now stores real data bytes on variant column metas instead of 0, so the 29 checked-in golden Segment files of the 14 variant cases in `segment_flusher_format_test` are regenerated (each grows by 2 to 4 bytes; only those three counters of the variant metas differ). The other 59 golden cases are byte-identical. The footer raw_data_bytes of a variant root is also the first-batch hint of the segment iterator's adaptive batch size predictor when a query reads the whole variant column; it was 0 for variants. Vertical compaction's footer-based batch size estimate still skips variant columns; its stale comment is updated. ### Release note None ### Check List (For Author) - Test: Unit Test (segment_flusher_format_test with the regenerated golden files, variant writer, compaction and segment writer tests) - Behavior changed: Yes. Variant column metas store their data page bytes instead of 0. - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ata_sizes ### What problem does this PR solve? Issue Number: None Related PR: apache#56815 Problem Summary: Cover ordinary and doc mode variants with inline (V2) and external (V3) column meta, before and after a full compaction. The sizes of `id` and `v` must be above 0, and the data pages of all columns must lie within the rowsets' DATA_DISK_SIZE and cover more than half of it; they cover 91%-96%. Without counting the metas embedded in the variant root the V3 tables drop to 35% and 11% after compaction; without resolving the parent unique id the V2 tables drop to 3% and 2%. The table layouts are set explicitly because CI fuzzes the variant defaults and the storage format. ### Release note None ### Check List (For Author) - Test: Regression test - Behavior changed: No - Does this need documentation: No Co-Authored-By: Claude Opus 5.5 <[email protected]>
What problem does this PR solve?
Add a system table
column_data_sizesfor querying columns' data page sizes:XXXPageBuilder'sStatus add(const uint8_t* vals, size_t* count)), for complex type(array/map/struct), it's the sum of all leaf scalar column writers' statsTo query columns' data page sizes in a table:
Note:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)