Skip to content
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

[Bug](function) fix is_ip_address_in_range function parse error throw exception #45657

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

zhangstar333
Copy link
Contributor

@zhangstar333 zhangstar333 commented Dec 19, 2024

What problem does this PR solve?

Problem Summary:
before: will be throw exception when parse NULL value, as the input is empty invalid.
so need check firstly and then parse it.

mysql [test]>select * from ip_test;
+------+------------------+
| id   | data             |
+------+------------------+
|   54 | 2001:db8:4::/128 |
|   55 | NULL             |
+------+------------------+
2 rows in set (0.07 sec)

mysql [test]>SELECT  data,   IS_IP_ADDRESS_IN_RANGE(CAST('0.0.0.1' AS STRING), data) FROM ip_test;
ERROR 1105 (HY000): errCode = 2, detailMessage = (10.16.10.8)[INVALID_ARGUMENT][E33] The text does not contain '/':

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?

@zhangstar333 zhangstar333 changed the title [Bug](function) fix ip function parse error throw exception [Bug](function) fix is_ip_address_in_range function parse error throw exception Dec 19, 2024
Copy link
Contributor

sh-checker report

To get the full details, please check in the job output.

shellcheck errors

'shellcheck ' returned error 1 finding the following syntactical issues:

----------

In gensrc/script/gen_build_version.sh line 38:
if [[ ${build_version_hotfix} > 0 ]]; then
                              ^-- SC2071 (error): > is for string comparisons. Use -gt instead.


In gensrc/script/gen_build_version.sh line 228:
if [[ ${build_version_hotfix} > 0 ]]; then
                              ^-- SC2071 (error): > is for string comparisons. Use -gt instead.

For more information:
  https://www.shellcheck.net/wiki/SC2071 -- > is for string comparisons. Use ...
----------

You can address the above issues in one of three ways:
1. Manually correct the issue in the offending shell script;
2. Disable specific issues by adding the comment:
  # shellcheck disable=NNNN
above the line that contains the issue, where NNNN is the error code;
3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file.



shfmt errors
'shfmt ' found no issues.

@zhangstar333
Copy link
Contributor Author

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.87% (10132/26066)
Line Coverage: 29.77% (85147/285978)
Region Coverage: 28.83% (43691/151531)
Branch Coverage: 25.37% (22191/87486)
Coverage Report: http://coverage.selectdb-in.cc/coverage/2c12c0ec290cb2dbf65d6439ec5d3dca80eec626_2c12c0ec290cb2dbf65d6439ec5d3dca80eec626/report/index.html

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17596	7459	7200	7200
q2	2050	191	187	187
q3	10581	1086	1152	1086
q4	10573	698	762	698
q5	7605	2687	2744	2687
q6	232	150	143	143
q7	975	627	605	605
q8	9283	1823	1929	1823
q9	6709	6504	6498	6498
q10	7040	2299	2339	2299
q11	473	274	267	267
q12	414	226	232	226
q13	17789	2947	3004	2947
q14	242	218	208	208
q15	553	515	509	509
q16	653	578	590	578
q17	988	514	533	514
q18	7269	6779	6571	6571
q19	1353	951	1012	951
q20	464	178	178	178
q21	4150	3150	3095	3095
q22	369	304	305	304
Total cold run time: 107361 ms
Total hot run time: 39574 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7234	7220	7184	7184
q2	325	227	227	227
q3	2883	2756	2891	2756
q4	2057	1786	1826	1786
q5	5672	5636	5636	5636
q6	228	140	141	140
q7	2251	1866	1792	1792
q8	3351	3518	3458	3458
q9	8833	8931	8944	8931
q10	3578	3560	3538	3538
q11	605	502	517	502
q12	827	610	630	610
q13	11162	3053	3099	3053
q14	308	279	285	279
q15	557	514	514	514
q16	687	648	662	648
q17	1825	1627	1612	1612
q18	8308	7726	7753	7726
q19	1710	1573	1608	1573
q20	2131	1904	1849	1849
q21	5772	5540	5522	5522
q22	645	592	573	573
Total cold run time: 70949 ms
Total hot run time: 59909 ms

@doris-robot
Copy link

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

query1	1309	959	914	914
query2	6241	2500	2321	2321
query3	10960	4654	4724	4654
query4	33204	23281	23682	23281
query5	4792	490	446	446
query6	298	193	184	184
query7	3990	303	310	303
query8	315	240	236	236
query9	9573	2702	2691	2691
query10	504	252	268	252
query11	17979	15241	15073	15073
query12	156	99	98	98
query13	1612	416	403	403
query14	9840	6577	7524	6577
query15	309	191	198	191
query16	8184	442	448	442
query17	1700	572	590	572
query18	2073	307	300	300
query19	374	156	157	156
query20	130	110	112	110
query21	206	104	105	104
query22	4797	4693	4699	4693
query23	34635	33807	33726	33726
query24	10296	2496	2586	2496
query25	590	425	380	380
query26	730	151	150	150
query27	2416	332	332	332
query28	6435	2479	2469	2469
query29	740	429	418	418
query30	234	151	146	146
query31	1022	858	837	837
query32	95	59	53	53
query33	779	308	292	292
query34	1196	509	507	507
query35	913	765	738	738
query36	1119	966	995	966
query37	117	72	72	72
query38	4379	4107	4098	4098
query39	1490	1442	1467	1442
query40	212	104	98	98
query41	46	43	42	42
query42	113	98	99	98
query43	537	478	502	478
query44	1355	839	820	820
query45	190	162	170	162
query46	1189	752	694	694
query47	2091	1952	1964	1952
query48	410	346	316	316
query49	866	398	386	386
query50	825	397	390	390
query51	7325	7099	7288	7099
query52	107	90	88	88
query53	261	187	181	181
query54	1218	407	419	407
query55	89	79	78	78
query56	267	251	237	237
query57	1289	1191	1166	1166
query58	234	222	230	222
query59	3403	3020	2991	2991
query60	280	261	265	261
query61	118	107	106	106
query62	889	659	665	659
query63	216	186	180	180
query64	3599	676	660	660
query65	3235	3186	3216	3186
query66	805	306	308	306
query67	15797	15612	15453	15453
query68	4664	538	539	538
query69	435	271	256	256
query70	1172	1118	1133	1118
query71	390	251	249	249
query72	6384	4125	4017	4017
query73	756	358	378	358
query74	10263	8821	8862	8821
query75	3399	2661	2657	2657
query76	2734	1056	1094	1056
query77	387	273	267	267
query78	10213	11377	10177	10177
query79	1093	616	590	590
query80	740	418	433	418
query81	555	229	226	226
query82	221	124	123	123
query83	282	160	147	147
query84	235	83	76	76
query85	848	378	372	372
query86	391	297	295	295
query87	4716	4522	4429	4429
query88	2997	2229	2174	2174
query89	397	290	295	290
query90	1894	192	187	187
query91	152	105	104	104
query92	62	51	51	51
query93	1037	519	532	519
query94	805	291	292	291
query95	350	242	246	242
query96	613	271	281	271
query97	2830	2685	2689	2685
query98	214	198	205	198
query99	1537	1357	1330	1330
Total cold run time: 295464 ms
Total hot run time: 196371 ms

@doris-robot
Copy link

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

query1	0.03	0.03	0.04
query2	0.07	0.04	0.04
query3	0.24	0.07	0.07
query4	1.60	0.10	0.11
query5	0.43	0.42	0.42
query6	1.17	0.65	0.66
query7	0.02	0.01	0.02
query8	0.04	0.03	0.03
query9	0.58	0.50	0.49
query10	0.56	0.61	0.56
query11	0.14	0.10	0.10
query12	0.13	0.11	0.11
query13	0.61	0.60	0.61
query14	2.87	2.73	2.72
query15	0.91	0.85	0.82
query16	0.38	0.40	0.39
query17	1.05	1.07	1.07
query18	0.24	0.21	0.20
query19	1.95	1.87	1.99
query20	0.01	0.02	0.01
query21	15.36	0.59	0.58
query22	2.56	2.36	2.15
query23	17.00	0.89	0.95
query24	3.12	0.65	1.14
query25	0.30	0.16	0.05
query26	0.34	0.14	0.14
query27	0.06	0.04	0.05
query28	10.88	1.11	1.07
query29	12.57	3.33	3.33
query30	0.25	0.07	0.07
query31	2.84	0.39	0.38
query32	3.25	0.46	0.47
query33	3.07	3.08	3.13
query34	17.09	4.48	4.49
query35	4.46	4.46	4.50
query36	0.66	0.48	0.49
query37	0.09	0.06	0.06
query38	0.04	0.03	0.03
query39	0.04	0.03	0.02
query40	0.18	0.14	0.14
query41	0.08	0.02	0.03
query42	0.03	0.02	0.02
query43	0.03	0.04	0.03
Total cold run time: 107.33 s
Total hot run time: 32.92 s

Copy link
Contributor

@HappenLee HappenLee 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

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 Dec 20, 2024
Copy link
Contributor

PR approved by anyone and no changes requested.

@zhangstar333 zhangstar333 merged commit 0ab4eae into apache:master Dec 20, 2024
32 of 35 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 20, 2024
… exception (#45657)

### What problem does this PR solve?
Problem Summary:
before: will be throw exception when parse NULL value, as the input is
empty invalid.
so need check firstly and then parse it.

```
mysql [test]>select * from ip_test;
+------+------------------+
| id   | data             |
+------+------------------+
|   54 | 2001:db8:4::/128 |
|   55 | NULL             |
+------+------------------+
2 rows in set (0.07 sec)

mysql [test]>SELECT  data,   IS_IP_ADDRESS_IN_RANGE(CAST('0.0.0.1' AS STRING), data) FROM ip_test;
ERROR 1105 (HY000): errCode = 2, detailMessage = (10.16.10.8)[INVALID_ARGUMENT][E33] The text does not contain '/':

```
yiguolei pushed a commit that referenced this pull request Dec 22, 2024
… error throw exception #45657 (#45749)

Cherry-picked from #45657

Co-authored-by: zhangstar333 <[email protected]>
zhangstar333 added a commit to zhangstar333/incubator-doris that referenced this pull request Dec 23, 2024
… exception (apache#45657)

Problem Summary:
before: will be throw exception when parse NULL value, as the input is
empty invalid.
so need check firstly and then parse it.

```
mysql [test]>select * from ip_test;
+------+------------------+
| id   | data             |
+------+------------------+
|   54 | 2001:db8:4::/128 |
|   55 | NULL             |
+------+------------------+
2 rows in set (0.07 sec)

mysql [test]>SELECT  data,   IS_IP_ADDRESS_IN_RANGE(CAST('0.0.0.1' AS STRING), data) FROM ip_test;
ERROR 1105 (HY000): errCode = 2, detailMessage = (10.16.10.8)[INVALID_ARGUMENT][E33] The text does not contain '/':

```
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/2.1.x-conflict dev/3.0.4-merged reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants