Skip to content

[branch-4.1][feature](variant) add variant doc mode (#59183) - #61281

Merged
eldenmoon merged 7 commits into
apache:branch-4.1from
csun5285:branch-4.1
Mar 16, 2026
Merged

[branch-4.1][feature](variant) add variant doc mode (#59183)#61281
eldenmoon merged 7 commits into
apache:branch-4.1from
csun5285:branch-4.1

Conversation

@csun5285

Copy link
Copy Markdown
Contributor

pick from master #59183, #60511, #60518, #60668

@csun5285
csun5285 requested a review from yiguolei as a code ownerMarch 12, 2026 11:22
@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?

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage79.15% (1788/2259)
Line Coverage64.50% (31945/49530)
Region Coverage65.29% (15976/24468)
Branch Coverage55.84% (8495/15214)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 33.57% (47/140) 🎉
Increment coverage report
Complete coverage report

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage79.15% (1788/2259)
Line Coverage64.48% (31938/49530)
Region Coverage65.29% (15976/24468)
Branch Coverage55.87% (8500/15214)

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage79.15% (1788/2259)
Line Coverage64.46% (31928/49530)
Region Coverage65.30% (15977/24468)
Branch Coverage55.83% (8494/15214)

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage79.15% (1788/2259)
Line Coverage64.49% (31941/49530)
Region Coverage65.29% (15976/24468)
Branch Coverage55.90% (8504/15214)

csun5285and others added 7 commits March 16, 2026 14:14
**DOC encoding**: materialize all subcolumns, and additionally keep the
original JSON as a “stored field” so queries can quickly return the
entire JSON document.
doc: apache/doris-website#3253
…hmarks (apache#60511)
Improve VARIANT doc-mode ingestion and compaction performance, and add a
write/compaction benchmark UT.
Key changes:
- Add config `enable_variant_doc_compaction_sparse_write` (default:
true) to
enable sparse writing for materialized subcolumns during doc-mode
compaction.
- Optimize doc value column generation: deduplicate paths, sort paths
once, and
serialize values directly into the binary column to reduce
allocations/copies.
- Optimize bucket sharding/stats collection with phmap and cached
path->bucket
mapping; remove per-row doc value sorting in writer.
- Refactor VariantDocCompactWriter finalize flow with an explicit write
plan;
skip invalid array types and fix doc materialization offset handling.
- Update variant-related UTs and add VariantDocModeCompactionTest to
benchmark
segment import and doc-mode compaction.
UT Testing:
- BE UT: VariantColumnWriterReaderTest.*, VariantUtilTest.*,
ColumnVariantTest.*
Benchmark Testing(Release compile):
- BE UT (Release-only, slow): VariantDocModeCompactionTest.*
<img width="902" height="778" alt="image"
src="https://github.com/user-attachments/assets/08fb9341-2620-484d-9cf9-f3a64c95d4bd"
/>
…dom session variables
Pin default_variant_enable_doc_mode=false and default_variant_max_subcolumns_count=2048
in search variant test suites to prevent fuzzy mode randomization from disabling
subcolumn extraction, which causes inverted index search to return empty results.
Fix two test failures caused by variant doc mode cherry-picks:
1. ColumnVariantTest.test_variant_deserialize_from_sparse_column:
Field element type (TYPE_INT) mismatched FieldInfo scalar_type_id
(TYPE_TINYINT), causing Field::get<TINYINT>() assertion failure.
Fixed by using matching TYPE_TINYINT field for first insert and
separate TYPE_INT field for second insert (type promotion test).
2. NativeReaderWriterTest.read_all_types_from_pregenerated_file:
Pre-generated binary test data was incompatible with updated
Variant serialization format. Regenerated the test data file.
@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage79.15% (1788/2259)
Line Coverage64.48% (31938/49530)
Region Coverage65.31% (15981/24468)
Branch Coverage55.84% (8496/15214)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 33.57% (47/140) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 74.13% (1255/1693) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage52.93% (19292/36451)
Line Coverage36.25% (180200/497120)
Region Coverage32.79% (139418/425214)
Branch Coverage33.82% (60656/179338)

@eldenmooneldenmoon 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

@eldenmoon
eldenmoon merged commit 8f280b3 into apache:branch-4.1Mar 16, 2026
22 of 25 checks passed
Sign up for freeto 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.

4 participants

@csun5285@hello-stephen@doris-robot@eldenmoon