Skip to content

branch-3.0: [fix](function) JSON_EXTRACT_STRING should return NULL instead of the string 'null' when encountering a NULL value #51516 #51565

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

Merged
merged 3 commits into from
Jun 11, 2025

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jun 7, 2025

Cherry-picked from #51516

… string 'null' when encountering a NULL value (#51516)

### What problem does this PR solve?

Previously, when JSON_EXTRACT_STRING encountered a NULL input value or
path, it returned the string "null" instead of a proper SQL NULL value.
This behavior could lead to incorrect query results and confusion in
downstream processing that expects NULL to be represented as an actual
null value rather than a literal string.

This commit adjusts the logic to ensure that JSON_EXTRACT_STRING returns
NULL in such cases, aligning with SQL semantics and improving
compatibility with systems that rely on strict null-handling behavior.
@github-actions github-actions bot requested a review from dataroaring as a code owner June 7, 2025 13:16
@Thearas
Copy link
Contributor

Thearas commented Jun 7, 2025

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?

@dataroaring dataroaring closed this Jun 7, 2025
@dataroaring dataroaring reopened this Jun 7, 2025
@Thearas
Copy link
Contributor

Thearas commented Jun 7, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17611	7057	7014	7014
q2	2068	168	157	157
q3	10757	1079	1107	1079
q4	10534	742	725	725
q5	7727	2878	2838	2838
q6	211	136	132	132
q7	974	627	607	607
q8	9351	1914	2020	1914
q9	6532	6383	6360	6360
q10	7028	2239	2307	2239
q11	467	273	265	265
q12	397	219	223	219
q13	17796	2988	3002	2988
q14	245	200	209	200
q15	521	470	458	458
q16	503	380	368	368
q17	970	528	551	528
q18	7136	6680	6591	6591
q19	1386	1023	1028	1023
q20	470	205	200	200
q21	4142	3263	3222	3222
q22	1111	996	1005	996
Total cold run time: 107937 ms
Total hot run time: 40123 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7015	6913	6772	6772
q2	325	242	235	235
q3	2925	2853	3029	2853
q4	2154	1938	1909	1909
q5	5856	5832	5767	5767
q6	210	135	141	135
q7	2240	1814	1852	1814
q8	3431	3619	3514	3514
q9	8968	8809	8864	8809
q10	3622	3576	3564	3564
q11	581	499	497	497
q12	804	625	612	612
q13	8618	3142	3214	3142
q14	281	282	270	270
q15	518	469	469	469
q16	476	439	435	435
q17	1841	1644	1635	1635
q18	8331	7841	7806	7806
q19	1737	1566	1615	1566
q20	2058	1843	1804	1804
q21	5500	5428	5523	5428
q22	1146	1088	1036	1036
Total cold run time: 68637 ms
Total hot run time: 60072 ms

@doris-robot
Copy link

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

query1	1255	890	895	890
query2	6303	1932	1914	1914
query3	10967	4420	4426	4420
query4	60942	28853	23442	23442
query5	5197	454	474	454
query6	405	197	184	184
query7	5472	317	311	311
query8	315	228	222	222
query9	8521	2610	2593	2593
query10	445	287	250	250
query11	17811	15572	15717	15572
query12	157	97	103	97
query13	1449	434	430	430
query14	9781	6700	6761	6700
query15	195	175	173	173
query16	7139	502	462	462
query17	1138	598	571	571
query18	1904	313	309	309
query19	207	156	154	154
query20	109	109	111	109
query21	203	99	100	99
query22	4574	4581	4568	4568
query23	34722	34346	33816	33816
query24	7062	2984	3002	2984
query25	551	448	417	417
query26	647	164	165	164
query27	2308	373	357	357
query28	4787	2165	2152	2152
query29	684	445	445	445
query30	242	157	159	157
query31	957	778	841	778
query32	64	52	56	52
query33	442	287	301	287
query34	910	526	530	526
query35	858	754	724	724
query36	1083	977	944	944
query37	121	74	71	71
query38	3993	3972	4030	3972
query39	1502	1499	1440	1440
query40	200	98	100	98
query41	49	49	48	48
query42	114	99	105	99
query43	523	495	488	488
query44	1192	809	821	809
query45	184	170	166	166
query46	1147	746	751	746
query47	2016	1854	1892	1854
query48	500	377	381	377
query49	739	408	392	392
query50	845	442	432	432
query51	7485	7412	7142	7142
query52	99	90	94	90
query53	266	186	189	186
query54	574	471	490	471
query55	81	80	81	80
query56	270	262	260	260
query57	1238	1150	1127	1127
query58	224	209	217	209
query59	3183	3017	3100	3017
query60	279	264	268	264
query61	112	108	123	108
query62	764	662	701	662
query63	226	189	195	189
query64	1478	739	732	732
query65	3277	3205	3207	3205
query66	722	320	309	309
query67	15700	15520	15637	15520
query68	4283	582	585	582
query69	430	272	264	264
query70	1166	1072	1075	1072
query71	372	269	278	269
query72	6627	4182	4046	4046
query73	745	341	347	341
query74	10485	9325	9276	9276
query75	3336	2616	2661	2616
query76	2065	1089	1175	1089
query77	499	263	284	263
query78	10492	9642	9535	9535
query79	2124	595	614	595
query80	1354	443	442	442
query81	521	222	223	222
query82	1214	87	85	85
query83	265	140	148	140
query84	279	81	84	81
query85	989	307	303	303
query86	395	295	293	293
query87	4351	4247	4231	4231
query88	3760	2377	2346	2346
query89	412	288	289	288
query90	1950	187	193	187
query91	179	149	149	149
query92	66	50	48	48
query93	2794	573	566	566
query94	787	289	292	289
query95	357	261	256	256
query96	643	280	282	280
query97	3323	3168	3124	3124
query98	214	203	194	194
query99	1560	1314	1300	1300
Total cold run time: 316946 ms
Total hot run time: 197062 ms

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 41.09% (10865/26445)
Line Coverage 31.93% (92916/290996)
Region Coverage 31.01% (47932/154566)
Branch Coverage 27.50% (24555/89306)

@doris-robot
Copy link

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

query1	0.03	0.03	0.03
query2	0.06	0.03	0.03
query3	0.23	0.07	0.06
query4	1.64	0.10	0.10
query5	0.52	0.53	0.50
query6	1.16	0.72	0.72
query7	0.02	0.01	0.03
query8	0.04	0.03	0.03
query9	0.57	0.49	0.50
query10	0.54	0.56	0.55
query11	0.13	0.09	0.10
query12	0.13	0.11	0.12
query13	0.61	0.59	0.60
query14	0.76	0.82	0.81
query15	0.82	0.83	0.82
query16	0.40	0.38	0.39
query17	1.03	0.99	1.04
query18	0.24	0.23	0.22
query19	1.82	1.77	1.77
query20	0.01	0.01	0.01
query21	15.40	0.58	0.57
query22	2.39	2.57	3.13
query23	17.08	1.00	0.88
query24	2.94	1.25	1.90
query25	0.29	0.20	0.06
query26	0.44	0.14	0.13
query27	0.05	0.04	0.04
query28	9.66	0.51	0.46
query29	12.59	3.25	3.24
query30	0.25	0.06	0.06
query31	2.88	0.37	0.37
query32	3.26	0.48	0.45
query33	2.96	3.01	2.97
query34	16.85	4.51	4.46
query35	4.53	4.54	4.54
query36	0.68	0.46	0.47
query37	0.09	0.06	0.06
query38	0.04	0.03	0.04
query39	0.03	0.02	0.03
query40	0.15	0.13	0.12
query41	0.08	0.03	0.02
query42	0.03	0.03	0.02
query43	0.03	0.03	0.03
Total cold run time: 103.46 s
Total hot run time: 31.12 s

dataroaring
dataroaring previously approved these changes Jun 11, 2025
Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor Author

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

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Jun 11, 2025
Copy link
Contributor Author

PR approved by anyone and no changes requested.

@mrhhsg
Copy link
Member

mrhhsg commented Jun 11, 2025

run buildall

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Jun 11, 2025
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17570	6757	6522	6522
q2	2059	173	171	171
q3	10691	1076	1167	1076
q4	10526	746	758	746
q5	7762	2840	2795	2795
q6	215	132	132	132
q7	974	613	614	613
q8	9351	1937	2000	1937
q9	6631	6353	6381	6353
q10	7035	2283	2311	2283
q11	468	264	251	251
q12	398	215	217	215
q13	17782	2982	2980	2980
q14	231	202	204	202
q15	500	463	453	453
q16	509	396	387	387
q17	977	560	562	560
q18	7197	6585	6713	6585
q19	1396	1060	1067	1060
q20	487	203	202	202
q21	3962	3230	3188	3188
q22	1093	998	995	995
Total cold run time: 107814 ms
Total hot run time: 39706 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6528	6532	6552	6532
q2	329	227	230	227
q3	2858	2786	2848	2786
q4	2038	1803	1813	1803
q5	5679	5747	5772	5747
q6	220	137	132	132
q7	2363	1884	1889	1884
q8	3391	3649	3597	3597
q9	9040	8919	9017	8919
q10	3560	3524	3515	3515
q11	602	494	517	494
q12	810	608	654	608
q13	8141	3244	3153	3153
q14	297	274	282	274
q15	521	476	469	469
q16	493	451	459	451
q17	1857	1647	1641	1641
q18	8100	7873	7775	7775
q19	1696	1519	1509	1509
q20	2037	1793	1815	1793
q21	5233	4894	5012	4894
q22	1153	1030	1013	1013
Total cold run time: 66946 ms
Total hot run time: 59216 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 196134 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 5d9a1efa1bc34ac308aef9e019e9d33528d06d51, data reload: false

query1	1260	887	885	885
query2	6286	1904	1901	1901
query3	10809	4211	4343	4211
query4	60705	29305	23607	23607
query5	5271	449	444	444
query6	404	178	203	178
query7	5445	316	309	309
query8	304	216	226	216
query9	8559	2604	2553	2553
query10	451	267	256	256
query11	17735	15081	15698	15081
query12	167	105	107	105
query13	1415	448	432	432
query14	10212	7086	6581	6581
query15	203	183	170	170
query16	7140	511	462	462
query17	1146	555	557	555
query18	1882	327	328	327
query19	213	162	154	154
query20	122	112	108	108
query21	203	105	119	105
query22	4677	4483	4592	4483
query23	34486	34344	34280	34280
query24	6154	3016	2934	2934
query25	535	413	425	413
query26	668	171	167	167
query27	1854	365	345	345
query28	4084	2227	2157	2157
query29	723	453	444	444
query30	240	152	152	152
query31	994	810	818	810
query32	67	56	54	54
query33	488	290	287	287
query34	923	531	512	512
query35	861	760	715	715
query36	1066	959	951	951
query37	118	74	82	74
query38	4017	3951	3994	3951
query39	1520	1460	1493	1460
query40	206	109	97	97
query41	47	47	47	47
query42	106	106	100	100
query43	522	476	473	473
query44	1166	850	816	816
query45	182	164	170	164
query46	1140	725	729	725
query47	2015	1952	1922	1922
query48	465	390	420	390
query49	713	409	397	397
query50	863	428	437	428
query51	7323	7309	7208	7208
query52	98	91	91	91
query53	272	183	182	182
query54	595	453	471	453
query55	79	79	76	76
query56	268	257	255	255
query57	1269	1173	1114	1114
query58	225	211	213	211
query59	3322	3119	2961	2961
query60	263	274	247	247
query61	135	144	153	144
query62	760	681	668	668
query63	217	195	183	183
query64	1382	656	608	608
query65	3235	3287	3179	3179
query66	660	286	292	286
query67	15874	15598	15533	15533
query68	4179	594	582	582
query69	427	265	267	265
query70	1127	1074	1103	1074
query71	324	241	253	241
query72	6346	4015	4037	4015
query73	747	349	363	349
query74	10268	8976	9213	8976
query75	3358	2633	2660	2633
query76	1968	1026	1051	1026
query77	497	275	260	260
query78	10609	9594	9547	9547
query79	1817	583	593	583
query80	1415	421	441	421
query81	512	220	217	217
query82	1257	87	92	87
query83	165	138	136	136
query84	277	78	82	78
query85	979	289	289	289
query86	367	289	315	289
query87	4354	4230	4230	4230
query88	3930	2396	2386	2386
query89	418	299	291	291
query90	1963	184	185	184
query91	177	145	153	145
query92	58	50	48	48
query93	2205	562	551	551
query94	753	278	287	278
query95	349	262	259	259
query96	607	278	276	276
query97	3301	3188	3172	3172
query98	215	198	191	191
query99	1613	1268	1287	1268
Total cold run time: 313391 ms
Total hot run time: 196134 ms

@doris-robot
Copy link

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

query1	0.03	0.04	0.03
query2	0.06	0.04	0.03
query3	0.24	0.07	0.07
query4	1.63	0.10	0.11
query5	0.53	0.49	0.51
query6	1.14	0.73	0.74
query7	0.02	0.01	0.02
query8	0.04	0.04	0.03
query9	0.56	0.49	0.51
query10	0.55	0.53	0.55
query11	0.14	0.10	0.10
query12	0.13	0.12	0.11
query13	0.60	0.59	0.60
query14	0.77	0.79	0.79
query15	0.84	0.82	0.81
query16	0.38	0.38	0.37
query17	1.06	1.00	1.06
query18	0.25	0.22	0.22
query19	1.87	1.70	1.77
query20	0.02	0.01	0.02
query21	15.40	0.59	0.58
query22	2.31	1.87	1.42
query23	17.04	0.94	0.74
query24	3.01	1.17	0.97
query25	0.18	0.20	0.12
query26	0.48	0.14	0.13
query27	0.05	0.05	0.04
query28	10.38	0.54	0.47
query29	12.58	3.19	3.24
query30	0.25	0.06	0.07
query31	2.85	0.38	0.37
query32	3.27	0.45	0.45
query33	3.02	2.95	2.95
query34	17.02	4.52	4.45
query35	4.55	4.61	4.51
query36	0.65	0.47	0.48
query37	0.09	0.06	0.06
query38	0.04	0.03	0.04
query39	0.04	0.02	0.02
query40	0.16	0.13	0.13
query41	0.07	0.03	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.02
Total cold run time: 104.37 s
Total hot run time: 29.43 s

@mrhhsg
Copy link
Member

mrhhsg commented Jun 11, 2025

run buildall

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 41.17% (10894/26462)
Line Coverage 32.00% (93210/291294)
Region Coverage 31.07% (48061/154711)
Branch Coverage 27.54% (24622/89396)

Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dataroaring dataroaring merged commit b053f3f into branch-3.0 Jun 11, 2025
22 of 27 checks passed
@github-actions github-actions bot deleted the auto-pick-51516-branch-3.0 branch June 11, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants