Skip to content

Conversation

dwdwqfwe
Copy link
Contributor

@dwdwqfwe dwdwqfwe commented Sep 18, 2025

What problem does this PR solve?

support add_time/sub_time function like mysql:
https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_addtime
Issue Number:

Related PR: apache/doris-website#2901

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

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

@dwdwqfwe
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17590	35	20	20
q2	2658	28	25	25
q3	10719	16	16	16
q4	11189	16	15	15
q5	8106	19	14	14
q6	221	13	12	12
q7	907	23	21	21
q8	9440	14	13	13
q9	9543	23	12	12
q10	7015	13	11	11
q11	717	24	20	20
q12	347	12	14	12
q13	18654	12	10	10
q14	239	11	10	10
q15	602	12	11	11
q16	1056	997	951	951
q17	567	13	11	11
q18	7673	13	11	11
q19	1647	11	11	11
q20	1947	366	244	244
q21	9047	21	21	21
q22	1090	12	12	12
Total cold run time: 120974 ms
Total hot run time: 1483 ms

----- Round 2, with runtime_filter_mode=off -----
q1	11	12	11	11
q2	22	21	20	20
q3	12	12	11	11
q4	12	11	11	11
q5	12	11	15	11
q6	11	10	10	10
q7	19	19	19	19
q8	11	9	10	9
q9	11	11	10	10
q10	10	10	11	10
q11	19	19	18	18
q12	10	10	10	10
q13	10	10	9	9
q14	10	10	11	10
q15	10	11	10	10
q16	1075	1109	1040	1040
q17	13	11	9	9
q18	10	10	10	10
q19	10	9	9	9
q20	1863	1962	1870	1870
q21	22	20	18	18
q22	12	11	11	11
Total cold run time: 3195 ms
Total hot run time: 3146 ms

@doris-robot
Copy link

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

query1	1068	18	12	12
query2	7148	18	16	16
query3	7641	12	11	11
query4	26458	12	11	11
query5	4422	13	12	12
query6	378	12	11	11
query7	5527	12	11	11
query8	575	18	18	18
query9	9669	12	10	10
query10	726	12	12	12
query11	15163	11	11	11
query12	178	13	11	11
query13	1719	11	10	10
query14	10890	15	13	13
query15	219	12	10	10
query16	7176	11	10	10
query17	1533	11	9	9
query18	2810	12	10	10
query19	211	10	9	9
query20	130	12	9	9
query21	222	12	11	11
query22	4021	10	9	9
query23	33597	23	14	14
query24	9630	14	14	14
query25	765	11	9	9
query26	1464	10	10	10
query27	3404	10	10	10
query28	6364	11	10	10
query29	1278	11	11	11
query30	647	11	10	10
query31	1730	11	12	11
query32	115	13	11	11
query33	1319	12	10	10
query34	1687	867	519	519
query35	901	10	10	10
query36	976	10	9	9
query37	115	10	9	9
query38	3450	10	8	8
query39	1520	726	745	726
query40	299	11	10	10
query41	82	11	10	10
query42	146	10	9	9
query43	486	11	10	10
query44	1301	10	10	10
query45	192	10	9	9
query46	914	9	9	9
query47	1814	10	9	9
query48	405	10	8	8
query49	1149	11	10	10
query50	737	11	10	10
query51	3953	9	9	9
query52	116	9	11	9
query53	245	12	11	11
query54	743	10	8	8
query55	92	10	10	10
query56	334	11	10	10
query57	1216	10	9	9
query58	313	10	10	10
query59	2711	9	9	9
query60	365	9	9	9
query61	173	10	8	8
query62	837	9	9	9
query63	263	10	10	10
query64	4495	10	9	9
query65	4028	10	8	8
query66	1227	10	8	8
query67	16396	15	9	9
query68	3475	10	10	10
query69	782	9	9	9
query70	1396	11	10	10
query71	409	335	352	335
query72	6644	12	11	11
query73	531	11	9	9
query74	9371	10	9	9
query75	3461	11	10	10
query76	2859	9	9	9
query77	889	11	11	11
query78	9808	22	9	9
query79	1123	10	8	8
query80	758	9	9	9
query81	528	10	9	9
query82	948	9	9	9
query83	294	11	10	10
query84	345	9	9	9
query85	1424	10	8	8
query86	485	10	8	8
query87	3888	8	8	8
query88	2937	13	11	11
query89	388	10	9	9
query90	2494	9	8	8
query91	192	10	9	9
query92	85	9	8	8
query93	1158	9	9	9
query94	933	10	14	10
query95	533	9	8	8
query96	436	9	9	9
query97	3210	9	9	9
query98	230	248	209	209
query99	1443	11	10	10
Total cold run time: 285335 ms
Total hot run time: 2725 ms

@doris-robot
Copy link

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

query1	0.06	0.02	0.01
query2	0.10	0.00	0.01
query3	0.26	0.01	0.01
query4	1.76	0.01	0.01
query5	0.28	0.00	0.01
query6	1.66	0.01	0.00
query7	0.05	0.01	0.00
query8	0.06	0.00	0.01
query9	0.63	0.00	0.00
query10	0.60	0.00	0.00
query11	0.17	0.01	0.00
query12	0.16	0.00	0.00
query13	0.63	0.00	0.00
query14	1.05	0.00	0.00
query15	0.89	0.00	0.00
query16	0.41	0.01	0.00
query17	1.13	0.01	0.00
query18	0.22	0.01	0.00
query19	1.92	0.00	0.00
query20	0.03	0.00	0.00
query21	15.41	0.00	0.01
query22	6.22	0.00	0.00
query23	16.20	0.00	0.00
query24	1.48	0.00	0.00
query25	0.22	0.00	0.00
query26	0.18	0.00	0.00
query27	0.11	0.00	0.00
query28	1.17	0.00	0.00
query29	13.32	0.01	0.00
query30	0.31	0.00	0.00
query31	2.30	0.01	0.00
query32	5.93	0.00	0.01
query33	4.36	0.01	0.00
query34	7.17	0.00	0.00
query35	6.27	0.01	0.00
query36	0.70	0.00	0.00
query37	0.12	0.00	0.00
query38	0.07	0.00	0.01
query39	0.05	0.00	0.01
query40	0.17	0.00	0.01
query41	0.09	0.01	0.00
query42	0.07	0.00	0.00
query43	0.04	0.00	0.01
Total cold run time: 94.03 s
Total hot run time: 0.03 s

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 14.85% (15/101) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.34% (17601/33626)
Line Coverage 37.55% (159760/425416)
Region Coverage 32.11% (121726/379090)
Branch Coverage 33.45% (53386/159619)

@dwdwqfwe
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	6492	29	21	21
q2	558	26	25	25
q3	872	18	15	15
q4	949	17	15	15
q5	2259	21	15	15
q6	217	14	13	13
q7	927	23	21	21
q8	1194	19	13	13
q9	11699	13	11	11
q10	4776	15	13	13
q11	455	23	21	21
q12	313	13	12	12
q13	17616	14	12	12
q14	241	13	11	11
q15	624	12	11	11
q16	999	984	973	973
q17	545	14	12	12
q18	7522	13	12	12
q19	1069	12	12	12
q20	344	366	263	263
q21	3974	21	23	21
q22	1086	12	11	11
Total cold run time: 64731 ms
Total hot run time: 1533 ms

----- Round 2, with runtime_filter_mode=off -----
q1	12	12	11	11
q2	20	20	19	19
q3	11	11	12	11
q4	12	10	10	10
q5	11	11	11	11
q6	10	10	11	10
q7	19	19	19	19
q8	10	10	11	10
q9	10	10	10	10
q10	10	10	11	10
q11	19	19	19	19
q12	11	10	10	10
q13	10	10	10	10
q14	11	11	11	11
q15	11	10	10	10
q16	1078	1070	1045	1045
q17	11	11	10	10
q18	10	10	10	10
q19	11	11	10	10
q20	1860	2035	1859	1859
q21	20	19	19	19
q22	10	10	10	10
Total cold run time: 3187 ms
Total hot run time: 3144 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 2806 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 92074655a0eedf21b65aa7420f7622b94e2979d3, data reload: false

query1	1081	19	12	12
query2	7126	19	16	16
query3	7636	12	11	11
query4	26524	12	11	11
query5	4465	13	11	11
query6	370	10	10	10
query7	5448	11	10	10
query8	372	19	18	18
query9	9211	12	10	10
query10	730	11	9	9
query11	16430	12	11	11
query12	200	11	9	9
query13	1729	11	9	9
query14	12724	13	14	13
query15	389	11	11	11
query16	7744	11	10	10
query17	2161	10	9	9
query18	2991	10	10	10
query19	341	10	9	9
query20	153	10	10	10
query21	223	10	9	9
query22	4186	10	9	9
query23	33805	16	12	12
query24	10583	12	11	11
query25	759	10	9	9
query26	1824	10	9	9
query27	3385	10	9	9
query28	6214	12	9	9
query29	1722	10	8	8
query30	634	12	9	9
query31	1729	11	11	11
query32	121	11	9	9
query33	1336	11	10	10
query34	1626	815	542	542
query35	1025	11	10	10
query36	971	10	9	9
query37	243	10	8	8
query38	3584	10	9	9
query39	1525	733	748	733
query40	318	10	16	10
query41	79	12	11	11
query42	149	11	9	9
query43	481	10	8	8
query44	1330	10	10	10
query45	370	10	10	10
query46	1162	11	10	10
query47	1778	11	10	10
query48	404	10	10	10
query49	1296	11	11	11
query50	762	10	9	9
query51	3978	10	9	9
query52	126	10	10	10
query53	258	11	10	10
query54	735	11	11	11
query55	100	10	10	10
query56	353	11	12	11
query57	1242	10	10	10
query58	381	10	9	9
query59	2668	9	9	9
query60	378	10	9	9
query61	243	11	10	10
query62	840	10	9	9
query63	270	11	31	11
query64	5433	10	9	9
query65	4246	10	9	9
query66	1574	11	10	10
query67	16898	29	10	10
query68	3512	10	9	9
query69	507	11	10	10
query70	1401	9	9	9
query71	538	370	381	370
query72	7160	10	13	10
query73	583	10	9	9
query74	10131	11	12	11
query75	3454	11	10	10
query76	3220	9	13	9
query77	1112	11	10	10
query78	9702	11	9	9
query79	1024	10	12	10
query80	644	11	10	10
query81	591	10	10	10
query82	280	9	9	9
query83	318	11	11	11
query84	269	9	11	9
query85	971	12	9	9
query86	449	9	10	9
query87	3989	9	8	8
query88	2877	11	11	11
query89	395	10	9	9
query90	2487	9	9	9
query91	176	10	8	8
query92	103	9	9	9
query93	1066	10	9	9
query94	925	9	9	9
query95	523	10	9	9
query96	434	10	9	9
query97	3074	9	8	8
query98	257	227	267	227
query99	1570	11	10	10
Total cold run time: 294914 ms
Total hot run time: 2806 ms

@doris-robot
Copy link

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

query1	0.06	0.02	0.00
query2	0.10	0.01	0.00
query3	0.27	0.01	0.01
query4	1.79	0.00	0.01
query5	0.28	0.01	0.01
query6	1.68	0.01	0.00
query7	0.05	0.01	0.00
query8	0.06	0.01	0.00
query9	0.63	0.00	0.00
query10	0.60	0.01	0.01
query11	0.18	0.01	0.01
query12	0.16	0.01	0.01
query13	0.63	0.00	0.01
query14	1.02	0.00	0.00
query15	0.90	0.00	0.01
query16	0.43	0.00	0.00
query17	1.06	0.00	0.01
query18	0.21	0.01	0.01
query19	1.95	0.00	0.01
query20	0.02	0.01	0.01
query21	15.41	0.01	0.01
query22	6.60	0.01	0.00
query23	15.91	0.00	0.00
query24	1.49	0.00	0.01
query25	0.21	0.01	0.00
query26	0.17	0.00	0.00
query27	0.11	0.00	0.01
query28	1.35	0.00	0.00
query29	13.17	0.00	0.00
query30	0.31	0.00	0.00
query31	2.25	0.00	0.00
query32	5.92	0.00	0.00
query33	4.40	0.02	0.00
query34	7.22	0.01	0.00
query35	6.37	0.01	0.00
query36	0.68	0.00	0.00
query37	0.11	0.00	0.00
query38	0.08	0.00	0.01
query39	0.05	0.00	0.00
query40	0.18	0.00	0.00
query41	0.11	0.00	0.00
query42	0.07	0.00	0.00
query43	0.05	0.01	0.01
Total cold run time: 94.3 s
Total hot run time: 0.09 s

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 15.46% (15/97) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.33% (17599/33630)
Line Coverage 37.55% (159707/425276)
Region Coverage 32.12% (121722/378995)
Branch Coverage 33.45% (53325/159407)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 78.35% (76/97) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.12% (23376/32869)
Line Coverage 57.53% (244132/424383)
Region Coverage 53.00% (203619/384169)
Branch Coverage 54.56% (87377/160144)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 85.71% (24/28) 🎉
Increment coverage report
Complete coverage report

};

template <PrimitiveType PType, typename Impl>
struct TimeComputeImpl {
Copy link
Contributor

Choose a reason for hiding this comment

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

这一层模板可以去掉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

两个模板参数继承不了虚函数create

DateV2Value<DateTimeV2ValueType> dtv1 =
binary_cast<InputType1, DateV2Value<DateTimeV2ValueType>>(arg1);
auto tv2 = static_cast<TimeValue::TimeType>(arg2);
bool neg = std::string_view(name) == "sub_time";
Copy link
Contributor

Choose a reason for hiding this comment

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

不要依赖名字,给Impl类加个neg

double res = TimeValue::limit_with_bound(neg ? tv1 - tv2 : tv1 + tv2);
return res;
} else {
throw Exception(ErrorCode::INVALID_ARGUMENT, "not support type for function {}", name);
Copy link
Contributor

Choose a reason for hiding this comment

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

走到这说明FE和BE没对上,是INTERNAL_ERROR。INVALID_ARGUMENT代表用户输入能够造成的问题

res_data[i] = transform.execute(left_value, right_col[i]);
}
}
void execute_constant_constant(const NativeType1 left_value, const NativeType2 right_value,
Copy link
Contributor

Choose a reason for hiding this comment

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

这个情况不存在

Copy link
Contributor

Choose a reason for hiding this comment

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

再测一下两个参数都带精度,精度不同的情况,分别在FE和BE执行,确认规划正常。

Copy link
Contributor

Choose a reason for hiding this comment

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

加一下建表测试。vector和const的情况

ComputeSignatureForDateArithmetic, PropagateNullable, DateAddSubMonotonic {

private static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT,
Copy link
Contributor

Choose a reason for hiding this comment

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

得同时兼容两种格式,参照ComputeSignatureForDateArithmetic实现一个ComputeSignatureForTimeArithmetic吧,这个顺序不变,但literal情况优先匹配到timev2。

using NativeType2 = typename Transform::InputType2;
using ReturnNativeType = typename Transform::ReturnNativeType;
static constexpr auto name = Transform::name;
static constexpr bool has_variadic_argument =
Copy link
Contributor

Choose a reason for hiding this comment

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

这里不用这些判断,这个基模板的实现模板是固定的,has_variadic_argument就是true。

@dwdwqfwe
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 5.41% (2/37) 🎉
Increment coverage report
Complete coverage report

@dwdwqfwe
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

query1	0.06	0.04	0.04
query2	0.09	0.05	0.06
query3	0.26	0.10	0.09
query4	1.61	0.13	0.11
query5	0.27	0.26	0.24
query6	1.20	0.66	0.64
query7	0.04	0.03	0.02
query8	0.06	0.04	0.05
query9	0.64	0.55	0.51
query10	0.60	0.58	0.56
query11	0.16	0.12	0.11
query12	0.14	0.12	0.12
query13	0.63	0.63	0.62
query14	1.01	1.01	1.00
query15	0.87	0.86	0.86
query16	0.40	0.40	0.39
query17	1.01	1.08	1.07
query18	0.22	0.20	0.20
query19	1.98	1.88	1.87
query20	0.02	0.01	0.02
query21	15.43	0.92	0.59
query22	0.78	1.12	0.64
query23	15.05	1.37	0.61
query24	7.62	0.77	0.84
query25	0.52	0.22	0.06
query26	0.52	0.17	0.14
query27	0.06	0.05	0.05
query28	9.59	1.36	0.92
query29	12.55	3.90	3.23
query30	0.28	0.14	0.11
query31	2.82	0.60	0.38
query32	3.27	0.55	0.48
query33	3.04	3.22	3.05
query34	16.14	5.51	4.85
query35	4.96	4.94	4.90
query36	0.67	0.50	0.54
query37	0.10	0.08	0.07
query38	0.06	0.04	0.05
query39	0.04	0.03	0.03
query40	0.18	0.16	0.13
query41	0.09	0.04	0.03
query42	0.04	0.03	0.04
query43	0.04	0.04	0.03
Total cold run time: 105.12 s
Total hot run time: 30.19 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 5.41% (2/37) 🎉
Increment coverage report
Complete coverage report

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 13.33% (10/75) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.38% (17617/33632)
Line Coverage 37.61% (160028/425490)
Region Coverage 32.16% (122026/379467)
Branch Coverage 33.51% (53521/159736)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 78.38% (29/37) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 89.33% (67/75) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.14% (23360/32836)
Line Coverage 57.53% (244111/424335)
Region Coverage 52.88% (203324/384498)
Branch Coverage 54.55% (87483/160385)

@dwdwqfwe
Copy link
Contributor Author

run p0

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 89.33% (67/75) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.14% (23360/32836)
Line Coverage 57.53% (244116/424335)
Region Coverage 52.88% (203310/384498)
Branch Coverage 54.55% (87486/160385)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 78.38% (29/37) 🎉
Increment coverage report
Complete coverage report

* <p>
* Note: Please ensure that this class only has some lists and no procedural code.
* Note: Please ensure that this class only has some lists and no procedural
* code.
Copy link
Contributor

Choose a reason for hiding this comment

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

dont format irrelative code

Copy link
Contributor

Choose a reason for hiding this comment

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

加一下建表测试。vector和const的情况

} else if constexpr (PType == TYPE_TIMEV2) {
auto tv1 = static_cast<TimeValue::TimeType>(arg1);
auto tv2 = static_cast<TimeValue::TimeType>(arg2);
bool neg = std::string_view(name) == "sub_time";
Copy link
Contributor

Choose a reason for hiding this comment

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

这个忘改了

double res = TimeValue::limit_with_bound(neg ? tv1 - tv2 : tv1 + tv2);
return res;
} else {
throw Exception(ErrorCode::INTERNAL_ERROR, "not support type for function {}", name);
Copy link
Contributor

Choose a reason for hiding this comment

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

FatalError

auto tv2 = static_cast<TimeValue::TimeType>(arg2);
TimeInterval interval(TimeUnit::MICROSECOND, tv2, Impl::is_negative());
bool out_range = dtv1.template date_add_interval<TimeUnit::MICROSECOND>(interval);
if (!out_range) {
Copy link
Contributor

Choose a reason for hiding this comment

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

unlikely

@dwdwqfwe
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.10	0.06	0.06
query3	0.25	0.08	0.08
query4	1.62	0.12	0.11
query5	0.28	0.26	0.26
query6	1.17	0.65	0.65
query7	0.03	0.02	0.03
query8	0.05	0.04	0.04
query9	0.63	0.53	0.52
query10	0.59	0.57	0.57
query11	0.16	0.11	0.12
query12	0.16	0.12	0.12
query13	0.63	0.61	0.62
query14	1.03	1.04	1.03
query15	0.87	0.87	0.86
query16	0.40	0.41	0.39
query17	1.04	1.08	1.05
query18	0.21	0.21	0.20
query19	1.94	1.85	1.81
query20	0.02	0.01	0.01
query21	15.42	0.93	0.57
query22	0.76	1.31	0.62
query23	14.90	1.41	0.65
query24	6.74	1.16	1.09
query25	0.47	0.21	0.09
query26	0.61	0.16	0.13
query27	0.06	0.05	0.05
query28	10.16	1.38	0.93
query29	12.55	3.96	3.28
query30	0.27	0.13	0.11
query31	2.83	0.60	0.39
query32	3.23	0.57	0.47
query33	3.03	3.00	3.13
query34	16.13	5.47	4.91
query35	4.90	4.90	4.88
query36	0.69	0.50	0.49
query37	0.10	0.07	0.08
query38	0.06	0.05	0.04
query39	0.03	0.04	0.03
query40	0.18	0.15	0.14
query41	0.08	0.04	0.03
query42	0.04	0.03	0.02
query43	0.05	0.03	0.03
Total cold run time: 104.53 s
Total hot run time: 30.57 s

@zclllyybb zclllyybb requested a review from morrySnow September 28, 2025 03:43
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 28, 2025
Copy link
Contributor

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

Copy link
Contributor

PR approved by anyone and no changes requested.

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 13.51% (10/74) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.37% (17613/33634)
Line Coverage 37.59% (159974/425579)
Region Coverage 32.12% (121911/379496)
Branch Coverage 33.49% (53507/159764)


@Override
default FunctionSignature computeSignature(FunctionSignature signature) {
FunctionSignature ret = ComputeSignature.super.computeSignature(signature);
Copy link
Contributor

Choose a reason for hiding this comment

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

why compute this first?

try {
String s = ((StringLikeLiteral) child(0)).getStringValue().trim();
// check if the string is in the format of HH:MM:SS[.FFFFFF]
if (!s.contains("-")) { // avoid matching datetime format
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we support 2008/08/08 too, why just process '-' here?

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 89.19% (66/74) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.16% (23366/32838)
Line Coverage 57.51% (244103/424424)
Region Coverage 52.82% (203123/384527)
Branch Coverage 54.51% (87434/160413)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 78.38% (29/37) 🎉
Increment coverage report
Complete coverage report

@dwdwqfwe
Copy link
Contributor Author

run buildall

String numberPart = parts[0];

int length = numberPart.length();
if (length < 7) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why less? like 2001234, is also valid


// Split time part
String[] timeFields = timePart.split(":");
if (timeFields[0].length() == 2 || timeFields[0].length() == 3 || timePart.length() < 8) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why timeFields[0].length() == 2? datetime also accepts it

@dwdwqfwe
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 13.51% (10/74) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.42% (17652/33671)
Line Coverage 37.63% (160293/425938)
Region Coverage 32.14% (122285/380502)
Branch Coverage 33.52% (53631/159977)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 13.51% (10/74) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 54.57% (17935/32869)
Line Coverage 39.76% (168868/424767)
Region Coverage 33.72% (129778/384909)
Branch Coverage 34.93% (56084/160570)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 4.41% (3/68) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 13.51% (10/74) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 56.71% (18639/32869)
Line Coverage 41.99% (178342/424767)
Region Coverage 36.60% (140863/384909)
Branch Coverage 37.60% (60376/160570)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 4.41% (3/68) 🎉
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

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants