Skip to content

[fix](load) Skip MAXVALUE in list partition sink in-keys - #66518

Open
englefly wants to merge 1 commit into
apache:masterfrom
englefly:insert-part
Open

[fix](load) Skip MAXVALUE in list partition sink in-keys#66518
englefly wants to merge 1 commit into
apache:masterfrom
englefly:insert-part

Conversation

@englefly

@englefly englefly commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Issue Number: None

Related PR: None

Problem Summary: Executing an INSERT into a table whose LIST partitions contain MAXVALUE (e.g. PARTITION p4 VALUES IN ((NULL, MAXVALUE))) fails on the FE with TProtocolException: Required field 'node_type' was not present! while serializing the plan fragments to the BE. Root cause: OlapTableSink.setPartitionKeys converts every partition key literal of a LIST partition into TOlapTablePartition.in_keys, but the MAXVALUE literal (MaxLiteral.MAX_VALUE) has no thrift conversion (ExprToThriftVisitor.visitMaxLiteral is an empty stub), so the produced TExprNode has no node_type, which is a required thrift field. The RANGE branch already skips max-value endpoints (!range.upperEndpoint().isMaxValue()), while the LIST branch has no such guard. Fix: skip in-key tuples that contain MAXVALUE at any position when building the sink partition param, mirroring the RANGE branch's skip logic.

None

  • Test: Regression test (test_auto_list_partition_null extended with INSERT into a table containing MAXVALUE LIST partitions) passed
  • Behavior changed: No
  • Does this need documentation: No

fix Do not prune list partitions containing MAXVALUE

Issue Number: None

Related PR: None

Problem Summary: Querying a table whose LIST partitions contain MAXVALUE (e.g. PARTITION p4 VALUES IN ((NULL, MAXVALUE))) with a predicate on the partition columns fails with "Can not get value from max literal". The Nereids partition pruner converts every partition key literal into a concrete literal (OneListPartitionEvaluator.getInputsByOneSlot/getInputsByMultiSlots) and evaluates the predicate against it, but MaxLiteral has no value, so evaluation throws. Fix: a partition whose keys contain MAXVALUE cannot be evaluated against the predicate, so it is kept conservatively and the predicate is not pruned, mirroring the existing default-partition handling in canBePrunedOut.

None

  • Test: Regression test (test_auto_list_partition_null extended with a predicate query on the partition columns) passed
  • Behavior changed: No
  • Does this need documentation: No

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

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

Issue Number: None

Related PR: None

Problem Summary: Executing an INSERT into a table whose LIST partitions contain
MAXVALUE (e.g. `PARTITION p4 VALUES IN ((NULL, MAXVALUE))`) fails on the FE with
`TProtocolException: Required field 'node_type' was not present!` while serializing
the plan fragments to the BE. Root cause: OlapTableSink.setPartitionKeys converts
every partition key literal of a LIST partition into TOlapTablePartition.in_keys,
but the MAXVALUE literal (MaxLiteral.MAX_VALUE) has no thrift conversion
(ExprToThriftVisitor.visitMaxLiteral is an empty stub), so the produced TExprNode
has no node_type, which is a required thrift field. The RANGE branch already skips
max-value endpoints (`!range.upperEndpoint().isMaxValue()`), while the LIST branch
has no such guard. Fix: skip in-key tuples that contain MAXVALUE at any position
when building the sink partition param, mirroring the RANGE branch's skip logic.

None

- Test: Regression test (test_auto_list_partition_null extended with INSERT into a table containing MAXVALUE LIST partitions) passed
- Behavior changed: No
- Does this need documentation: No

[fix](fe) Do not prune list partitions containing MAXVALUE

Issue Number: None

Related PR: None

Problem Summary: Querying a table whose LIST partitions contain MAXVALUE
(e.g. `PARTITION p4 VALUES IN ((NULL, MAXVALUE))`) with a predicate on the
partition columns fails with "Can not get value from max literal". The Nereids
partition pruner converts every partition key literal into a concrete literal
(OneListPartitionEvaluator.getInputsByOneSlot/getInputsByMultiSlots) and evaluates
the predicate against it, but MaxLiteral has no value, so evaluation throws.
Fix: a partition whose keys contain MAXVALUE cannot be evaluated against the
predicate, so it is kept conservatively and the predicate is not pruned, mirroring
the existing default-partition handling in canBePrunedOut.

None

- Test: Regression test (test_auto_list_partition_null extended with a predicate query on the partition columns) passed
- Behavior changed: No
- Does this need documentation: No
@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?

@englefly

englefly commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@englefly

englefly commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/review

@morrySnow morrySnow changed the title [fix](fe) Skip MAXVALUE in list partition sink in-keys [fix](load) Skip MAXVALUE in list partition sink in-keys Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: All Codex review accounts are usage-limited; earliest retry is 2026-08-08T03:32:00Z.
Workflow run: https://github.com/apache/doris/actions/runs/31066768816

Please trigger /review again after that time.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 16.49% (16/97) 🎉
Increment coverage report
Complete coverage report

@englefly

englefly commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

run performance

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17783	4020	4082	4020
q2	1993	317	215	215
q3	10323	1348	817	817
q4	4682	482	340	340
q5	7489	838	549	549
q6	185	184	138	138
q7	734	804	593	593
q8	9338	1541	1585	1541
q9	5388	4049	4097	4049
q10	6789	1641	1341	1341
q11	497	369	313	313
q12	715	588	453	453
q13	18110	3306	2731	2731
q14	259	263	243	243
q15	q16	753	739	664	664
q17	1004	940	1128	940
q18	6613	5574	5512	5512
q19	1187	1273	1048	1048
q20	810	688	557	557
q21	5855	2594	2502	2502
q22	423	354	303	303
Total cold run time: 100930 ms
Total hot run time: 28869 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4425	4264	4203	4203
q2	277	316	205	205
q3	4575	4911	4456	4456
q4	2160	2261	1390	1390
q5	4229	4085	4137	4085
q6	223	179	128	128
q7	1753	1597	1395	1395
q8	2866	2204	2149	2149
q9	7373	7391	7570	7391
q10	4321	4296	3864	3864
q11	550	411	381	381
q12	740	742	515	515
q13	3229	3503	2861	2861
q14	285	297	291	291
q15	q16	721	723	656	656
q17	1329	1329	1341	1329
q18	12140	11040	11842	11040
q19	1146	1214	1178	1178
q20	2250	2210	1962	1962
q21	5687	4868	4909	4868
q22	553	482	421	421
Total cold run time: 60832 ms
Total hot run time: 54768 ms

@hello-stephen

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

query5	4305	592	445	445
query6	464	218	198	198
query7	4882	598	327	327
query8	329	164	148	148
query9	8791	4014	3990	3990
query10	489	361	293	293
query11	5900	2189	1976	1976
query12	152	96	95	95
query13	1247	576	433	433
query14	6174	4281	4017	4017
query14_1	3802	3809	3830	3809
query15	206	197	178	178
query16	992	530	436	436
query17	908	640	543	543
query18	2402	453	324	324
query19	203	184	138	138
query20	101	99	100	99
query21	233	152	132	132
query22	12970	13003	12741	12741
query23	15680	14993	14771	14771
query23_1	14878	14672	14623	14623
query24	7501	1662	1206	1206
query24_1	1268	1222	1237	1222
query25	525	423	384	384
query26	1326	355	211	211
query27	2635	590	387	387
query28	4586	2061	2037	2037
query29	1041	596	485	485
query30	345	270	222	222
query31	1175	1104	1047	1047
query32	112	60	57	57
query33	509	289	253	253
query34	1217	1140	604	604
query35	741	748	632	632
query36	775	789	708	708
query37	157	105	90	90
query38	1838	1778	1668	1668
query39	814	814	795	795
query39_1	784	798	793	793
query40	245	161	144	144
query41	66	63	61	61
query42	92	93	92	92
query43	322	317	276	276
query44	1438	769	752	752
query45	194	170	168	168
query46	1042	1176	732	732
query47	1518	1491	1409	1409
query48	422	413	281	281
query49	575	405	310	310
query50	1061	427	339	339
query51	10738	10618	10439	10439
query52	88	88	76	76
query53	270	273	200	200
query54	295	249	241	241
query55	79	74	69	69
query56	318	306	308	306
query57	1019	987	912	912
query58	308	281	268	268
query59	1534	1583	1413	1413
query60	347	290	272	272
query61	176	172	172	172
query62	400	322	274	274
query63	238	199	195	195
query64	2984	1174	886	886
query65	3872	3770	3777	3770
query66	1824	466	361	361
query67	19894	20020	19895	19895
query68	3253	1461	957	957
query69	411	297	266	266
query70	876	758	783	758
query71	381	341	321	321
query72	3065	2608	2289	2289
query73	836	758	442	442
query74	4637	4500	4288	4288
query75	2378	2329	1980	1980
query76	2350	1131	748	748
query77	342	379	276	276
query78	11043	10999	10612	10612
query79	1400	1126	726	726
query80	679	548	471	471
query81	478	332	275	275
query82	611	171	139	139
query83	370	333	299	299
query84	324	162	131	131
query85	931	598	538	538
query86	315	226	217	217
query87	1968	1969	1848	1848
query88	3707	2800	2738	2738
query89	383	309	269	269
query90	1851	200	199	199
query91	201	190	166	166
query92	61	58	54	54
query93	1576	1649	1027	1027
query94	559	343	301	301
query95	791	485	560	485
query96	1126	789	341	341
query97	2469	2454	2325	2325
query98	199	182	182	182
query99	741	732	601	601
Total cold run time: 244281 ms
Total hot run time: 157877 ms

@hello-stephen

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

query1	0.00	0.00	0.01
query2	0.10	0.05	0.05
query3	0.26	0.13	0.13
query4	1.62	0.14	0.13
query5	0.23	0.22	0.22
query6	1.16	0.80	0.81
query7	0.03	0.01	0.00
query8	0.05	0.03	0.03
query9	0.37	0.30	0.32
query10	0.55	0.57	0.54
query11	0.20	0.14	0.13
query12	0.17	0.14	0.13
query13	0.46	0.45	0.46
query14	0.98	0.99	0.98
query15	0.61	0.58	0.58
query16	0.32	0.33	0.32
query17	1.10	1.08	1.08
query18	0.20	0.20	0.20
query19	2.06	1.91	1.90
query20	0.02	0.02	0.02
query21	15.43	0.23	0.14
query22	4.75	0.05	0.06
query23	16.13	0.30	0.12
query24	2.92	0.41	0.31
query25	0.10	0.06	0.04
query26	0.75	0.20	0.14
query27	0.03	0.04	0.03
query28	3.52	0.84	0.33
query29	12.46	4.02	3.19
query30	0.27	0.15	0.15
query31	2.78	0.56	0.31
query32	3.22	0.59	0.49
query33	3.31	3.14	3.17
query34	15.53	3.93	3.28
query35	3.23	3.22	3.23
query36	0.54	0.44	0.43
query37	0.08	0.07	0.06
query38	0.05	0.04	0.03
query39	0.04	0.03	0.04
query40	0.17	0.16	0.15
query41	0.09	0.03	0.04
query42	0.04	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 95.97 s
Total hot run time: 23.73 s

Sign up for free to 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.

2 participants