Skip to content

[fix](nereids) fix cast ipv4 to string #51546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yujun777
Copy link
Contributor

@yujun777 yujun777 commented Jun 6, 2025

What problem does this PR solve?

when cast a literal L to string, it will call new StringLiteral(L.getValue().toString()), for a ipv4, its getValue return a long value.

Then we will have:

before this PR:

MySQL [email protected]:db1> select cast(cast("192.168.1.10" as ipv4) as string)
+----------------------------------------------+
| cast(cast("192.168.1.10" as ipv4) as string) |
+----------------------------------------------+
| 3232235786                                   |
+----------------------------------------------+

this PR fix this, it will change ipv4 getValue return a ipv4 class.

after this PR:

MySQL [email protected]:db1> SELECT cast(cast('192.168.1.10' as ipv4) as string);
+----------------------------------------------+
| cast(cast('192.168.1.10' as ipv4) as string) |
+----------------------------------------------+
| 192.168.1.10                                 |
+----------------------------------------------+

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

@hello-stephen
Copy link
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?

@yujun777
Copy link
Contributor Author

yujun777 commented Jun 6, 2025

run buildall

@yujun777
Copy link
Contributor Author

yujun777 commented Jun 6, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	27353	5168	5217	5168
q2	1944	280	185	185
q3	10323	1270	752	752
q4	10266	1007	537	537
q5	8714	2432	2373	2373
q6	272	169	137	137
q7	904	757	617	617
q8	9312	1300	1146	1146
q9	6917	5135	5162	5135
q10	6841	2330	1914	1914
q11	489	286	268	268
q12	346	362	225	225
q13	17765	3696	3208	3208
q14	228	243	222	222
q15	574	485	478	478
q16	440	439	391	391
q17	627	879	369	369
q18	7722	7175	7136	7136
q19	1337	955	583	583
q20	339	348	221	221
q21	4053	3175	2388	2388
q22	1054	1020	982	982
Total cold run time: 117820 ms
Total hot run time: 34435 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5320	5137	5130	5130
q2	243	318	213	213
q3	2152	2691	2319	2319
q4	1515	1961	1455	1455
q5	4531	4367	4409	4367
q6	212	169	124	124
q7	1991	1920	1776	1776
q8	2589	2501	2451	2451
q9	7203	7265	7063	7063
q10	3049	3191	2761	2761
q11	592	501	499	499
q12	674	815	633	633
q13	3545	3965	3284	3284
q14	268	291	266	266
q15	516	473	472	472
q16	443	498	447	447
q17	1175	1537	1378	1378
q18	7750	7457	7517	7457
q19	885	862	850	850
q20	1988	1964	1835	1835
q21	4767	4381	4304	4304
q22	1055	1026	979	979
Total cold run time: 52463 ms
Total hot run time: 50063 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 187184 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 d1e0706ee6b8aed6b7a23c9925cfae11ec122314, data reload: false

query1	1003	495	511	495
query2	6577	1935	1882	1882
query3	6760	228	220	220
query4	26775	23774	23467	23467
query5	4339	655	460	460
query6	309	209	196	196
query7	4625	498	306	306
query8	266	234	215	215
query9	8595	2653	2672	2653
query10	451	339	267	267
query11	15812	15023	14849	14849
query12	167	119	115	115
query13	1663	560	427	427
query14	9317	6203	6198	6198
query15	211	209	176	176
query16	7227	641	481	481
query17	1179	723	560	560
query18	1970	394	307	307
query19	195	185	159	159
query20	137	123	132	123
query21	221	160	107	107
query22	4100	4215	3953	3953
query23	34212	33050	33284	33050
query24	8538	2393	2444	2393
query25	567	469	416	416
query26	1246	273	154	154
query27	2746	512	348	348
query28	4270	2193	2161	2161
query29	786	577	434	434
query30	283	226	192	192
query31	956	888	756	756
query32	69	70	72	70
query33	590	393	332	332
query34	814	857	551	551
query35	803	805	768	768
query36	985	982	890	890
query37	117	106	83	83
query38	4188	4241	4053	4053
query39	1481	1402	1400	1400
query40	218	131	117	117
query41	76	69	68	68
query42	139	114	113	113
query43	531	511	491	491
query44	1344	874	873	873
query45	187	182	178	178
query46	863	1030	653	653
query47	1757	1803	1717	1717
query48	426	439	332	332
query49	789	529	422	422
query50	681	674	412	412
query51	4203	4190	4136	4136
query52	118	114	105	105
query53	241	273	195	195
query54	611	599	521	521
query55	88	98	88	88
query56	335	329	362	329
query57	1125	1131	1107	1107
query58	267	259	269	259
query59	2688	2746	2635	2635
query60	340	321	333	321
query61	127	131	125	125
query62	797	735	650	650
query63	233	200	190	190
query64	4448	1035	704	704
query65	4243	4153	4189	4153
query66	1147	415	324	324
query67	15902	15705	15603	15603
query68	8943	914	540	540
query69	472	322	272	272
query70	1186	1209	1076	1076
query71	473	339	338	338
query72	5576	4768	4919	4768
query73	733	637	365	365
query74	9230	9026	8741	8741
query75	4281	3208	2740	2740
query76	3679	1226	809	809
query77	920	398	299	299
query78	10108	10345	9400	9400
query79	2924	799	576	576
query80	656	520	465	465
query81	477	267	222	222
query82	437	129	110	110
query83	305	258	244	244
query84	298	117	96	96
query85	795	363	318	318
query86	356	321	294	294
query87	4451	4524	4391	4391
query88	2977	2321	2354	2321
query89	435	315	290	290
query90	2054	219	219	219
query91	140	139	120	120
query92	75	63	61	61
query93	2297	960	593	593
query94	669	411	318	318
query95	395	305	294	294
query96	511	588	282	282
query97	2761	2754	2640	2640
query98	236	217	202	202
query99	1464	1394	1292	1292
Total cold run time: 278788 ms
Total hot run time: 187184 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.12	0.10	0.11
query3	0.25	0.19	0.19
query4	1.59	0.20	0.10
query5	0.43	0.42	0.44
query6	1.16	0.67	0.67
query7	0.02	0.02	0.01
query8	0.04	0.04	0.04
query9	0.59	0.54	0.51
query10	0.58	0.59	0.57
query11	0.16	0.11	0.11
query12	0.15	0.12	0.12
query13	0.62	0.60	0.59
query14	0.79	0.80	0.82
query15	0.88	0.86	0.88
query16	0.40	0.38	0.38
query17	1.05	1.05	1.09
query18	0.23	0.22	0.21
query19	1.96	1.81	1.89
query20	0.01	0.01	0.01
query21	15.42	0.92	0.56
query22	0.76	1.26	0.69
query23	14.80	1.45	0.62
query24	6.95	1.86	0.89
query25	0.50	0.13	0.21
query26	0.56	0.17	0.15
query27	0.06	0.05	0.05
query28	9.48	0.95	0.44
query29	12.80	4.00	3.36
query30	0.26	0.10	0.07
query31	2.84	0.60	0.39
query32	3.24	0.55	0.47
query33	3.09	3.20	3.06
query34	15.77	5.19	4.50
query35	4.55	4.52	4.49
query36	0.66	0.50	0.48
query37	0.09	0.06	0.06
query38	0.05	0.04	0.03
query39	0.03	0.02	0.02
query40	0.16	0.14	0.13
query41	0.09	0.02	0.02
query42	0.04	0.02	0.02
query43	0.05	0.04	0.03
Total cold run time: 103.32 s
Total hot run time: 29.24 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 70.00% (21/30) 🎉
Increment coverage report
Complete coverage report

@yujun777
Copy link
Contributor Author

yujun777 commented Jun 6, 2025

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 65.71% (23/35) 🎉
Increment coverage report
Complete coverage report

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	25962	5050	5041	5041
q2	1962	286	183	183
q3	10419	1266	724	724
q4	10231	1006	520	520
q5	7712	2354	2348	2348
q6	189	162	132	132
q7	916	730	613	613
q8	9311	1465	1115	1115
q9	6790	5153	5078	5078
q10	6862	2291	1894	1894
q11	482	287	280	280
q12	356	350	216	216
q13	17803	3688	3120	3120
q14	227	236	227	227
q15	562	502	487	487
q16	425	431	379	379
q17	620	853	374	374
q18	7667	7087	7157	7087
q19	1981	1020	566	566
q20	337	337	219	219
q21	3904	3181	2414	2414
q22	1061	1041	967	967
Total cold run time: 115779 ms
Total hot run time: 33984 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5212	5141	5060	5060
q2	237	318	221	221
q3	2115	2711	2253	2253
q4	1373	1790	1412	1412
q5	4483	4396	4440	4396
q6	220	171	129	129
q7	2047	1987	1760	1760
q8	2602	2579	2536	2536
q9	7204	7242	6985	6985
q10	3063	3191	2766	2766
q11	587	514	506	506
q12	716	721	604	604
q13	3435	3859	3249	3249
q14	274	311	282	282
q15	538	498	468	468
q16	455	491	426	426
q17	1146	1501	1421	1421
q18	7804	7462	7492	7462
q19	881	870	946	870
q20	1985	2066	1864	1864
q21	4822	4556	4526	4526
q22	1102	1063	1022	1022
Total cold run time: 52301 ms
Total hot run time: 50218 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192462 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 45ccf2b65e653eccc4bd62dc838a06d44b58d664, data reload: false

query1	1412	1073	1098	1073
query2	6440	1867	1912	1867
query3	11026	4536	4522	4522
query4	54285	25392	23134	23134
query5	5208	519	473	473
query6	357	218	204	204
query7	4939	507	286	286
query8	300	249	230	230
query9	5781	2630	2636	2630
query10	451	346	279	279
query11	15161	15035	14888	14888
query12	164	109	106	106
query13	1058	524	425	425
query14	10259	6309	6343	6309
query15	193	213	178	178
query16	7069	676	491	491
query17	1062	770	580	580
query18	1551	404	303	303
query19	222	185	160	160
query20	134	134	125	125
query21	213	128	106	106
query22	4364	4464	4258	4258
query23	34320	33627	33554	33554
query24	6678	2467	2426	2426
query25	485	471	417	417
query26	691	273	153	153
query27	2188	508	347	347
query28	3062	2163	2163	2163
query29	587	583	431	431
query30	274	225	194	194
query31	859	845	759	759
query32	71	61	64	61
query33	453	375	316	316
query34	776	870	553	553
query35	808	852	756	756
query36	950	974	916	916
query37	116	107	76	76
query38	4220	4367	4157	4157
query39	1499	1441	1459	1441
query40	205	119	111	111
query41	61	60	57	57
query42	133	123	117	117
query43	510	505	485	485
query44	1357	848	871	848
query45	178	182	174	174
query46	876	1045	667	667
query47	1865	1923	1775	1775
query48	397	432	355	355
query49	643	494	402	402
query50	688	716	420	420
query51	4324	4216	4188	4188
query52	124	113	107	107
query53	222	260	187	187
query54	599	585	520	520
query55	83	84	85	84
query56	299	311	280	280
query57	1139	1173	1134	1134
query58	272	281	257	257
query59	2710	2796	2712	2712
query60	348	328	322	322
query61	126	143	197	143
query62	738	755	669	669
query63	229	190	198	190
query64	1508	1029	686	686
query65	4222	4187	4177	4177
query66	699	401	311	311
query67	15826	15572	15434	15434
query68	4454	915	533	533
query69	511	304	266	266
query70	1172	1091	1044	1044
query71	402	322	301	301
query72	5815	4970	4995	4970
query73	716	676	351	351
query74	9128	9144	8627	8627
query75	3243	3259	2713	2713
query76	3293	1193	746	746
query77	553	370	361	361
query78	10121	10183	9200	9200
query79	2193	835	580	580
query80	867	521	434	434
query81	549	266	215	215
query82	397	125	97	97
query83	261	246	236	236
query84	293	116	101	101
query85	780	354	321	321
query86	418	328	275	275
query87	4409	4435	4409	4409
query88	3225	2259	2263	2259
query89	387	328	282	282
query90	1863	206	209	206
query91	143	145	168	145
query92	70	70	57	57
query93	2798	954	575	575
query94	685	416	308	308
query95	360	292	284	284
query96	499	566	279	279
query97	2686	2764	2646	2646
query98	228	217	218	217
query99	1312	1409	1265	1265
Total cold run time: 293898 ms
Total hot run time: 192462 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 29.28 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 45ccf2b65e653eccc4bd62dc838a06d44b58d664, data reload: false

query1	0.04	0.04	0.03
query2	0.12	0.11	0.11
query3	0.25	0.19	0.19
query4	1.59	0.19	0.10
query5	0.41	0.40	0.44
query6	1.16	0.66	0.68
query7	0.02	0.02	0.02
query8	0.05	0.03	0.04
query9	0.57	0.50	0.52
query10	0.57	0.58	0.57
query11	0.16	0.10	0.11
query12	0.14	0.12	0.12
query13	0.62	0.61	0.61
query14	0.78	0.80	0.80
query15	0.89	0.86	0.88
query16	0.38	0.39	0.40
query17	1.01	1.04	1.03
query18	0.23	0.21	0.20
query19	1.89	1.87	1.78
query20	0.01	0.02	0.01
query21	15.39	0.91	0.56
query22	0.78	1.31	0.95
query23	14.68	1.39	0.64
query24	7.06	1.34	0.65
query25	0.47	0.15	0.15
query26	0.58	0.17	0.14
query27	0.05	0.05	0.06
query28	9.80	0.90	0.45
query29	12.63	4.21	3.46
query30	0.25	0.09	0.07
query31	2.82	0.58	0.40
query32	3.22	0.55	0.47
query33	2.99	3.06	3.12
query34	15.76	5.14	4.45
query35	4.53	4.48	4.50
query36	0.66	0.50	0.48
query37	0.09	0.06	0.06
query38	0.06	0.03	0.04
query39	0.03	0.02	0.03
query40	0.17	0.13	0.13
query41	0.09	0.03	0.02
query42	0.04	0.02	0.03
query43	0.04	0.04	0.03
Total cold run time: 103.08 s
Total hot run time: 29.28 s

@morrySnow morrySnow added the p0_w label Jun 9, 2025
Copy link
Contributor

github-actions bot commented Jun 9, 2025

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jun 9, 2025
Copy link
Contributor

github-actions bot commented Jun 9, 2025

PR approved by anyone and no changes requested.

@yujun777
Copy link
Contributor Author

run external

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.1.x dev/3.0.x p0_w reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants