Skip to content

Conversation

@Mryange
Copy link
Contributor

@Mryange Mryange commented Feb 10, 2026

What problem does this PR solve?

The implementation of width_bucket requires the fourth argument to be constant but did not enforce this; a regular column can be passed in, however width_bucket will only use the first row.
before

mysql> SELECT k1, v1, v2, v3, width_bucket(v1, date('2023-11-18'), date('2027-11-18'), v4) AS w FROM width_bucket_test ORDER BY k1;
+------+------------+-----------+--------+------+
| k1   | v1         | v2        | v3     | w    |
+------+------------+-----------+--------+------+
|    1 | 2022-11-18 |    290000 | 290000 |    0 |
|    2 | 2023-11-18 |    320000 | 320000 |    1 |
|    3 | 2024-11-18 | 399999.99 | 399999 |    1 |
|    4 | 2025-11-18 |    400000 | 400000 |    1 |
|    5 | 2026-11-18 |    470000 | 470000 |    1 |
|    6 | 2027-11-18 |    510000 | 510000 |    2 |
|    7 | 2028-11-18 |    610000 | 610000 |    2 |
|    8 | NULL       |      NULL |   NULL | NULL |
+------+------------+-----------+--------+------+

now

mysql>  SELECT k1, v1, v2, v3, width_bucket(v1, date('2023-11-18'), date('2027-11-18'), v4) AS w FROM width_bucket_test ORDER BY k1;
ERROR 1105 (HY000): errCode = 2, detailMessage = The fourth argument of WidthBucket must be a constant.

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

@Mryange Mryange requested a review from zclllyybb as a code owner February 10, 2026 07:27
@Thearas
Copy link
Contributor

Thearas commented Feb 10, 2026

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?

@Mryange
Copy link
Contributor Author

Mryange commented Feb 10, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17612	4588	4299	4299
q2	2039	346	253	253
q3	10150	1275	722	722
q4	10189	772	307	307
q5	7483	2253	1910	1910
q6	191	172	143	143
q7	872	729	613	613
q8	9259	1405	1140	1140
q9	4706	4645	4564	4564
q10	6811	1932	1550	1550
q11	522	310	288	288
q12	344	374	220	220
q13	17784	4078	3220	3220
q14	228	247	210	210
q15	916	792	806	792
q16	674	668	629	629
q17	708	845	471	471
q18	6464	5744	5603	5603
q19	1532	977	612	612
q20	494	479	371	371
q21	2502	1812	1798	1798
q22	360	317	268	268
Total cold run time: 101840 ms
Total hot run time: 29983 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4360	4390	4379	4379
q2	259	344	254	254
q3	2112	2659	2186	2186
q4	1351	1741	1281	1281
q5	4225	4262	4360	4262
q6	215	180	138	138
q7	1966	1869	1758	1758
q8	2489	2784	2458	2458
q9	7681	7533	7536	7533
q10	2813	3088	2650	2650
q11	556	491	465	465
q12	677	772	653	653
q13	3907	4432	3638	3638
q14	323	303	283	283
q15	883	807	786	786
q16	690	779	863	779
q17	1155	1354	1414	1354
q18	8476	7850	7994	7850
q19	860	891	831	831
q20	2083	2274	2031	2031
q21	4802	4630	4171	4171
q22	561	539	523	523
Total cold run time: 52444 ms
Total hot run time: 50263 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.10	0.05	0.05
query3	0.25	0.08	0.09
query4	1.61	0.12	0.11
query5	0.26	0.24	0.24
query6	1.18	0.66	0.68
query7	0.04	0.03	0.03
query8	0.05	0.04	0.04
query9	0.57	0.50	0.51
query10	0.56	0.55	0.55
query11	0.14	0.10	0.09
query12	0.15	0.11	0.10
query13	0.63	0.62	0.61
query14	1.08	1.06	1.06
query15	0.88	0.88	0.89
query16	0.40	0.40	0.42
query17	1.13	1.16	1.15
query18	0.23	0.21	0.22
query19	2.10	1.99	1.91
query20	0.02	0.02	0.02
query21	15.43	0.28	0.15
query22	5.04	0.06	0.06
query23	15.75	0.30	0.11
query24	1.02	0.53	0.50
query25	0.07	0.09	0.06
query26	0.15	0.14	0.14
query27	0.11	0.06	0.04
query28	4.71	1.14	0.97
query29	12.59	3.86	3.17
query30	0.30	0.15	0.13
query31	2.82	0.66	0.40
query32	3.23	0.60	0.49
query33	3.31	3.34	3.30
query34	16.33	5.46	4.73
query35	4.80	4.84	4.75
query36	0.66	0.51	0.49
query37	0.12	0.07	0.07
query38	0.07	0.04	0.05
query39	0.04	0.04	0.03
query40	0.20	0.17	0.15
query41	0.09	0.04	0.03
query42	0.04	0.04	0.04
query43	0.05	0.03	0.03
Total cold run time: 98.36 s
Total hot run time: 28.62 s

@Mryange
Copy link
Contributor Author

Mryange commented Feb 10, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	16749	4365	4276	4276
q2	2038	357	238	238
q3	10205	1292	755	755
q4	10390	788	325	325
q5	7572	2229	1910	1910
q6	193	179	142	142
q7	867	731	605	605
q8	9258	1388	1083	1083
q9	4757	4637	4623	4623
q10	6789	1951	1538	1538
q11	477	255	234	234
q12	330	381	220	220
q13	17760	4150	3287	3287
q14	237	233	215	215
q15	885	813	791	791
q16	698	685	612	612
q17	700	814	520	520
q18	6765	5893	6172	5893
q19	1292	1067	685	685
q20	598	551	401	401
q21	2803	2001	1902	1902
q22	360	278	249	249
Total cold run time: 101723 ms
Total hot run time: 30504 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4608	4594	4645	4594
q2	273	351	258	258
q3	2371	3014	2503	2503
q4	1439	1841	1373	1373
q5	4597	4506	4611	4506
q6	233	174	136	136
q7	2055	1913	1739	1739
q8	2604	2497	2486	2486
q9	7660	7478	7594	7478
q10	2822	3123	2609	2609
q11	513	427	423	423
q12	690	727	615	615
q13	3907	4305	3631	3631
q14	303	298	270	270
q15	837	835	780	780
q16	629	743	645	645
q17	1087	1270	1301	1270
q18	7556	7349	7270	7270
q19	812	803	828	803
q20	1971	2022	1950	1950
q21	4518	4249	4193	4193
q22	518	460	427	427
Total cold run time: 52003 ms
Total hot run time: 49959 ms

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

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

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.71% (19450/36903)
Line Coverage 36.19% (181090/500340)
Region Coverage 32.56% (140582/431698)
Branch Coverage 33.62% (60941/181272)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.75% (25944/36158)
Line Coverage 54.40% (271505/499101)
Region Coverage 51.91% (226350/436078)
Branch Coverage 53.41% (97195/181976)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (5/5) 🎉
Increment coverage report
Complete coverage report

@Mryange
Copy link
Contributor Author

Mryange commented Feb 11, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17642	4490	4272	4272
q2	2054	350	263	263
q3	10107	1291	725	725
q4	10238	787	308	308
q5	7920	2191	1927	1927
q6	205	176	144	144
q7	889	738	607	607
q8	9282	1380	1141	1141
q9	4772	4622	4676	4622
q10	6865	1926	1571	1571
q11	472	258	248	248
q12	406	382	229	229
q13	17809	4106	3210	3210
q14	244	246	209	209
q15	876	811	798	798
q16	688	680	633	633
q17	709	839	516	516
q18	6607	5911	6284	5911
q19	1541	1050	675	675
q20	564	530	404	404
q21	2727	1957	1898	1898
q22	351	314	250	250
Total cold run time: 102968 ms
Total hot run time: 30561 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4548	4542	4694	4542
q2	267	351	263	263
q3	2385	2935	2421	2421
q4	1465	1837	1405	1405
q5	4835	4474	4701	4474
q6	227	194	131	131
q7	2012	1922	1809	1809
q8	2595	2360	2446	2360
q9	7618	7506	7406	7406
q10	2792	3013	2538	2538
q11	509	459	430	430
q12	729	748	673	673
q13	3893	4402	3624	3624
q14	295	305	289	289
q15	827	787	793	787
q16	676	679	643	643
q17	1103	1257	1277	1257
q18	7807	7516	7471	7471
q19	864	777	859	777
q20	1946	2038	1870	1870
q21	4520	4197	4063	4063
q22	490	476	417	417
Total cold run time: 52403 ms
Total hot run time: 49650 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.10	0.06	0.04
query3	0.26	0.09	0.09
query4	1.61	0.12	0.11
query5	0.27	0.25	0.25
query6	1.16	0.67	0.68
query7	0.03	0.03	0.03
query8	0.05	0.05	0.04
query9	0.57	0.51	0.49
query10	0.55	0.54	0.55
query11	0.14	0.09	0.10
query12	0.13	0.10	0.10
query13	0.63	0.61	0.62
query14	1.05	1.06	1.06
query15	0.87	0.86	0.87
query16	0.39	0.39	0.39
query17	1.15	1.10	1.15
query18	0.23	0.22	0.20
query19	2.05	1.91	1.98
query20	0.02	0.02	0.01
query21	15.40	0.29	0.15
query22	5.10	0.05	0.06
query23	15.96	0.27	0.11
query24	0.97	0.67	0.67
query25	0.13	0.13	0.06
query26	0.14	0.14	0.14
query27	0.14	0.05	0.09
query28	4.87	1.17	0.96
query29	12.61	3.90	3.17
query30	0.29	0.13	0.12
query31	2.82	0.66	0.41
query32	3.23	0.61	0.50
query33	3.28	3.26	3.26
query34	16.14	5.38	4.75
query35	4.75	4.79	4.73
query36	0.66	0.50	0.49
query37	0.12	0.07	0.07
query38	0.07	0.05	0.04
query39	0.05	0.03	0.03
query40	0.20	0.16	0.15
query41	0.09	0.03	0.03
query42	0.05	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 98.43 s
Total hot run time: 28.64 s

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.82% (19492/36906)
Line Coverage 36.31% (181769/500550)
Region Coverage 32.69% (140980/431236)
Branch Coverage 33.70% (61082/181277)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.81% (25965/36160)
Line Coverage 54.46% (271821/499146)
Region Coverage 51.94% (226485/436088)
Branch Coverage 53.43% (97229/181982)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.81% (25967/36161)
Line Coverage 54.47% (271864/499147)
Region Coverage 51.97% (226614/436089)
Branch Coverage 53.44% (97243/181982)

1 similar comment
@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.81% (25967/36161)
Line Coverage 54.47% (271864/499147)
Region Coverage 51.97% (226614/436089)
Branch Coverage 53.44% (97243/181982)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.80% (25964/36161)
Line Coverage 54.46% (271841/499147)
Region Coverage 51.93% (226451/436089)
Branch Coverage 53.42% (97216/181982)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (5/5) 🎉
Increment coverage report
Complete coverage report

1 similar comment
@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (5/5) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.81% (25969/36161)
Line Coverage 54.48% (271916/499147)
Region Coverage 51.94% (226490/436089)
Branch Coverage 53.44% (97250/181982)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (5/5) 🎉
Increment coverage report
Complete coverage report

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