Skip to content

[fix](group commit) Fix consumer projection handling - #69660

Open
sollhui wants to merge 2 commits into
apache:masterfrom
sollhui:fix/group-commit-scan-projections
Open

sollhui wants to merge 2 commits into
apache:masterfrom
sollhui:fix/group-commit-scan-projections

Conversation

@sollhui

@sollhui sollhui commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Group commit scans dequeue producer blocks directly, but inherit a scan entry point that skips projections because ordinary scanners have already applied them. The consumer can therefore interpret a block using a different column layout, causing type mismatches or incorrect MV values.

This change runs the consumer's intermediate and final projections through OperatorXBase. It also preserves the producer's generated base-column values in internal GROUP_COMMIT sink binding, and keeps the full group commit scan tuple in queue order. For example, inserting (k,v)=(1,99) into t(k,g AS(k+1),v) must consume [1,2,99] without pruning the middle input slot or reading g as v. A generated now(6) must retain the producer's timestamp rather than being evaluated again with the consumer's query time. MV expressions continue to be built from the base columns.

Release note

Fix group commit inserts producing column type mismatches or incorrect values when consumer projections differ from queued blocks. Preserve generated-column values and input column positions.

Check List (For Author)

  • Test:
    • BE unit tests added for reordered MV columns, nullable values, intermediate projections, repeated blocks and EOS, no-projection forwarding, and queue errors.
    • FE unit tests added for generated-column forwarding, the producer/consumer distinction, and preserving input slot positions while ordinary scans still prune unused slots.
    • Regression coverage includes two aliased MVs, a generated column before an ordinary column, an MV using that generated column, and generated now(6) values matching producer timestamps.
    • Passed: FE Checkstyle (using the available JDK 20), clang-format 16, build hygiene, and git diff --check.
    • Execution pending: BE/FE unit tests and the regression suite could not run because local JDK 17 is unusable (missing runtime modules / Failed setting boot class path). Compilation and clang-tidy remain unverified. These tests require CI validation.
  • Behavior changed: Yes. Group commit consumers execute their projections while retaining producer-generated base values and the queue's input layout.
  • Does this need documentation: No.

Check List (For Reviewer who merge this PR)

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

### What problem does this PR solve?

Group commit scans inherit `ScanOperatorX::get_block_after_projects()`, which skips operator projections because ordinary scans already evaluate them in `Scanner`. `GroupCommitOperatorX` instead dequeues producer blocks directly and never runs a Scanner. Its downstream row descriptor can therefore describe projected columns while the returned block still has the producer's layout.

For example, a queued block containing `[base columns, mv_int, mv_string]` can be consumed using a projection descriptor for `[base columns, mv_string, mv_int]`, causing a bad cast or incorrect values. Intermediate projections can also be skipped.

Override the group commit scan entry point to call `OperatorXBase::get_block_after_projects()`. This applies the consumer's intermediate and final projections and preserves the existing no-projection, empty-block, error propagation, and output-counter behavior. Ordinary scans are unchanged.

### Release note

Fix group commit inserts into tables with synchronous materialized views failing with column type mismatches or producing incorrect MV values when consumer projections differ from the queued block layout.

### Check List (For Author)

- Test:
    - [x] Unit Test added: `GroupCommitScanOperatorTest` covers reordered MV columns, nullable values, intermediate projections, repeated blocks and EOS, no-projection forwarding, and queue errors.
    - [x] Regression test added: `group_commit_mv_projection` inserts with sync group commit into a table with two aliased MVs and compares each physical MV index with aggregation over the base index.
    - Validation passed: clang-format 16 check, `build-support/check-build-hygiene.sh`, and `git diff --check`.
    - Execution pending: both `run-be-ut.sh --run --filter='GroupCommitScanOperatorTest.*' -j4` and `run-regression-test.sh --run -d insert_p0 -s group_commit_mv_projection` were attempted, but environment initialization failed because the local JDK 17 cannot start (`Failed setting boot class path`). Neither test suite was executed locally; BE compilation and clang-tidy are also unverified.
- Behavior changed:
    - [x] Yes. Group commit scans execute the projections specified by their consumer plan.
- Does this need documentation?
    - [x] No.

### 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?

@sollhui sollhui changed the title [fix](be) Apply consumer projections to group commit scans [fix](group commit) Apply consumer projections to group commit scans Oct 27, 2026
@sollhui

sollhui commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@sollhui

sollhui commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot 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.

Request changes: two verified regressions remain in generated-column group commit inserts: [P1] a pruned raw slot shifts positional reads and silently changes later ordinary values; [P2] reevaluating a volatile stored generated expression replaces the producer statement's value with the internal consumer's value. Both are detailed inline. There were no existing inline findings to retain or duplicate, and no additional user-provided focus.

Critical checkpoint conclusions:

  • Goal and proof: the override applies final/intermediate consumer projections and addresses the intended MV ordering defect, but the two generated-column cases prevent complete correctness. Added tests target the original failure; execution is unverified.
  • Scope and reuse: the production change is small and focused and reuses the established operator projection implementation.
  • Concurrency: producers and consumer retain the existing mutex-protected queue. Projection runs after queue unlock using task-local contexts; no additional race, lock-order, deadlock, or dependency-release issue was found.
  • Lifecycle and static initialization: queue Block ownership and COW column clearing preserve shared output lifetimes. No new reference cycle, static initialization dependency, or lifecycle owner was introduced.
  • Configuration: no configuration item or dynamic-update behavior changed.
  • Compatibility: no storage/wire format or exchanged ABI changed, and no new libc/system dependency was introduced. No release ELF or mixed-version runtime validation was performed.
  • Thrift/protobuf: no definitions changed; cross-branch field-ID checks are inapplicable.
  • Parallel paths: ordinary scans continue projecting in Scanner. Insert, stream/prepared, and cloud group commit producers reach the common queued consumer; the findings apply there.
  • Conditional checks: no production conditional branch was added or changed; the new comment explains the MV ordering scenario.
  • Test coverage: four BE unit cases cover nullable reordered MV outputs, intermediate projections, repeated blocks/EOS, no-projection forwarding/counters, and queue failure. The SQL regression compares two physical MV indexes with ordered base aggregations. Generated-column layouts are missing, as are direct projection-error and empty nonterminal queue cases; the latter control paths were traced statically. Fixture/mock APIs and CMake registration were inspected.
  • Expected results: no result file was added or modified. Unit expectations and ordered SQL comparison oracles are coherent by inspection; no runtime result is claimed.
  • Observability: existing projection timing and output counters cover the added work; no additional instrumentation need was identified.
  • Transaction/persistence/failover: WAL, commit/abort, EditLog/replay, and FE failover protocols are unchanged. No new persistence obligation was introduced.
  • Data writes, atomicity, and crashes: the two findings affect values supplied to the OLAP sink. Existing queue synchronization and error-to-abort cleanup remain intact; crash recovery was not executed.
  • FE/BE variables: no variable was added. Existing projection/descriptor fields are reused; their physical-slot interpretation is the P1 finding.
  • Performance: slot projections preserve shared columns through COW; no distinct avoidable copy or new asymptotic cost was found beyond evaluating required expressions. No benchmark was run.
  • Other concerns: no additional verified defect remained after the complete scope and missed-case sweeps.

Validation was static only. The pure-text build-support/check-build-hygiene.sh passed. No build, unit/regression test, clang-tidy, benchmark, or runtime/ELF validation was run. No source changes were made. Review convergence was reached after two bounded rounds; execution coverage limits above remain.

Review converged after 2 round(s).

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 28462 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit db2ca90ca6f07ee7e987230b8d99f91bb7652f96, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17585	5176	5068	5068
q2	2125	320	265	265
q3	10218	1400	816	816
q4	4680	462	342	342
q5	7443	798	521	521
q6	188	195	160	160
q7	751	794	592	592
q8	9261	1347	1058	1058
q9	5546	4180	4202	4180
q10	6814	1292	1043	1043
q11	436	250	224	224
q12	634	404	299	299
q13	18099	3651	2973	2973
q14	269	273	250	250
q15	q16	730	724	672	672
q17	1207	749	581	581
q18	7003	6201	6114	6114
q19	1112	969	602	602
q20	385	332	226	226
q21	5407	2217	2285	2217
q22	354	313	259	259
Total cold run time: 100247 ms
Total hot run time: 28462 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5621	5623	5610	5610
q2	682	600	519	519
q3	5214	5381	4912	4912
q4	2002	2375	1549	1549
q5	5290	5149	5732	5149
q6	261	198	151	151
q7	2319	2127	1959	1959
q8	3121	2891	2669	2669
q9	8157	8111	8089	8089
q10	3728	3674	3266	3266
q11	602	475	407	407
q12	705	729	532	532
q13	3677	3735	3254	3254
q14	315	326	286	286
q15	q16	696	759	641	641
q17	8299	7705	6974	6974
q18	13007	12237	12958	12237
q19	903	791	789	789
q20	2143	2160	1905	1905
q21	5639	4611	4807	4611
q22	482	463	418	418
Total cold run time: 72863 ms
Total hot run time: 65927 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 150896 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit db2ca90ca6f07ee7e987230b8d99f91bb7652f96, data reload: false

query5	4310	595	442	442
query6	438	200	187	187
query7	4800	438	221	221
query8	317	172	152	152
query9	8794	3133	3151	3133
query10	479	296	276	276
query11	5940	3846	3581	3581
query12	147	90	88	88
query13	1255	447	337	337
query14	6128	3918	3651	3651
query14_1	3453	3372	3433	3372
query15	213	196	180	180
query16	949	441	407	407
query17	856	697	500	500
query18	2402	414	297	297
query19	195	162	122	122
query20	82	81	82	81
query21	207	124	103	103
query22	12921	12967	12687	12687
query23	13463	12946	12398	12398
query23_1	12721	12597	12476	12476
query24	7350	834	463	463
query24_1	467	460	469	460
query25	511	400	343	343
query26	1260	252	132	132
query27	2784	439	266	266
query28	4671	1956	1952	1952
query29	1534	579	435	435
query30	299	215	182	182
query31	1001	935	821	821
query32	134	85	91	85
query33	523	292	237	237
query34	902	843	488	488
query35	728	744	628	628
query36	833	782	746	746
query37	118	99	79	79
query38	1794	1708	1675	1675
query39	798	784	754	754
query39_1	734	725	728	725
query40	213	120	98	98
query41	71	62	68	62
query42	89	86	86	86
query43	345	356	308	308
query44	1336	692	702	692
query45	182	167	165	165
query46	847	971	575	575
query47	2932	2913	2938	2913
query48	303	321	225	225
query49	578	402	301	301
query50	691	285	211	211
query51	10338	10762	10533	10533
query52	86	84	72	72
query53	187	215	153	153
query54	243	209	199	199
query55	81	71	68	68
query56	245	229	216	216
query57	1652	1613	1583	1583
query58	310	269	274	269
query59	2181	2183	2011	2011
query60	284	245	221	221
query61	141	148	147	147
query62	379	339	285	285
query63	190	153	159	153
query64	2763	943	774	774
query65	3344	3258	3263	3258
query66	1775	416	308	308
query67	20232	20075	20146	20075
query68	2927	1021	614	614
query69	377	277	237	237
query70	830	782	805	782
query71	298	226	203	203
query72	2808	2647	2290	2290
query73	503	518	291	291
query74	4654	4515	4322	4322
query75	2337	2279	1886	1886
query76	2302	1010	612	612
query77	329	409	265	265
query78	9818	9760	9110	9110
query79	879	844	524	524
query80	493	413	332	332
query81	531	316	272	272
query82	205	136	109	109
query83	202	196	186	186
query84	293	115	97	97
query85	774	458	377	377
query86	304	248	230	230
query87	2001	1946	1812	1812
query88	3636	2682	2667	2667
query89	313	274	239	239
query90	2131	168	163	163
query91	160	149	130	130
query92	97	106	90	90
query93	994	1009	582	582
query94	458	328	302	302
query95	578	396	308	308
query96	662	500	233	233
query97	2482	2471	2318	2318
query98	157	153	149	149
query99	753	759	645	645
Total cold run time: 233623 ms
Total hot run time: 150896 ms

@hello-stephen

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

query1	0.01	0.00	0.01
query2	0.10	0.05	0.05
query3	0.26	0.09	0.09
query4	1.61	0.10	0.10
query5	0.23	0.25	0.24
query6	1.17	0.68	0.69
query7	0.04	0.00	0.01
query8	0.06	0.04	0.04
query9	0.41	0.35	0.34
query10	0.58	0.57	0.60
query11	0.20	0.14	0.14
query12	0.19	0.14	0.14
query13	0.48	0.50	0.48
query14	1.03	1.03	1.00
query15	0.62	0.62	0.61
query16	0.36	0.35	0.33
query17	1.15	1.15	1.10
query18	0.21	0.19	0.20
query19	2.13	1.94	1.99
query20	0.02	0.02	0.01
query21	15.48	0.19	0.14
query22	4.72	0.06	0.05
query23	16.27	0.32	0.12
query24	3.10	0.52	0.44
query25	0.11	0.06	0.04
query26	1.16	0.23	0.16
query27	0.05	0.04	0.04
query28	3.39	0.76	0.35
query29	12.50	4.09	3.26
query30	0.28	0.12	0.10
query31	2.77	0.56	0.33
query32	3.22	0.60	0.52
query33	3.32	3.27	3.12
query34	15.37	4.02	3.38
query35	3.35	3.33	3.34
query36	0.55	0.44	0.43
query37	0.09	0.07	0.06
query38	0.04	0.04	0.03
query39	0.03	0.03	0.03
query40	0.17	0.14	0.14
query41	0.08	0.03	0.02
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 96.99 s
Total hot run time: 24.2 s

…consumers

### What problem does this PR solve?

Related PR: apache#69660

Problem Summary: Enabling group commit consumer projections exposes two issues:
recomputing a generated base column leaves its queued slot unused, allowing
scan pruning to shift subsequent input positions, and volatile generated
expressions can produce values different from the producer's values. Forward
generated base columns only for internal GROUP_COMMIT sinks and preserve the
full GroupCommitScanNode input tuple. MV expressions still use these base values.

### Release note

Preserve generated column values and column positions in group commit inserts.

### Check List (For Author)

- Test: Add FE binding and scan-slot unit tests and extend the regression suite
  with middle generated columns, an MV using generated values, and now(6).
  Checkstyle passed using JDK 20; git diff --check passed. FE unit tests and
  regression execution were attempted but blocked by the unusable local JDK 17.
- Behavior changed: Yes; internal consumers preserve producer-generated values.
- Does this need documentation: No.
@sollhui

sollhui commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@sollhui

sollhui commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot 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.

Static review of head 0e65c69a130ee461c6c44656d2ffea8397740e2b covered all eight changed files and the producer, queue, projection, binding, descriptor and sink paths. No new actionable finding was identified, and no previously reported P0/P1 finding remains applicable to this head.

Both existing concerns are fixed by the current changes:

  • 4384969133: generated-middle slot alignment: the consumer forwards generated base inputs and retains the full scan tuple. For queued [k,g,v]=[1,2,99], c3 remains at position 2, so v remains 99.
  • 4384969143: volatile generated values: internal GROUP_COMMIT binding forwards the producer's generated value instead of rebuilding now(6) with the consumer's query time. MV expressions can still reference that forwarded value.

Critical checkpoint conclusions:

  1. Goal and evidence: The queue consumer now uses the established final/intermediate projection engine, with FE changes preserving generated values and positional inputs. Targeted BE, FE and regression tests are present; execution was not performed.
  2. Scope and reuse: Four production files implement three focused mechanisms; four test files cover them. The implementation reuses existing projection, binding and descriptor machinery.
  3. Concurrency: Queue mutation and WAL serialization/dequeue remain serialized by the existing mutex. Projection runs after dequeue with task-local expression clones; no new lock order or heavy work inside queue locks was found.
  4. Lifecycle and ownership: Inherited preparation/open clones final and intermediate expressions. Distinct queued Block objects, local scratch storage and existing recursive COW clearing preserve shared outputs across repeated blocks. No new static initialization, thread or ownership cycle is introduced.
  5. Configuration: No configuration item is added or changed.
  6. Compatibility: Existing projection and tuple fields are reused; no wire or storage-format change was identified. Mixed-version execution was not tested.
  7. Thrift/protobuf IDs: Neither definition directory changes, so cross-branch field-ID auditing is not applicable.
  8. Parallel paths: Ordinary scans retain scanner-side projection and pruning. Sync/async queue producers share this consumer. Stream/prepared producers still compute generated values. WAL replay forwards surviving generated inputs through explicit header/name mapping; supported ALTER rejects adding generated columns. Cloud sink selection remains downstream.
  9. Conditional checks: The GROUP_COMMIT generated-expression bypass and GroupCommitScanNode pruning exception have comments explaining the concrete failure scenarios. Ordinary producer binding and scan pruning retain their existing behavior.
  10. Test coverage: BE cases cover reordered MV outputs, nullable values, repeated blocks/EOS, CSE, no-projection forwarding and queue errors. FE cases cover generated/volatile forwarding, producer distinction and retained versus ordinary-pruned slots. Regression cases compare both physical MV indexes with base aggregations and cover generated-middle, generated-MV and timestamp preservation.
  11. Expected results: No result file changes. Regression comparisons are ordered and use the existing two-query comparison helper; no handwritten output is introduced.
  12. Observability: Existing projection timing, output counters and queue/status logging cover this execution; no new logging burden or distributed operation requires additional telemetry.
  13. Transactions, persistence and failover: No new persistent metadata, EditLog entry or commit/replay format is introduced. Queue finish/failure and WAL replay interactions were traced; no new gap was substantiated. Version visibility and delete-bitmap logic are unchanged.
  14. Writes, atomicity and crash behavior: Projected blocks enter the existing OLAP sink/transaction lifecycle. Queue and projection failures propagate through Status/exception boundaries; no new partial-commit path or resource cycle was identified statically.
  15. FE-to-BE variables: No new variable is transmitted. Existing output tuples, projections and intermediate descriptors supply the generic execution path.
  16. Performance and memory: Forwarded columns use existing COW sharing and mutable-output reuse. Consumer MV computation is necessary for the requested schema; no avoidable deep copy or new per-row synchronization was identified. Existing pipeline memory tracking/reservation applies.
  17. Additional concerns: Rechecked earlier TVF pruning, materialized descriptor order, generated dependencies, session guards, hidden/shadow values, MV suffix ordering, WAL schema evolution, nullable handling and test scaffolding. All candidates and initial risk items have evidence-based dispositions; none remains unresolved.

User focus: the supplied focus file contains no additional concerns.

Validation limits: this was static inspection only. No builds, tests, benchmarks, cluster execution, mixed-version rollout or crash/replay experiment was run. The BE unit fixture uses mock slot contexts and bypasses production scanner initialization; real prepare/open, function failures, concurrent cancellation and WAL/cloud combinations were traced in source rather than executed. These execution limits remain for CI/runtime validation; no source-review coverage gap or unresolved correctness candidate remains.

Review converged after 2 round(s).

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 28521 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 0e65c69a130ee461c6c44656d2ffea8397740e2b, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17607	5126	5074	5074
q2	2123	361	250	250
q3	10204	1368	843	843
q4	4684	466	336	336
q5	7440	807	531	531
q6	180	186	149	149
q7	749	795	595	595
q8	9250	1343	1117	1117
q9	5569	4220	4187	4187
q10	6865	1298	1042	1042
q11	424	246	230	230
q12	637	402	280	280
q13	18114	3613	3017	3017
q14	270	279	247	247
q15	q16	737	717	682	682
q17	1213	751	587	587
q18	7018	6182	6092	6092
q19	1099	961	612	612
q20	408	340	222	222
q21	5397	2175	2312	2175
q22	350	303	253	253
Total cold run time: 100338 ms
Total hot run time: 28521 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5627	5663	5634	5634
q2	675	588	578	578
q3	5210	5389	4861	4861
q4	2004	2152	1568	1568
q5	5297	5157	5694	5157
q6	261	211	153	153
q7	2379	2114	1892	1892
q8	3061	2991	2737	2737
q9	7991	8099	8083	8083
q10	3743	3655	3249	3249
q11	652	441	412	412
q12	711	685	522	522
q13	3771	3857	3280	3280
q14	316	318	310	310
q15	q16	743	717	661	661
q17	8305	7646	6888	6888
q18	12969	12221	12876	12221
q19	918	821	822	821
q20	2158	2134	1925	1925
q21	5781	4791	4889	4791
q22	486	456	441	441
Total cold run time: 73058 ms
Total hot run time: 66184 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 66.93% (32197/48102)
Line Coverage 51.76% (340538/657965)
Region Coverage 47.17% (276139/585442)
Branch Coverage 48.87% (130199/266432)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

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

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 28548 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 0e65c69a130ee461c6c44656d2ffea8397740e2b, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17579	5147	5085	5085
q2	2144	349	261	261
q3	10166	1400	823	823
q4	4672	457	333	333
q5	7438	813	519	519
q6	184	182	153	153
q7	745	789	606	606
q8	9262	1316	1079	1079
q9	5544	4218	4195	4195
q10	6829	1278	1026	1026
q11	433	245	225	225
q12	642	400	279	279
q13	18095	3628	3104	3104
q14	285	263	246	246
q15	q16	738	710	665	665
q17	1204	745	567	567
q18	7452	6177	6155	6155
q19	1243	958	600	600
q20	395	340	241	241
q21	5125	2134	2268	2134
q22	351	292	252	252
Total cold run time: 100526 ms
Total hot run time: 28548 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5607	5590	5601	5590
q2	666	557	564	557
q3	5207	5386	4960	4960
q4	1993	2130	1536	1536
q5	5262	5180	5728	5180
q6	273	207	150	150
q7	2357	2119	1892	1892
q8	3081	2854	2729	2729
q9	8038	8093	7964	7964
q10	3695	3738	3237	3237
q11	606	462	421	421
q12	676	677	519	519
q13	3552	4040	3267	3267
q14	302	319	277	277
q15	q16	714	719	653	653
q17	8373	7582	6970	6970
q18	12944	12174	12886	12174
q19	917	780	777	777
q20	2108	2136	1905	1905
q21	5617	4574	4681	4574
q22	488	451	410	410
Total cold run time: 72476 ms
Total hot run time: 65742 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.45% (36097/46606)
Line Coverage 62.71% (408216/650930)
Region Coverage 59.19% (345264/583314)
Branch Coverage 60.12% (159799/265780)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 20.00% (2/10) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 28435 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 0e65c69a130ee461c6c44656d2ffea8397740e2b, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17593	5178	5041	5041
q2	2179	303	268	268
q3	10237	1364	816	816
q4	4673	460	331	331
q5	7443	783	534	534
q6	178	182	155	155
q7	758	832	601	601
q8	9251	1344	1145	1145
q9	5535	4180	4205	4180
q10	6825	1281	1025	1025
q11	434	257	231	231
q12	644	398	282	282
q13	18103	3545	3021	3021
q14	269	270	249	249
q15	q16	726	714	665	665
q17	1185	765	588	588
q18	7027	6186	6096	6096
q19	1112	957	594	594
q20	392	346	226	226
q21	5156	2125	2276	2125
q22	357	294	262	262
Total cold run time: 100077 ms
Total hot run time: 28435 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5602	5600	5583	5583
q2	669	574	505	505
q3	5231	5368	4887	4887
q4	1990	2114	1560	1560
q5	5283	5156	5552	5156
q6	258	199	158	158
q7	2292	2072	1834	1834
q8	3049	2694	2711	2694
q9	8029	8004	7946	7946
q10	3736	3847	3239	3239
q11	615	455	431	431
q12	713	683	535	535
q13	3506	3872	3258	3258
q14	304	305	311	305
q15	q16	707	707	641	641
q17	8260	6955	6945	6945
q18	12971	12176	12820	12176
q19	898	801	802	801
q20	2129	2135	1936	1936
q21	5648	4557	4693	4557
q22	481	458	401	401
Total cold run time: 72371 ms
Total hot run time: 65548 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 150318 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 0e65c69a130ee461c6c44656d2ffea8397740e2b, data reload: false

query5	4320	557	435	435
query6	418	205	184	184
query7	4808	437	216	216
query8	310	168	151	151
query9	8774	3083	3076	3076
query10	460	308	260	260
query11	5967	3835	3557	3557
query12	150	91	85	85
query13	1241	437	315	315
query14	6153	3911	3625	3625
query14_1	3455	3414	3461	3414
query15	209	200	178	178
query16	932	441	419	419
query17	844	675	543	543
query18	2436	430	308	308
query19	189	167	141	141
query20	85	83	84	83
query21	207	125	106	106
query22	12919	13141	12927	12927
query23	13398	12951	12339	12339
query23_1	12548	12399	12557	12399
query24	7336	827	450	450
query24_1	457	468	465	465
query25	522	383	333	333
query26	1262	255	132	132
query27	2776	429	262	262
query28	4659	1893	1923	1893
query29	1532	572	414	414
query30	301	212	180	180
query31	998	927	802	802
query32	132	87	88	87
query33	507	286	230	230
query34	905	891	501	501
query35	721	742	630	630
query36	836	801	733	733
query37	121	90	87	87
query38	1748	1724	1681	1681
query39	777	797	736	736
query39_1	730	733	732	732
query40	220	125	91	91
query41	65	62	60	60
query42	83	80	87	80
query43	343	363	309	309
query44	1293	697	689	689
query45	174	173	162	162
query46	813	950	555	555
query47	3034	2957	2652	2652
query48	300	311	218	218
query49	567	394	289	289
query50	688	268	207	207
query51	10690	10626	10683	10626
query52	78	80	70	70
query53	183	201	151	151
query54	231	183	170	170
query55	67	65	62	62
query56	226	217	201	201
query57	1661	1627	1604	1604
query58	276	262	248	248
query59	2174	2175	1958	1958
query60	286	242	250	242
query61	143	143	143	143
query62	380	329	282	282
query63	184	153	151	151
query64	2696	912	743	743
query65	3323	3263	3241	3241
query66	1765	415	307	307
query67	20246	20185	20026	20026
query68	3061	1001	617	617
query69	394	285	242	242
query70	884	776	746	746
query71	307	235	214	214
query72	2763	2573	2221	2221
query73	509	517	298	298
query74	4628	4493	4341	4341
query75	2328	2285	1912	1912
query76	2298	1006	588	588
query77	343	368	267	267
query78	9611	9691	9176	9176
query79	888	855	516	516
query80	477	405	338	338
query81	517	319	269	269
query82	196	126	101	101
query83	201	192	180	180
query84	284	117	101	101
query85	755	416	390	390
query86	293	254	233	233
query87	1978	1943	1799	1799
query88	3576	2674	2639	2639
query89	314	274	239	239
query90	2094	168	167	167
query91	157	150	125	125
query92	101	90	103	90
query93	968	993	584	584
query94	437	309	264	264
query95	582	335	315	315
query96	665	481	234	234
query97	2424	2418	2310	2310
query98	161	161	147	147
query99	761	754	646	646
Total cold run time: 232861 ms
Total hot run time: 150318 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.09	0.05	0.05
query3	0.26	0.08	0.08
query4	1.61	0.09	0.11
query5	0.27	0.24	0.25
query6	1.17	0.69	0.68
query7	0.04	0.00	0.00
query8	0.05	0.04	0.03
query9	0.43	0.35	0.36
query10	0.61	0.61	0.58
query11	0.20	0.14	0.14
query12	0.19	0.16	0.14
query13	0.49	0.49	0.50
query14	1.03	1.02	1.02
query15	0.63	0.60	0.61
query16	0.35	0.35	0.35
query17	1.11	1.14	1.14
query18	0.20	0.19	0.19
query19	2.07	1.99	2.04
query20	0.02	0.01	0.01
query21	15.48	0.19	0.13
query22	4.88	0.06	0.05
query23	16.29	0.33	0.11
query24	3.14	0.60	0.49
query25	0.12	0.04	0.04
query26	1.60	0.21	0.17
query27	0.04	0.03	0.03
query28	3.45	0.70	0.34
query29	12.48	4.18	3.29
query30	0.28	0.13	0.10
query31	2.77	0.56	0.32
query32	3.24	0.59	0.49
query33	3.16	3.21	3.17
query34	15.34	4.01	3.39
query35	3.34	3.34	3.34
query36	0.55	0.44	0.43
query37	0.10	0.06	0.07
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.16	0.14	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.05	0.04	0.03
Total cold run time: 97.51 s
Total hot run time: 24.42 s

@sollhui sollhui changed the title [fix](group commit) Apply consumer projections to group commit scans [fix](group commit) Fix consumer projection handling Oct 27, 2026
liaoxin01 added a commit to liaoxin01/doris that referenced this pull request Nov 6, 2026
### Background

Group commit producers and consumers can be planned on different FEs. Their block layouts follow the table's full schema.

### What problem does this PR solve?

Issue Number: None
Related PR: apache#69660 (same layout issue), apache#70160 (upstream WAL replay compatibility)
PR Type: Bugfix

Problem Summary:

Different index-map iteration orders can produce different MV column layouts across FEs, causing group commit cast errors or swapped values.

### Details

- **Frequency:** Multiple synchronous MVs with producer and consumer plans generated on different FEs.
- **Root cause:** Full-schema construction follows map iteration order, which can differ after metadata recovery.
- **Why existing tests missed it:** Coverage missed recovery followed by adding another MV across FEs.
- **Fix:** Keep base columns first, then visit indexes in ascending ID order and deduplicate columns by definition name.
- **Other paths and branches:** Rollup, Schema Change and Gson recovery share this method. Mixed-version FEs can still generate different layouts during rollout.
- **Behavior change:** Identical index metadata produces identical full-schema layouts across FEs.

### Testing

- 44 FE unit tests passed. Both new regression tests fail before the fix and pass afterward.
- FE server build with Checkstyle passed (UI disabled); baseline ASAN BE rebuilt.
- Six-MV `multiple_ssb` passed through both FEs. All 54 output columns matched, including after follower restart.
- Base-only, multi-MV and Schema Change WAL replay regressions passed through the follower. The initial ASAN run hit the local 16 GB memory cap; rerunning with 32 GB passed.

### Release note

Fix group commit failures and incorrect MV values caused by inconsistent column ordering across FEs.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready; local checks passed, CI pending.

### AI Disclosure

- Tool: Codex
- Generated: Code, tests, and description
- Human review: Pending author review
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