Skip to content

[test](fe) Port the tests branch-4.2 added for three master fixes - #70163

Merged
morningman merged 1 commit into
apache:masterfrom
morningman:b2m-t50-4x-tests
Nov 5, 2026
Merged

morningman merged 1 commit into
apache:masterfrom
morningman:b2m-t50-4x-tests

Conversation

@morningman

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: #68206, #68636, #68368

Problem Summary:

In short. Three branch-4.2 backports of master fixes each added a test: #68206 (of #61342), #68636 (of #57006) and #68368 (of #66354). Master has the three fixes but none of the tests. This PR ports them. Two guard a fix that has no test on master; the third keeps the ClickBench query1 shape case from failing whenever the exact row count of hits is cached. The PR changes tests only.

Background, and what each test covers.

Results.

Change Test Result
none PrimaryKeyConstraintTest (new), IndexTest (one new case), ConstraintManagerTest, ConstraintPersistTest pass
gsonPostProcess without its null checks PrimaryKeyConstraintTest fails: NullPointerException while loading
getColumnUniqueIds without removeNamePrefix IndexTest#testGetColumnUniqueIdsForShadowColumn fails: expected [107] but was []
query1 as on master, row count of hits cached (local cluster) shape_check/clickbench/query1 fails: PhysicalOneRowRelation
query1 with this PR, same cache shape_check/clickbench/query1 passes

On the local cluster, explain shape plan SELECT COUNT(*) FROM hits gives hashAgg[GLOBAL] the first time and PhysicalOneRowRelation three seconds later, once the asynchronous row count load has finished; with the rule disabled it stays hashAgg[GLOBAL].

Original authors: @englefly (#68206), @airborne12 (#68636), @feiniaofeiafei (#68368)

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

    PrimaryKeyConstraintTest (new), IndexTest (3 cases, 1 new), ConstraintManagerTest and ConstraintPersistTest pass, and fe-core Checkstyle reports nothing. The mutations in the table above were run against them. shape_check/clickbench/query1 was run on a local cluster before and after this change, as in the table. This PR changes no production code.

  • 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

### What problem does this PR solve?

Issue Number: None

Related PR: apache#68206, apache#68636, apache#68368

Problem Summary: Three branch-4.2 backports of master fixes added a test
that master does not have:

- apache#68206 (of apache#61342): a PrimaryKeyConstraint written before its foreign
  table collections existed lacks `ft`, `ftn` and `ftni`; Gson builds the
  object without field initializers, so gsonPostProcess fills them in.
  The new PrimaryKeyConstraintTest removes all three from a serialized
  constraint, loads it and uses it; without the null checks the load
  fails with a NullPointerException.
- apache#68636 (of apache#57006): Index.getColumnUniqueIds compares an index column
  with the schema column name without the shadow prefix, so a schema
  change keeps the index column's unique id. IndexTest gets the 4.2 case,
  in JUnit 5; it fails without Column.removeNamePrefix.
- apache#68368 (of apache#66354): shape_check/clickbench/query1 checks the plan of
  `SELECT COUNT(*) FROM hits`. Once SimpleAggCacheMgr has cached the exact
  row count of hits, REWRITE_SIMPLE_AGG_TO_CONSTANT turns the count into
  a constant and the shape into PhysicalOneRowRelation, so the case fails
  whenever that cache is warm (P0 build 1087320 of apache#69830). The case now
  disables the rule, as on branch-4.2; the expected output is unchanged.

### Release note

None

### Check List (For Author)

- Test: Unit Test / Regression test
    - FE UT: PrimaryKeyConstraintTest (new), IndexTest (one new case),
      ConstraintManagerTest and ConstraintPersistTest pass; each new case
      fails with its fix reverted.
    - Regression: on a local cluster with the row count cached, query1
      fails as it is (PhysicalOneRowRelation) and passes with this change.
- Behavior changed: No
- Does this need documentation: No

Co-authored-by: minghong <[email protected]>
Co-authored-by: Jack <[email protected]>
Co-authored-by: feiniaofeiafei <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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?

@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@morningman

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.

No actionable findings in the three changed test files at e588737. Full-PR review and separate metadata/cache risk reviews all returned NO_NEW_VALUABLE_FINDINGS; main-agent verification and the final sweep found no unresolved source-level questions. There were no existing inline findings to retain and no additional user-provided focus.

Critical checkpoint conclusions:

  1. Goal and evidence: the PK fixture removes ft/ftn/ftni and reaches the same Doris Gson subtype/postprocess delegates as journal replay. Each missing-field repair is exercised because postprocessing dereferences all three collections. The index fixture checks shadow-prefix removal and case-insensitive matching; without stripping, [107] becomes empty. The ClickBench setting prevents the cache-dependent constant rewrite.
  2. Scope and clarity: changes are confined to two unit-test cases and one existing shape-test setting, with comments explaining the historical failure conditions.
  3. Concurrency and locking: unit fixtures are local, with no added threads or locks. The shape test disables the rule that consumes the asynchronous exact-count cache, removing that timing dependency without altering cache synchronization.
  4. Lifecycle and initialization: the Gson fixture exercises constructor-bypassed collection initialization. Foreign-table operations use local state and lowercase names; no running Env is required. SuiteContext creates and closes the JDBC session, so the SET stays scoped to the suite. No new static state or resource ownership is introduced.
  5. Configuration: no configuration definition is added. The existing session rule list parses both comma-separated names and is read by the following EXPLAIN.
  6. Compatibility: old missing-field JSON is exercised through the current reader; production symbols and storage formats are unchanged.
  7. Thrift/protobuf definitions: no gensrc changes or field-ID changes.
  8. Parallel paths: both agg/scan and agg/project/scan patterns use REWRITE_SIMPLE_AGG_TO_CONSTANT; visitor, stack and memo execution honor its disabled bit. The shared index-ID method feeds Thrift and cloud PB conversion, and the shadow fixture matches the schema-change caller. No parallel-path update is required for this test-only change.
  9. Conditional behavior: no new conditionals are added. Comments explain absent metadata fields and the exceptional shape-test rule setting. PRUNE_EMPTY_PARTITION remains disabled as before.
  10. Test coverage: JUnit Jupiter conventions and test discovery are consistent with the module. PK assertions cover primary columns, empty foreign-table state, add, rename and removal; the shadow-column assertion augments existing index matching/order/null/empty coverage. Existing planner tests retain coverage of the constant rewrite itself.
  11. Expected results: no .out files change. Unit expectations agree with the inspected implementations; the unchanged global/local aggregation shape is consistent with disabling the one-row rewrite. No test execution result is claimed by this review.
  12. Observability: no runtime feature or failure path is added, so no additional logs or metrics are needed.
  13. Transactions and persistence: journal deserialization uses the same Gson path under test. No EditLog write/replay, failover or transaction behavior changes.
  14. Writes, atomicity and crash behavior: changes perform only fixture mutations and EXPLAIN. Committed-data visibility, partition-version and delete-bitmap invariants are unaffected; no new production write or cleanup path is introduced.
  15. FE/BE propagation: no new variable, protocol field or sending path.
  16. Performance and memory: fixtures are small and bounded; no production hot path or memory-accounting change is introduced.
  17. Further recheck: immutable List.of inputs are copied or traversed read-only. The preexisting FilteredRules list construction does not bypass disablement because actual transforms independently check the forbidden bit. No additional PR defect was substantiated.

Review converged in one round with complete required static coverage and no unresolved candidates. Builds, tests, mutation experiments and Checkstyle were not run under the review-only contract; the author's execution claims were not independently reproduced.

Review converged after 1 round(s).

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage `` 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17596	5103	5038	5038
q2	2136	318	258	258
q3	10236	1374	820	820
q4	4692	470	335	335
q5	7449	796	534	534
q6	178	182	147	147
q7	746	794	593	593
q8	9251	1342	1119	1119
q9	5487	4221	4163	4163
q10	6827	1289	998	998
q11	421	248	235	235
q12	644	398	277	277
q13	18118	3624	3049	3049
q14	269	271	257	257
q15	q16	730	719	657	657
q17	1181	747	575	575
q18	7052	6206	6139	6139
q19	1251	959	623	623
q20	384	331	226	226
q21	5969	2412	2398	2398
q22	369	331	284	284
Total cold run time: 100986 ms
Total hot run time: 28725 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5946	5938	6098	5938
q2	722	580	555	555
q3	5689	5770	5263	5263
q4	2007	2158	1567	1567
q5	5777	6006	5726	5726
q6	234	199	148	148
q7	2204	2021	1782	1782
q8	2993	2637	2625	2625
q9	7942	7507	7509	7507
q10	3621	3579	3155	3155
q11	609	405	379	379
q12	675	664	501	501
q13	3236	3657	3015	3015
q14	302	284	257	257
q15	q16	652	671	605	605
q17	7755	7065	6748	6748
q18	12928	12146	12861	12146
q19	892	756	759	756
q20	2138	2148	1894	1894
q21	5545	4565	4656	4565
q22	496	460	385	385
Total cold run time: 72363 ms
Total hot run time: 65517 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 151204 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 e588737113a8bde7c1055037cf6aa3639743e239, data reload: false

query5	4311	591	448	448
query6	425	211	204	204
query7	4814	440	226	226
query8	323	166	161	161
query9	8793	3181	3213	3181
query10	482	297	255	255
query11	6044	3848	3575	3575
query12	146	92	85	85
query13	1256	453	326	326
query14	6129	3909	3644	3644
query14_1	3395	3443	3418	3418
query15	206	199	182	182
query16	928	423	419	419
query17	850	649	540	540
query18	2428	422	309	309
query19	193	166	136	136
query20	92	88	85	85
query21	215	132	109	109
query22	13007	12909	12797	12797
query23	13409	12821	12500	12500
query23_1	12428	12514	12497	12497
query24	7366	826	466	466
query24_1	479	485	479	479
query25	534	416	358	358
query26	1317	258	144	144
query27	2755	442	274	274
query28	4629	2048	2057	2048
query29	1598	604	444	444
query30	306	228	189	189
query31	1018	936	823	823
query32	150	97	91	91
query33	533	306	243	243
query34	897	867	508	508
query35	729	769	652	652
query36	833	824	750	750
query37	131	99	88	88
query38	1784	1784	1676	1676
query39	789	804	759	759
query39_1	730	730	749	730
query40	218	117	99	99
query41	77	67	69	67
query42	87	83	83	83
query43	338	362	311	311
query44	1307	709	717	709
query45	180	176	167	167
query46	834	986	636	636
query47	2954	2848	2680	2680
query48	292	311	222	222
query49	575	396	288	288
query50	661	274	211	211
query51	10658	10636	10557	10557
query52	76	77	66	66
query53	182	205	146	146
query54	234	205	172	172
query55	80	66	63	63
query56	231	218	206	206
query57	1627	1601	1562	1562
query58	286	270	238	238
query59	2147	2211	1970	1970
query60	289	242	228	228
query61	148	140	144	140
query62	383	335	297	297
query63	200	158	158	158
query64	2746	963	744	744
query65	3320	3262	3263	3262
query66	1774	422	305	305
query67	20116	20116	19876	19876
query68	2954	993	606	606
query69	376	290	256	256
query70	849	764	760	760
query71	291	230	208	208
query72	2724	2563	2219	2219
query73	508	518	288	288
query74	4593	4501	4375	4375
query75	2338	2266	1899	1899
query76	2326	1015	612	612
query77	344	367	274	274
query78	9813	9828	9182	9182
query79	1005	891	535	535
query80	1054	428	345	345
query81	584	314	267	267
query82	682	130	103	103
query83	275	192	183	183
query84	311	139	104	104
query85	1087	411	375	375
query86	351	236	225	225
query87	1999	1956	1828	1828
query88	3747	2763	2762	2762
query89	329	280	244	244
query90	1714	173	167	167
query91	160	151	129	129
query92	98	89	79	79
query93	1012	993	579	579
query94	553	310	284	284
query95	574	399	309	309
query96	662	478	233	233
query97	2424	2437	2320	2320
query98	156	153	151	151
query99	761	761	654	654
Total cold run time: 234934 ms
Total hot run time: 151204 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.09	0.05	0.05
query3	0.26	0.08	0.09
query4	1.61	0.10	0.09
query5	0.23	0.25	0.24
query6	1.17	0.68	0.66
query7	0.05	0.01	0.01
query8	0.06	0.04	0.04
query9	0.39	0.33	0.34
query10	0.57	0.61	0.60
query11	0.21	0.15	0.14
query12	0.18	0.14	0.14
query13	0.49	0.49	0.48
query14	1.02	0.99	1.00
query15	0.62	0.62	0.59
query16	0.36	0.31	0.34
query17	1.13	1.09	1.13
query18	0.20	0.19	0.20
query19	2.10	2.01	1.94
query20	0.02	0.01	0.02
query21	15.50	0.20	0.13
query22	4.84	0.06	0.05
query23	16.29	0.32	0.12
query24	3.16	0.60	0.32
query25	0.10	0.05	0.05
query26	1.23	0.21	0.16
query27	0.05	0.03	0.05
query28	3.44	0.75	0.35
query29	12.50	4.08	3.22
query30	0.27	0.13	0.10
query31	2.77	0.56	0.33
query32	3.22	0.59	0.50
query33	3.19	3.24	3.24
query34	15.41	3.98	3.42
query35	3.34	3.32	3.32
query36	0.57	0.45	0.44
query37	0.09	0.06	0.06
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.15	0.15
query41	0.09	0.04	0.02
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 97.18 s
Total hot run time: 24.12 s

@morningman

Copy link
Copy Markdown
Contributor Author

run nonConcurrent

@morningman
morningman merged commit 8279738 into apache:master Nov 5, 2026
37 of 38 checks passed
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.

3 participants