Skip to content

Conversation

@dwdwqfwe
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx
https://github.com/apache/doris-website/pull/3032/files
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

@Thearas
Copy link
Contributor

Thearas commented Oct 31, 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?

@dwdwqfwe
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

query1	1019	411	406	406
query2	6591	1688	1703	1688
query3	6751	226	225	225
query4	27046	23425	23497	23425
query5	5309	647	472	472
query6	340	242	221	221
query7	4667	508	295	295
query8	298	249	258	249
query9	8747	2581	2599	2581
query10	517	347	296	296
query11	15820	15173	14907	14907
query12	178	126	118	118
query13	1698	579	444	444
query14	11345	9479	9343	9343
query15	209	197	175	175
query16	8494	743	548	548
query17	1476	839	695	695
query18	2122	479	367	367
query19	248	231	185	185
query20	140	141	132	132
query21	220	143	122	122
query22	4629	4748	4600	4600
query23	34869	34062	33842	33842
query24	8640	2520	2524	2520
query25	642	529	489	489
query26	1258	282	163	163
query27	2794	523	367	367
query28	4450	2235	2272	2235
query29	794	606	492	492
query30	299	229	203	203
query31	901	823	748	748
query32	85	73	66	66
query33	599	402	318	318
query34	822	846	516	516
query35	822	870	755	755
query36	985	977	902	902
query37	126	113	84	84
query38	3608	3699	3453	3453
query39	1502	1446	1430	1430
query40	216	126	119	119
query41	71	77	70	70
query42	123	116	109	109
query43	492	500	483	483
query44	1226	733	755	733
query45	181	179	171	171
query46	889	1000	639	639
query47	1732	1764	1720	1720
query48	393	423	318	318
query49	768	511	422	422
query50	658	695	413	413
query51	3928	3922	3883	3883
query52	115	106	101	101
query53	236	275	197	197
query54	303	303	269	269
query55	87	87	80	80
query56	313	307	302	302
query57	1151	1202	1131	1131
query58	288	285	284	284
query59	2585	2731	2578	2578
query60	343	344	336	336
query61	167	164	162	162
query62	790	751	669	669
query63	241	194	195	194
query64	4453	1153	853	853
query65	4016	4003	3944	3944
query66	1061	439	334	334
query67	15301	15070	15281	15070
query68	8341	931	592	592
query69	506	329	289	289
query70	1387	1315	1243	1243
query71	470	338	313	313
query72	5812	4992	4949	4949
query73	651	568	361	361
query74	8955	8864	8826	8826
query75	3632	3408	2871	2871
query76	3515	1176	737	737
query77	801	387	324	324
query78	9548	9672	8950	8950
query79	2046	817	604	604
query80	656	566	504	504
query81	487	262	229	229
query82	436	162	137	137
query83	265	269	258	258
query84	255	115	95	95
query85	910	504	454	454
query86	335	318	310	310
query87	3726	3744	3662	3662
query88	3716	2220	2206	2206
query89	392	329	298	298
query90	2044	213	212	212
query91	169	189	140	140
query92	84	78	66	66
query93	1407	984	649	649
query94	730	448	340	340
query95	402	321	318	318
query96	487	585	278	278
query97	2953	2989	2872	2872
query98	261	212	215	212
query99	1358	1417	1300	1300
Total cold run time: 279924 ms
Total hot run time: 190260 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.09	0.04	0.04
query3	0.25	0.08	0.08
query4	1.61	0.11	0.11
query5	0.27	0.25	0.25
query6	1.16	0.64	0.63
query7	0.03	0.03	0.02
query8	0.05	0.04	0.04
query9	0.59	0.51	0.51
query10	0.60	0.58	0.58
query11	0.17	0.11	0.11
query12	0.15	0.12	0.12
query13	0.61	0.61	0.61
query14	1.01	1.01	1.02
query15	0.86	0.82	0.84
query16	0.39	0.40	0.40
query17	1.06	1.00	1.05
query18	0.22	0.21	0.22
query19	1.93	1.77	1.80
query20	0.02	0.01	0.01
query21	15.46	0.21	0.13
query22	5.08	0.07	0.05
query23	15.67	0.27	0.10
query24	2.64	1.32	0.40
query25	0.07	0.07	0.05
query26	0.15	0.14	0.13
query27	0.06	0.06	0.06
query28	4.44	1.15	0.94
query29	12.68	3.94	3.35
query30	0.28	0.13	0.12
query31	2.83	0.59	0.38
query32	3.24	0.55	0.47
query33	3.24	3.05	3.10
query34	15.94	5.15	4.61
query35	4.66	4.63	4.56
query36	0.68	0.50	0.49
query37	0.10	0.07	0.06
query38	0.07	0.04	0.04
query39	0.04	0.02	0.03
query40	0.18	0.14	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 98.8 s
Total hot run time: 27.61 s

@dwdwqfwe
Copy link
Contributor Author

run feut

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 7.32% (6/82) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.68% (18047/34255)
Line Coverage 37.94% (163825/431828)
Region Coverage 32.25% (124791/386901)
Branch Coverage 33.67% (54604/162155)

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 20.00% (3/15) 🎉
Increment coverage report
Complete coverage report

@dwdwqfwe
Copy link
Contributor Author

run external

@zclllyybb zclllyybb self-assigned this Oct 31, 2025
@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 91.46% (75/82) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.38% (24028/33664)
Line Coverage 57.80% (249995/432517)
Region Coverage 52.88% (207542/392455)
Branch Coverage 54.62% (89164/163256)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 86.67% (13/15) 🎉
Increment coverage report
Complete coverage report

size_t right = num_thresholds;
size_t result_idx = num_thresholds;

while (left < right) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not use std::upper_bound?

scalar(Unhex.class, "unhex"),
scalar(UnhexNull.class, "unhex_null"),
scalar(Uncompress.class, "uncompress"),
scalar(UnhexNull.class, "unhex_null"),
Copy link
Contributor

Choose a reason for hiding this comment

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

format

String get_name() const override { return name; }
bool is_variadic() const override { return true; }
size_t get_number_of_arguments() const override { return 0; }
bool use_default_implementation_for_nulls() const override { return true; }
Copy link
Contributor

Choose a reason for hiding this comment

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

default value is already true

Status execute_impl(FunctionContext* /*context*/, Block& block, const ColumnNumbers& arguments,
uint32_t result, size_t input_rows_count) const override {
if (arguments.size() < 2) {
return Status::InvalidArgument("interval requires at least 2 arguments");
Copy link
Contributor

Choose a reason for hiding this comment

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

should make sure it's checked in FE. add [[unlikely]] and return InternalError

WHERE id <= 7
ORDER BY id;
"""

Copy link
Contributor

Choose a reason for hiding this comment

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

add test which some of thresholds are const

res_data);
break;
default:
return Status::InvalidArgument(
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

auto compare_cwn = block.get_by_position(arguments[0]);
auto compare_col_ptr = compare_cwn.column;
bool compare_is_const = false;
std::tie(compare_col_ptr, compare_is_const) = unpack_if_const(compare_col_ptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

use default_preprocess_parameter_columns here is more proper

@dwdwqfwe
Copy link
Contributor Author

dwdwqfwe commented Nov 3, 2025

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 7.69% (1/13) 🎉
Increment coverage report
Complete coverage report

@doris-robot
Copy link

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

query1	1043	444	398	398
query2	6567	1668	1668	1668
query3	6763	247	233	233
query4	26755	23923	23083	23083
query5	5873	659	467	467
query6	346	247	235	235
query7	4651	507	299	299
query8	304	270	254	254
query9	8748	2622	2617	2617
query10	574	366	292	292
query11	15540	15037	14833	14833
query12	180	128	120	120
query13	1731	578	440	440
query14	11960	9338	9337	9337
query15	251	197	172	172
query16	7768	698	527	527
query17	1631	793	652	652
query18	2242	463	400	400
query19	417	222	179	179
query20	147	142	129	129
query21	222	155	119	119
query22	4708	4665	4583	4583
query23	34641	33827	34229	33827
query24	8407	2500	2507	2500
query25	563	523	469	469
query26	741	272	166	166
query27	2738	538	379	379
query28	4432	2212	2249	2212
query29	754	624	531	531
query30	756	241	203	203
query31	1022	825	754	754
query32	80	76	70	70
query33	570	393	347	347
query34	840	897	541	541
query35	860	867	780	780
query36	955	1024	918	918
query37	127	109	83	83
query38	3480	3533	3471	3471
query39	1473	1403	1414	1403
query40	219	128	114	114
query41	63	56	58	56
query42	117	107	108	107
query43	482	514	499	499
query44	1230	744	735	735
query45	182	178	169	169
query46	885	998	635	635
query47	1757	1783	1748	1748
query48	380	425	328	328
query49	727	501	413	413
query50	636	703	406	406
query51	3908	3960	3884	3884
query52	109	112	95	95
query53	232	261	212	212
query54	304	285	271	271
query55	84	84	85	84
query56	315	298	290	290
query57	1179	1201	1110	1110
query58	284	274	274	274
query59	2556	2638	2584	2584
query60	343	342	321	321
query61	175	154	149	149
query62	782	715	658	658
query63	231	194	194	194
query64	3300	1138	851	851
query65	4043	3981	3931	3931
query66	881	423	337	337
query67	15447	15072	14955	14955
query68	8217	903	595	595
query69	546	318	313	313
query70	1416	1288	1216	1216
query71	530	349	319	319
query72	5473	4841	5026	4841
query73	645	571	365	365
query74	8915	9184	9049	9049
query75	4196	3409	2830	2830
query76	3854	1188	762	762
query77	813	409	304	304
query78	9596	9578	8930	8930
query79	2595	832	603	603
query80	702	543	492	492
query81	530	256	219	219
query82	492	163	130	130
query83	256	266	245	245
query84	258	103	85	85
query85	873	480	432	432
query86	336	322	289	289
query87	3666	3698	3573	3573
query88	3828	2255	2207	2207
query89	394	338	288	288
query90	2016	213	219	213
query91	159	167	134	134
query92	91	69	63	63
query93	2259	961	633	633
query94	688	452	352	352
query95	397	314	312	312
query96	487	561	279	279
query97	2943	2964	2859	2859
query98	244	213	208	208
query99	1337	1407	1311	1311
Total cold run time: 280463 ms
Total hot run time: 189552 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.08	0.04	0.05
query3	0.26	0.08	0.08
query4	1.61	0.11	0.12
query5	0.28	0.27	0.25
query6	1.16	0.65	0.63
query7	0.03	0.02	0.03
query8	0.06	0.04	0.05
query9	0.60	0.52	0.53
query10	0.57	0.58	0.57
query11	0.16	0.11	0.11
query12	0.15	0.12	0.12
query13	0.62	0.60	0.61
query14	1.01	1.01	1.00
query15	0.85	0.82	0.83
query16	0.39	0.39	0.42
query17	1.03	1.08	1.02
query18	0.21	0.20	0.20
query19	1.95	1.79	1.79
query20	0.02	0.01	0.02
query21	15.47	0.18	0.14
query22	5.10	0.06	0.05
query23	15.68	0.26	0.10
query24	3.06	0.76	0.59
query25	0.08	0.06	0.06
query26	0.14	0.13	0.14
query27	0.06	0.05	0.05
query28	4.44	1.15	0.95
query29	12.57	3.89	3.19
query30	0.28	0.13	0.12
query31	2.83	0.60	0.39
query32	3.24	0.55	0.48
query33	3.00	3.08	3.04
query34	15.86	5.19	4.58
query35	4.58	4.56	4.57
query36	0.68	0.50	0.50
query37	0.10	0.06	0.06
query38	0.06	0.04	0.04
query39	0.03	0.03	0.03
query40	0.16	0.15	0.13
query41	0.08	0.03	0.02
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 98.67 s
Total hot run time: 27.63 s

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 8.33% (6/72) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.69% (18051/34257)
Line Coverage 37.99% (164075/431928)
Region Coverage 32.33% (125090/386918)
Branch Coverage 33.74% (54723/162204)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 90.28% (65/72) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.47% (24069/33676)
Line Coverage 57.89% (250473/432673)
Region Coverage 53.11% (208473/392514)
Branch Coverage 54.73% (89389/163313)

@dwdwqfwe
Copy link
Contributor Author

dwdwqfwe commented Nov 3, 2025

run cloud_p0

@dwdwqfwe
Copy link
Contributor Author

dwdwqfwe commented Nov 3, 2025

run nonConcurrent

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 90.28% (65/72) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.46% (24064/33676)
Line Coverage 57.87% (250390/432673)
Region Coverage 53.04% (208209/392514)
Branch Coverage 54.71% (89348/163313)

1 similar comment
@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 90.28% (65/72) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.46% (24064/33676)
Line Coverage 57.87% (250390/432673)
Region Coverage 53.04% (208209/392514)
Branch Coverage 54.71% (89348/163313)

@dwdwqfwe
Copy link
Contributor Author

dwdwqfwe commented Nov 4, 2025

run nonConcurrent

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 90.28% (65/72) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.47% (24067/33676)
Line Coverage 57.87% (250406/432673)
Region Coverage 53.07% (208325/392514)
Branch Coverage 54.71% (89346/163313)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 76.92% (10/13) 🎉
Increment coverage report
Complete coverage report

ColumnPtr compare_col_ptr = ColumnPtr {};
bool compare_is_const = false;
compare_is_const = is_column_const(*block.get_by_position(arguments[0]).column);
default_preprocess_parameter_columns(&compare_col_ptr, &compare_is_const, {0}, block,
Copy link
Contributor

Choose a reason for hiding this comment

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

default_preprocess_parameter_columns should process parameter columns, that is, column 1 .. n-1


switch (compare_cwn.type->get_primitive_type()) {
case PrimitiveType::TYPE_TINYINT:
compute_interval<ColumnInt8>(block, arguments, *compare_col_ptr, compare_is_const,
Copy link
Contributor

Choose a reason for hiding this comment

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

then, you can reference FunctionMonthsBetween, there's 3 possibility: data const, parameters all const, non const

zclllyybb pushed a commit that referenced this pull request Jan 7, 2026
… process (#58885)

Related PR: #57569

Problem Summary:

fix the wrong useage of function `default_preprocess_parameter_columns`,
the variable `all_const` should not be affected by manually handled
columns.

### Release note
doc: apache/doris-website#3176

The INTERVAL function uses binary search to return the index of the
first threshold strictly greater than N.

```sql
SELECT INTERVAL(0, 1, 10, 100);
+--------------------------+
| INTERVAL(0, 1, 10, 100)  |
+--------------------------+
|                        0 |
+--------------------------+

SELECT INTERVAL(10, 1, 10, 100, 1000);
+-----------------------------------+
| INTERVAL(10, 1, 10, 100, 1000)   |
+-----------------------------------+
|                                 2 |
+-----------------------------------+

-- First parameter is NULL
SELECT INTERVAL(NULL, 1, 10, 100);
+----------------------------+
| INTERVAL(NULL, 1, 10, 100) |
+----------------------------+
|                         -1 |
+----------------------------+

-- Subsequent parameters are NULL, treated as 0
SELECT INTERVAL(3, -1, NULL, 2, 3, 4);
+--------------------------------+
| INTERVAL(3, -1, NULL, 2, 3, 4) |
+--------------------------------+
|                              4 |
+--------------------------------+
```

Co-authored-by: jianhao <1367919489@qq.com>
github-actions bot pushed a commit that referenced this pull request Jan 7, 2026
… process (#58885)

Related PR: #57569

Problem Summary:

fix the wrong useage of function `default_preprocess_parameter_columns`,
the variable `all_const` should not be affected by manually handled
columns.

### Release note
doc: apache/doris-website#3176

The INTERVAL function uses binary search to return the index of the
first threshold strictly greater than N.

```sql
SELECT INTERVAL(0, 1, 10, 100);
+--------------------------+
| INTERVAL(0, 1, 10, 100)  |
+--------------------------+
|                        0 |
+--------------------------+

SELECT INTERVAL(10, 1, 10, 100, 1000);
+-----------------------------------+
| INTERVAL(10, 1, 10, 100, 1000)   |
+-----------------------------------+
|                                 2 |
+-----------------------------------+

-- First parameter is NULL
SELECT INTERVAL(NULL, 1, 10, 100);
+----------------------------+
| INTERVAL(NULL, 1, 10, 100) |
+----------------------------+
|                         -1 |
+----------------------------+

-- Subsequent parameters are NULL, treated as 0
SELECT INTERVAL(3, -1, NULL, 2, 3, 4);
+--------------------------------+
| INTERVAL(3, -1, NULL, 2, 3, 4) |
+--------------------------------+
|                              4 |
+--------------------------------+
```

Co-authored-by: jianhao <1367919489@qq.com>
zzzxl1993 pushed a commit to zzzxl1993/doris that referenced this pull request Jan 13, 2026
… process (apache#58885)

Related PR: apache#57569

Problem Summary:

fix the wrong useage of function `default_preprocess_parameter_columns`,
the variable `all_const` should not be affected by manually handled
columns.

### Release note
doc: apache/doris-website#3176

The INTERVAL function uses binary search to return the index of the
first threshold strictly greater than N.

```sql
SELECT INTERVAL(0, 1, 10, 100);
+--------------------------+
| INTERVAL(0, 1, 10, 100)  |
+--------------------------+
|                        0 |
+--------------------------+

SELECT INTERVAL(10, 1, 10, 100, 1000);
+-----------------------------------+
| INTERVAL(10, 1, 10, 100, 1000)   |
+-----------------------------------+
|                                 2 |
+-----------------------------------+

-- First parameter is NULL
SELECT INTERVAL(NULL, 1, 10, 100);
+----------------------------+
| INTERVAL(NULL, 1, 10, 100) |
+----------------------------+
|                         -1 |
+----------------------------+

-- Subsequent parameters are NULL, treated as 0
SELECT INTERVAL(3, -1, NULL, 2, 3, 4);
+--------------------------------+
| INTERVAL(3, -1, NULL, 2, 3, 4) |
+--------------------------------+
|                              4 |
+--------------------------------+
```

Co-authored-by: jianhao <1367919489@qq.com>
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.

5 participants