Skip to content

[Opt](sys table) Add a system table column_data_sizes - #56815

Merged
dataroaring merged 10 commits into
apache:masterfrom
bobhan1:sys-table-col-data-size
Oct 16, 2025
Merged

dataroaring merged 10 commits into
apache:masterfrom
bobhan1:sys-table-col-data-size

Conversation

@bobhan1

@bobhan1 bobhan1 commented Oct 11, 2025 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Add a system table column_data_sizes for querying columns' data page sizes:

MySQL root@127.1: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:

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.

Release note

None

Check List (For Author)

  • Test

    • 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
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@bobhan1
bobhan1 force-pushed the sys-table-col-data-size branch 10 times, most recently from f0d4f47 to 28c7217 Compare October 11, 2025 07:56
@bobhan1

bobhan1 commented Oct 11, 2025

Copy link
Copy Markdown
Contributor Author

run buildall

@bobhan1
bobhan1 marked this pull request as ready for review October 11, 2025 07:58
@doris-robot

Copy link
Copy Markdown

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 83.38% (1635/1961)
Line Coverage 67.87% (28898/42578)
Region Coverage 68.07% (14234/20911)
Branch Coverage 58.38% (7579/12982)

@doris-robot

Copy link
Copy Markdown

BE UT Coverage Report

Increment line coverage 19.16% (55/287) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.49% (17735/33787)
Line Coverage 37.66% (160988/427436)
Region Coverage 32.17% (122996/382333)
Branch Coverage 33.54% (53910/160717)

@bobhan1
bobhan1 force-pushed the sys-table-col-data-size branch 2 times, most recently from 43cb797 to 2216c85 Compare October 13, 2025 03:17
@bobhan1
bobhan1 force-pushed the sys-table-col-data-size branch from 2216c85 to 12499e2 Compare October 13, 2025 03:55
@bobhan1
bobhan1 force-pushed the sys-table-col-data-size branch 2 times, most recently from 94bae35 to d2cbde1 Compare October 14, 2025 08:24
@bobhan1
bobhan1 force-pushed the sys-table-col-data-size branch from 7640a13 to 75c443a Compare October 15, 2025 11:32
@bobhan1

bobhan1 commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 83.27% (1638/1967)
Line Coverage 67.92% (28958/42638)
Region Coverage 68.13% (14264/20937)
Branch Coverage 58.39% (7589/12996)

@doris-robot

Copy link
Copy Markdown
ClickBench: Total hot run time: 30.9 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 75c443a9ece75a41156ef8852eacc369c5fb1381, data reload: false

query1	0.05	0.04	0.05
query2	0.11	0.06	0.07
query3	0.29	0.07	0.08
query4	1.60	0.09	0.08
query5	0.27	0.25	0.26
query6	1.17	0.66	0.64
query7	0.03	0.02	0.03
query8	0.06	0.07	0.05
query9	0.64	0.53	0.53
query10	0.59	0.59	0.58
query11	0.25	0.12	0.12
query12	0.25	0.14	0.15
query13	0.66	0.62	0.64
query14	1.03	1.03	1.04
query15	0.95	0.88	0.86
query16	0.40	0.39	0.40
query17	1.04	1.07	1.07
query18	0.23	0.22	0.22
query19	1.98	1.83	1.86
query20	0.02	0.01	0.02
query21	15.38	1.00	0.69
query22	0.93	1.10	0.83
query23	14.70	1.60	0.77
query24	5.39	0.60	0.31
query25	0.17	0.10	0.09
query26	0.55	0.22	0.17
query27	0.09	0.10	0.09
query28	11.10	1.68	1.05
query29	12.58	3.99	3.33
query30	0.32	0.12	0.10
query31	2.84	0.63	0.44
query32	3.25	0.60	0.50
query33	3.06	3.13	3.06
query34	16.70	5.46	4.77
query35	4.87	4.83	4.89
query36	0.67	0.54	0.52
query37	0.22	0.19	0.20
query38	0.19	0.17	0.18
query39	0.05	0.04	0.04
query40	0.22	0.18	0.17
query41	0.11	0.06	0.06
query42	0.07	0.06	0.06
query43	0.06	0.06	0.05
Total cold run time: 105.14 s
Total hot run time: 30.9 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 20.98% (86/410) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.55% (17802/33874)
Line Coverage 37.74% (161742/428519)
Region Coverage 32.18% (123255/382961)
Branch Coverage 33.61% (54153/161130)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 90.00% (369/410) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.24% (23656/33206)
Line Coverage 57.67% (246985/428262)
Region Coverage 52.62% (204117/387908)
Branch Coverage 54.50% (88299/162019)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (16/16) 🎉
Increment coverage report
Complete coverage report

@dataroaring dataroaring left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Oct 16, 2025
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@eldenmoon eldenmoon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@dataroaring
dataroaring merged commit 65b2a5f into apache:master Oct 16, 2025
12 checks passed
bobhan1 added a commit to bobhan1/doris that referenced this pull request Oct 28, 2025
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 -->
bobhan1 added a commit to bobhan1/doris that referenced this pull request Oct 30, 2025
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 -->
bobhan1 added a commit to bobhan1/doris that referenced this pull request Dec 17, 2025
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 -->
yiguolei pushed a commit that referenced this pull request Dec 19, 2025
…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 -->
eldenmoon added a commit to eldenmoon/incubator-doris that referenced this pull request Oct 17, 2026
### 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]>
eldenmoon added a commit to eldenmoon/incubator-doris that referenced this pull request Oct 17, 2026
…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]>
eldenmoon added a commit to eldenmoon/incubator-doris that referenced this pull request Oct 17, 2026
…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]>
eldenmoon added a commit to eldenmoon/incubator-doris that referenced this pull request Oct 17, 2026
…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]>
eldenmoon added a commit to eldenmoon/incubator-doris that referenced this pull request Oct 19, 2026
### 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]>
eldenmoon added a commit to eldenmoon/incubator-doris that referenced this pull request Oct 19, 2026
…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]>
eldenmoon added a commit to eldenmoon/incubator-doris that referenced this pull request Oct 19, 2026
### 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]>
eldenmoon added a commit to eldenmoon/incubator-doris that referenced this pull request Oct 19, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.0.3-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants