Skip to content

[fix](ddl) reject invalid IPv4 default value at CREATE TABLE time#62906

Open
924060929 wants to merge 1 commit into
apache:masterfrom
924060929:fix/DORIS-25393
Open

[fix](ddl) reject invalid IPv4 default value at CREATE TABLE time#62906
924060929 wants to merge 1 commit into
apache:masterfrom
924060929:fix/DORIS-25393

Conversation

@924060929
Copy link
Copy Markdown
Contributor

@924060929 924060929 commented Apr 28, 2026

What problem does this PR solve?

Problem Summary:

IPv4Literal.parseIPv4toLong silently returned 0L for invalid input (e.g. 'not_an_ip'), so ColumnDef.validateDefaultValue accepted any string as an IPv4 default value at CREATE TABLE time. The invalid default only fails later at INSERT/stream load time.

Changed the three return 0L error paths to throw AnalysisException, matching the behavior of IPv6Literal which already rejects invalid defaults at DDL time.

Check List (For Author)

  • Test

    • Unit Test
    • Regression 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. Invalid IPv4 default values (e.g. ip IPV4 DEFAULT 'not_an_ip') are now rejected at CREATE TABLE time instead of being silently accepted.
  • 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

IPv4Literal.parseIPv4toLong silently returned 0L for invalid input,
causing ColumnDef.validateDefaultValue to accept garbage like
'not_an_ip'. Change it to throw AnalysisException instead.
@924060929
Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@924060929
Copy link
Copy Markdown
Contributor Author

run buildall

@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

FE Regression Coverage Report

Increment line coverage 0.00% (0/582) 🎉
Increment coverage report
Complete coverage report

1 similar comment
@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/582) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17796	4015	3984	3984
q2	q3	10774	1421	808	808
q4	4685	482	342	342
q5	7577	866	597	597
q6	181	168	135	135
q7	752	846	638	638
q8	9391	1565	1631	1565
q9	5816	4547	4538	4538
q10	6754	1796	1543	1543
q11	438	272	247	247
q12	621	432	288	288
q13	18112	3302	2789	2789
q14	266	258	233	233
q15	q16	819	781	713	713
q17	886	945	872	872
q18	6835	5679	5561	5561
q19	1344	1203	1098	1098
q20	540	395	266	266
q21	6375	2802	2788	2788
q22	449	375	308	308
Total cold run time: 100411 ms
Total hot run time: 29313 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	5076	4826	4847	4826
q2	q3	4901	5374	4657	4657
q4	2117	2201	1414	1414
q5	4829	4651	4943	4651
q6	240	173	124	124
q7	1902	1739	1616	1616
q8	2463	2155	2079	2079
q9	8071	7911	7603	7603
q10	4730	4695	4258	4258
q11	541	384	356	356
q12	730	743	532	532
q13	3012	3309	2765	2765
q14	271	278	255	255
q15	q16	691	694	608	608
q17	1266	1247	1264	1247
q18	7199	6712	6736	6712
q19	1111	1102	1084	1084
q20	2218	2205	1945	1945
q21	5309	4604	4496	4496
q22	513	470	435	435
Total cold run time: 57190 ms
Total hot run time: 51663 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 171658 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 2a445a9d5eda1793b732c5ce216f2b91be70593b, data reload: false

query5	4305	658	517	517
query6	341	221	211	211
query7	4247	569	326	326
query8	327	243	224	224
query9	8790	4065	4046	4046
query10	451	341	303	303
query11	5787	2319	2211	2211
query12	189	138	128	128
query13	1281	623	458	458
query14	6111	5454	5163	5163
query14_1	4454	4489	4465	4465
query15	217	208	189	189
query16	1010	502	440	440
query17	1160	757	619	619
query18	2577	483	348	348
query19	224	205	168	168
query20	155	137	130	130
query21	220	140	115	115
query22	13716	13566	13331	13331
query23	17289	16634	16298	16298
query23_1	16447	16437	16270	16270
query24	7416	1748	1318	1318
query24_1	1309	1292	1307	1292
query25	554	484	438	438
query26	1325	312	172	172
query27	2689	578	346	346
query28	4424	2007	2024	2007
query29	990	612	502	502
query30	309	238	201	201
query31	1119	1067	953	953
query32	102	78	76	76
query33	547	353	298	298
query34	1172	1136	664	664
query35	783	796	705	705
query36	1429	1420	1236	1236
query37	157	102	90	90
query38	3213	3176	3102	3102
query39	927	927	895	895
query39_1	885	888	864	864
query40	237	154	130	130
query41	65	62	61	61
query42	116	112	113	112
query43	328	332	293	293
query44	
query45	217	206	209	206
query46	1105	1206	760	760
query47	2437	2456	2248	2248
query48	392	409	305	305
query49	632	520	398	398
query50	971	348	263	263
query51	4369	4342	4245	4245
query52	109	108	97	97
query53	257	286	207	207
query54	315	271	256	256
query55	95	91	86	86
query56	296	323	305	305
query57	1433	1428	1351	1351
query58	319	282	263	263
query59	1606	1671	1475	1475
query60	324	330	317	317
query61	160	150	158	150
query62	705	646	586	586
query63	247	200	211	200
query64	2409	822	641	641
query65	
query66	1705	496	366	366
query67	29749	29643	29581	29581
query68	
query69	474	346	303	303
query70	1024	966	1001	966
query71	339	277	271	271
query72	3032	2732	2457	2457
query73	838	816	419	419
query74	5128	4933	4781	4781
query75	2701	2606	2265	2265
query76	2306	1149	754	754
query77	404	420	354	354
query78	12426	12427	11880	11880
query79	1296	1060	774	774
query80	600	550	454	454
query81	453	281	252	252
query82	240	158	124	124
query83	270	275	251	251
query84	268	135	116	116
query85	899	607	536	536
query86	361	341	333	333
query87	3411	3354	3196	3196
query88	3662	2766	2745	2745
query89	421	397	347	347
query90	2188	187	182	182
query91	177	163	138	138
query92	81	80	74	74
query93	1390	1485	925	925
query94	547	351	315	315
query95	664	389	347	347
query96	1054	823	356	356
query97	2752	2739	2641	2641
query98	233	229	249	229
query99	1171	1166	1033	1033
Total cold run time: 253038 ms
Total hot run time: 171658 ms

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