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

[feature](functions) impl scalar functions normal_cdf,to_iso8601,from_iso8601_date #40695

Merged
merged 6 commits into from
Sep 20, 2024

Conversation

hubgeter
Copy link
Contributor

@hubgeter hubgeter commented Sep 11, 2024

Proposed changes

Added three functions: normal_cdf, to_iso8601, from_iso8601_date

  1. normal_cdf(mean, sd, v) → double :
    Compute the Normal cdf with given mean and standard deviation (sd): P(N < value; mean, sd). The mean and value must be real values and the standard deviation must be a real and positive value (all of type DOUBLE).

  2. to_iso8601(DATE/DATETIME) → string
    For DATE type, it will be converted to YYYY-MM-DD.
    For DATETIME type, it will be converted to YYYY-MM-DDThh:mm:ss.xxxxxx.

  3. from_iso8601_date(string) → DATE
    Convert iso8601 string to DATE type.
    The supported iso8601 string formats are as follows:
    a. Year : YYYY
    b. Calendar dates : YYYY-MM-DD , YYYYMMDD , YYYY-MM
    c. Week dates : YYYY-Www , YYYYWww , YYYY-Www-D , YYYYWwwD
    d. Ordinal dates : YYYY-DDD , YYYYDDD
    You can refer to this document to understand what these formats mean
    Please note that:
    a. Each date and time value has a fixed number of digits that must be padded with leading zeros.
    b. The range of YYYY is 0001-9999.
    outside these rules, the correctness of the results is not guaranteed.

For illegal values, the result is NULL.

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@hubgeter
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17627	4689	4363	4363
q2	2037	195	181	181
q3	10460	1187	1053	1053
q4	10489	781	665	665
q5	8075	2945	2869	2869
q6	234	143	145	143
q7	975	627	634	627
q8	9925	2129	2085	2085
q9	7603	6561	6562	6561
q10	6994	2249	2191	2191
q11	444	251	246	246
q12	415	231	223	223
q13	18811	3118	3112	3112
q14	295	234	254	234
q15	541	503	499	499
q16	540	437	439	437
q17	973	724	704	704
q18	7469	7023	6979	6979
q19	1392	931	980	931
q20	709	336	341	336
q21	3983	3047	2957	2957
q22	1098	1005	999	999
Total cold run time: 111089 ms
Total hot run time: 38395 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4362	4324	4286	4286
q2	378	280	273	273
q3	2900	2671	2713	2671
q4	1913	1657	1630	1630
q5	5417	5446	5445	5445
q6	250	130	128	128
q7	2134	1754	1737	1737
q8	3225	3366	3366	3366
q9	8472	8491	8493	8491
q10	3472	3207	3196	3196
q11	586	487	517	487
q12	807	611	614	611
q13	10526	3092	3059	3059
q14	291	271	277	271
q15	514	491	469	469
q16	521	482	489	482
q17	1800	1498	1481	1481
q18	7731	7507	7705	7507
q19	1650	1530	1414	1414
q20	2092	1810	1828	1810
q21	5460	5253	5251	5251
q22	1115	981	1007	981
Total cold run time: 65616 ms
Total hot run time: 55046 ms

@doris-robot
Copy link

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

query1	925	373	369	369
query2	6486	1876	1783	1783
query3	6653	224	218	218
query4	31431	23239	23383	23239
query5	4161	505	484	484
query6	258	177	166	166
query7	4584	292	294	292
query8	284	228	238	228
query9	8456	2491	2521	2491
query10	440	263	271	263
query11	17843	15069	15151	15069
query12	152	98	100	98
query13	1623	384	373	373
query14	9530	7159	7226	7159
query15	265	165	177	165
query16	8085	468	470	468
query17	1568	569	546	546
query18	2147	296	299	296
query19	351	155	155	155
query20	124	111	116	111
query21	211	105	106	105
query22	4494	4282	4395	4282
query23	34373	33772	33521	33521
query24	11032	3015	2913	2913
query25	642	418	415	415
query26	1372	158	162	158
query27	2816	283	283	283
query28	7661	2055	2047	2047
query29	889	425	446	425
query30	313	160	158	158
query31	979	789	787	787
query32	107	64	62	62
query33	819	301	284	284
query34	961	492	483	483
query35	830	731	718	718
query36	1126	952	951	951
query37	156	87	85	85
query38	4080	3896	3883	3883
query39	1440	1418	1390	1390
query40	265	118	116	116
query41	50	46	46	46
query42	117	96	99	96
query43	508	465	473	465
query44	1209	773	736	736
query45	197	168	167	167
query46	1097	731	770	731
query47	1916	1799	1828	1799
query48	377	288	289	288
query49	1100	443	458	443
query50	802	405	427	405
query51	7052	6884	6913	6884
query52	101	86	90	86
query53	256	187	184	184
query54	978	455	443	443
query55	79	75	78	75
query56	280	258	261	258
query57	1243	1085	1053	1053
query58	240	267	253	253
query59	2917	2917	2871	2871
query60	290	269	262	262
query61	106	104	100	100
query62	873	658	653	653
query63	226	190	189	189
query64	5360	703	651	651
query65	3232	3147	3177	3147
query66	1433	334	337	334
query67	16062	15245	15229	15229
query68	3115	847	835	835
query69	431	319	318	318
query70	1141	1198	1166	1166
query71	348	335	333	333
query72	6130	3515	3423	3423
query73	584	585	574	574
query74	8993	8916	8954	8916
query75	3157	2913	2985	2913
query76	1867	832	819	819
query77	492	405	455	405
query78	10470	9232	9315	9232
query79	863	859	850	850
query80	827	806	796	796
query81	447	261	265	261
query82	267	259	265	259
query83	192	198	195	195
query84	237	107	107	107
query85	658	395	386	386
query86	309	320	314	314
query87	4361	4286	4250	4250
query88	4249	4044	4024	4024
query89	370	359	359	359
query90	1508	322	314	314
query91	125	128	127	127
query92	87	78	75	75
query93	894	913	893	893
query94	593	426	352	352
query95	422	409	415	409
query96	466	465	462	462
query97	3081	3051	3120	3051
query98	235	227	246	227
query99	1506	1272	1261	1261
Total cold run time: 286458 ms
Total hot run time: 192793 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.03
query2	0.08	0.04	0.04
query3	0.23	0.05	0.05
query4	1.67	0.08	0.09
query5	0.52	0.49	0.51
query6	1.13	0.76	0.73
query7	0.02	0.01	0.02
query8	0.04	0.05	0.05
query9	0.54	0.49	0.49
query10	0.54	0.55	0.55
query11	0.15	0.11	0.12
query12	0.15	0.12	0.12
query13	0.61	0.60	0.59
query14	1.39	1.42	1.43
query15	0.84	0.83	0.84
query16	0.37	0.37	0.38
query17	0.99	1.09	1.05
query18	0.20	0.22	0.19
query19	1.98	1.81	1.84
query20	0.01	0.01	0.02
query21	15.40	0.68	0.67
query22	3.89	7.87	2.43
query23	18.29	1.40	1.25
query24	2.12	0.21	0.22
query25	0.15	0.08	0.08
query26	0.27	0.18	0.18
query27	0.08	0.08	0.08
query28	13.26	1.02	1.01
query29	12.62	3.31	3.30
query30	0.25	0.05	0.05
query31	2.89	0.41	0.40
query32	3.23	0.48	0.48
query33	3.00	3.02	3.02
query34	17.02	4.46	4.42
query35	4.40	4.44	4.46
query36	0.66	0.47	0.50
query37	0.18	0.16	0.16
query38	0.17	0.15	0.16
query39	0.05	0.04	0.04
query40	0.17	0.14	0.13
query41	0.08	0.05	0.05
query42	0.06	0.04	0.04
query43	0.05	0.04	0.04
Total cold run time: 109.8 s
Total hot run time: 32.12 s

@hubgeter
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17641	4951	4292	4292
q2	2020	200	185	185
q3	11618	934	1190	934
q4	10521	710	728	710
q5	7765	2891	2793	2793
q6	227	135	136	135
q7	965	621	598	598
q8	9317	2075	2070	2070
q9	7334	6533	6569	6533
q10	6991	2209	2266	2209
q11	436	236	235	235
q12	398	216	219	216
q13	17931	3113	3094	3094
q14	280	229	244	229
q15	530	491	479	479
q16	518	434	424	424
q17	974	701	682	682
q18	7334	6888	6830	6830
q19	1398	1122	1050	1050
q20	669	328	331	328
q21	3934	3004	2960	2960
q22	1144	1024	995	995
Total cold run time: 109945 ms
Total hot run time: 37981 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4336	4300	4306	4300
q2	382	287	272	272
q3	2898	2666	2626	2626
q4	1909	1682	1616	1616
q5	5647	5700	5726	5700
q6	237	135	131	131
q7	2219	1786	1839	1786
q8	3299	3439	3442	3439
q9	8845	8886	8871	8871
q10	3543	3319	3413	3319
q11	612	531	511	511
q12	838	637	662	637
q13	15684	3206	3305	3206
q14	323	291	288	288
q15	529	494	485	485
q16	540	482	485	482
q17	1810	1544	1575	1544
q18	8232	7927	7910	7910
q19	1727	1552	1626	1552
q20	2171	1886	1930	1886
q21	5804	5552	5305	5305
q22	1108	1033	1027	1027
Total cold run time: 72693 ms
Total hot run time: 56893 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 198063 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 77ebd97cd88a434772959aaea7b2077ee2bf7e77, data reload: false

query1	1267	896	878	878
query2	6289	1948	1930	1930
query3	10609	3887	4104	3887
query4	59884	29272	23463	23463
query5	5009	486	505	486
query6	398	162	158	158
query7	5597	296	287	287
query8	334	212	207	207
query9	7889	2503	2498	2498
query10	408	279	277	277
query11	15808	15057	15414	15057
query12	149	107	101	101
query13	1446	396	366	366
query14	10621	7391	7356	7356
query15	221	179	169	169
query16	6856	464	447	447
query17	1080	581	550	550
query18	1600	300	289	289
query19	196	152	148	148
query20	119	112	110	110
query21	210	108	106	106
query22	4536	4380	4380	4380
query23	34308	33757	33766	33757
query24	5987	2853	2871	2853
query25	508	409	399	399
query26	616	153	154	153
query27	1602	274	284	274
query28	3680	2047	2035	2035
query29	670	432	433	432
query30	240	158	155	155
query31	942	759	764	759
query32	73	55	59	55
query33	426	298	289	289
query34	876	472	474	472
query35	847	713	736	713
query36	1082	938	953	938
query37	152	87	95	87
query38	4021	3856	3978	3856
query39	1455	1407	1398	1398
query40	198	117	115	115
query41	50	48	47	47
query42	112	99	98	98
query43	515	485	464	464
query44	1111	752	737	737
query45	204	167	172	167
query46	1097	765	730	730
query47	1867	1768	1804	1768
query48	375	301	287	287
query49	786	452	459	452
query50	855	422	422	422
query51	7107	6777	6821	6777
query52	102	90	90	90
query53	249	181	190	181
query54	577	462	457	457
query55	77	81	78	78
query56	302	270	282	270
query57	1200	1091	1088	1088
query58	235	238	314	238
query59	3119	2931	2928	2928
query60	289	267	269	267
query61	104	102	99	99
query62	758	661	684	661
query63	220	187	183	183
query64	1405	692	691	691
query65	3252	3144	3157	3144
query66	685	333	349	333
query67	15678	15440	15080	15080
query68	1929	844	837	837
query69	421	330	323	323
query70	1185	1187	1215	1187
query71	350	342	345	342
query72	4600	3559	3743	3559
query73	585	574	578	574
query74	9307	8924	8869	8869
query75	3086	2937	2957	2937
query76	1086	877	860	860
query77	522	399	402	399
query78	9458	9291	9659	9291
query79	908	866	859	859
query80	809	852	824	824
query81	444	311	262	262
query82	266	264	265	264
query83	188	188	190	188
query84	205	106	106	106
query85	618	414	390	390
query86	324	311	308	308
query87	4334	4371	4336	4336
query88	4309	4080	4066	4066
query89	375	369	369	369
query90	1488	316	312	312
query91	122	169	122	122
query92	82	75	76	75
query93	928	913	908	908
query94	526	359	359	359
query95	436	417	415	415
query96	473	472	473	472
query97	3148	3104	3108	3104
query98	224	236	225	225
query99	1304	1294	1295	1294
Total cold run time: 294580 ms
Total hot run time: 198063 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.08	0.04	0.04
query3	0.22	0.06	0.06
query4	1.65	0.08	0.09
query5	0.51	0.52	0.51
query6	1.13	0.75	0.73
query7	0.02	0.01	0.01
query8	0.06	0.05	0.04
query9	0.55	0.50	0.49
query10	0.54	0.57	0.55
query11	0.16	0.11	0.11
query12	0.15	0.12	0.12
query13	0.60	0.59	0.59
query14	1.40	1.43	1.43
query15	0.86	0.82	0.83
query16	0.37	0.38	0.37
query17	0.97	1.02	1.07
query18	0.18	0.18	0.18
query19	1.95	1.87	1.86
query20	0.01	0.01	0.01
query21	15.40	0.67	0.66
query22	4.17	7.87	1.57
query23	18.31	1.29	1.26
query24	2.11	0.22	0.20
query25	0.15	0.08	0.08
query26	0.26	0.19	0.18
query27	0.07	0.07	0.08
query28	13.25	1.02	1.00
query29	12.61	3.33	3.29
query30	0.25	0.05	0.06
query31	2.86	0.40	0.40
query32	3.23	0.48	0.49
query33	3.01	2.99	3.03
query34	17.13	4.38	4.42
query35	4.42	4.45	4.49
query36	0.66	0.49	0.49
query37	0.19	0.16	0.15
query38	0.16	0.15	0.14
query39	0.05	0.04	0.04
query40	0.16	0.13	0.13
query41	0.09	0.05	0.05
query42	0.06	0.05	0.05
query43	0.04	0.03	0.04
Total cold run time: 110.1 s
Total hot run time: 31.2 s

Comment on lines 45 to 47
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateV2Type.INSTANCE),
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateTimeType.INSTANCE),
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(DateType.INSTANCE),
FunctionSignature.ret(StringType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(StringType.INSTANCE).args(DateV2Type.INSTANCE),
FunctionSignature.ret(StringType.INSTANCE).args(DateTimeType.INSTANCE),
FunctionSignature.ret(StringType.INSTANCE).args(DateType.INSTANCE)
Copy link
Contributor

Choose a reason for hiding this comment

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

should only return string or varchar. just like c/c++ ret type is not a part of function's signature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will fix it

* ScalarFunction 'to_iso8601'. This class is generated by GenerateFunction.
*/
public class ToIso8601 extends ScalarFunction
implements UnaryExpression, ExplicitlyCastableSignature, PropagateNullableOnDateLikeV2Args {
Copy link
Contributor

Choose a reason for hiding this comment

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

why use PropagateNullableOnDateLikeV2Args? this is a new function should have same nullable property for date/datetime v1 and date/datetime v2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will fix it.

@@ -901,6 +904,18 @@ default R visitConnectionId(ConnectionId connectionId, C context) {
return visitScalarFunction(connectionId, context);
}

default R visitNormalCdf(NormalCdf normalCdf, C context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

please sort by lexicographical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will fix it

size_t result, size_t input_rows_count) {
const auto* src_column_ptr = block.get_by_position(arguments[0]).column.get();

std::regex calendar_regex(R"((\d{4})(-)?(\d{2})(-)?(\d{2}))"); // YYYY-MM-DD or YYYYMMDD
Copy link
Contributor

Choose a reason for hiding this comment

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

never use std::regex, it's worse than RE2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will change it.

int day_of_year = std::stoi(match[3]);

if (is_leap(year)) {
if (day_of_year < 0 || day_of_year > 366) {
Copy link
Contributor

Choose a reason for hiding this comment

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

better for judgement like this, set it to [[unlikely]]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will add it

struct FromIso8601DateV2 {
static constexpr auto name = "from_iso8601_date";

static bool is_variadic() { return true; } //todo : check is or not is_variadic
Copy link
Contributor

Choose a reason for hiding this comment

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

does this function support variadic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

don't support variadic. I forgot to delete this line.

Comment on lines 355 to 369
static constexpr auto name = "normal_cdf";
String get_name() const override { return name; }
static FunctionPtr create() { return std::make_shared<FunctionNormalCdf>(); }
DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
return make_nullable(std::make_shared<DataTypeFloat64>());
}
DataTypes get_variadic_argument_types_impl() const override {
return {std::make_shared<DataTypeFloat64>(), std::make_shared<DataTypeFloat64>(),
std::make_shared<DataTypeFloat64>()};
}
size_t get_number_of_arguments() const override { return 3; }
Copy link
Contributor

Choose a reason for hiding this comment

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

better add blank line between functions/variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will add it

Comment on lines 1202 to 1207
std::regex calendar_regex(R"((\d{4})(-)?(\d{2})(-)?(\d{2}))"); // YYYY-MM-DD or YYYYMMDD
std::regex year_month_regex(R"((\d{4})-(\d{2}))"); // YYYY-MM
std::regex year_only_regex(R"((\d{4}))"); // YYYY
std::regex week_regex(
R"((\d{4})(-)?W(\d{2})(-)?(\d)?)"); // YYYY-Www or YYYY-Www-D or YYYYWww or YYYYWwwD
std::regex day_of_year_regex(R"((\d{4})(-)?(\d{3}))"); // YYYY-DDD or YYYYDDD
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider add const for them and move outside of execute() to improve the efficiency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will use static const to fix it.

@hubgeter hubgeter force-pushed the support_trino_func branch 2 times, most recently from b212b6c to 3cb8dde Compare September 12, 2024 11:27
@hubgeter
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17617	7360	7271	7271
q2	2030	211	189	189
q3	10449	1346	1374	1346
q4	10148	924	989	924
q5	7737	3182	3159	3159
q6	234	157	152	152
q7	1051	624	610	610
q8	9671	2057	2041	2041
q9	6884	6281	6281	6281
q10	7022	2521	2519	2519
q11	440	260	252	252
q12	408	227	227	227
q13	17768	3049	3006	3006
q14	289	255	253	253
q15	591	527	532	527
q16	522	422	434	422
q17	1004	953	950	950
q18	7341	6773	6784	6773
q19	1385	1238	1238	1238
q20	606	333	327	327
q21	3910	3545	3535	3535
q22	1085	990	1026	990
Total cold run time: 108192 ms
Total hot run time: 42992 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7223	7188	7160	7160
q2	345	245	239	239
q3	2898	2905	2883	2883
q4	1949	1973	1952	1952
q5	5431	5415	5384	5384
q6	233	145	143	143
q7	2041	1673	1668	1668
q8	3234	3297	3302	3297
q9	8382	8415	8428	8415
q10	3395	3442	3451	3442
q11	564	464	469	464
q12	757	592	608	592
q13	8604	3042	3015	3015
q14	302	266	266	266
q15	570	526	522	522
q16	507	461	454	454
q17	1757	1715	1704	1704
q18	8078	7710	7460	7460
q19	1724	1704	1702	1702
q20	2040	1793	1805	1793
q21	5628	5391	5490	5391
q22	1114	995	1026	995
Total cold run time: 66776 ms
Total hot run time: 58941 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 195634 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 3cb8ddea8c7e72d46dea44650da862f57f2d7709, data reload: false

query1	946	378	392	378
query2	6488	1834	1833	1833
query3	6656	212	224	212
query4	25853	24118	23975	23975
query5	5151	546	544	544
query6	265	180	173	173
query7	4593	306	305	305
query8	292	221	247	221
query9	8483	2591	2583	2583
query10	457	296	290	290
query11	16146	15559	15652	15559
query12	165	104	104	104
query13	1676	397	385	385
query14	11093	6780	6678	6678
query15	222	176	180	176
query16	7574	451	458	451
query17	1372	584	573	573
query18	1962	294	290	290
query19	199	157	147	147
query20	120	112	112	112
query21	209	107	104	104
query22	4650	4401	4481	4401
query23	34557	33750	34014	33750
query24	10528	3194	3082	3082
query25	682	415	414	414
query26	1526	161	160	160
query27	2937	289	287	287
query28	6967	2086	2081	2081
query29	1052	432	431	431
query30	306	162	156	156
query31	1006	781	777	777
query32	110	58	57	57
query33	739	306	306	306
query34	917	492	486	486
query35	899	753	747	747
query36	1062	904	889	889
query37	171	85	84	84
query38	3961	3857	3922	3857
query39	1477	1400	1448	1400
query40	295	120	119	119
query41	50	47	50	47
query42	120	102	98	98
query43	492	457	444	444
query44	1272	819	790	790
query45	199	172	173	172
query46	1119	856	838	838
query47	1904	1826	1824	1824
query48	388	303	301	301
query49	1225	461	457	457
query50	916	438	446	438
query51	7150	7048	6968	6968
query52	101	87	88	87
query53	261	189	188	188
query54	805	473	474	473
query55	83	82	79	79
query56	292	278	281	278
query57	1212	1099	1100	1099
query58	262	249	239	239
query59	2889	2659	2526	2526
query60	318	288	288	288
query61	219	107	105	105
query62	925	692	690	690
query63	215	189	186	186
query64	5221	703	684	684
query65	3255	3178	3168	3168
query66	1405	294	295	294
query67	16236	15609	15637	15609
query68	3907	861	851	851
query69	448	333	333	333
query70	1176	1125	1134	1125
query71	367	344	339	339
query72	6176	3470	3365	3365
query73	594	586	585	585
query74	9246	9091	9191	9091
query75	3138	3035	2983	2983
query76	2375	830	842	830
query77	431	402	402	402
query78	9339	9636	9293	9293
query79	937	906	886	886
query80	867	835	813	813
query81	460	271	266	266
query82	268	258	263	258
query83	190	190	199	190
query84	231	112	109	109
query85	681	452	393	393
query86	317	290	316	290
query87	4484	4329	4380	4329
query88	4185	4123	4133	4123
query89	374	362	378	362
query90	1284	327	317	317
query91	125	124	129	124
query92	86	80	75	75
query93	1041	1058	1040	1040
query94	641	364	359	359
query95	456	417	421	417
query96	472	474	469	469
query97	3107	3133	3155	3133
query98	227	228	219	219
query99	1572	1318	1318	1318
Total cold run time: 281500 ms
Total hot run time: 195634 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.88% (9465/25662)
Line Coverage: 28.23% (77777/275504)
Region Coverage: 27.64% (40169/145341)
Branch Coverage: 24.24% (20408/84178)
Coverage Report: http://coverage.selectdb-in.cc/coverage/3cb8ddea8c7e72d46dea44650da862f57f2d7709_3cb8ddea8c7e72d46dea44650da862f57f2d7709/report/index.html

@doris-robot
Copy link

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

query1	0.05	0.05	0.04
query2	0.07	0.04	0.04
query3	0.22	0.05	0.05
query4	1.68	0.07	0.07
query5	0.50	0.49	0.50
query6	1.15	0.73	0.73
query7	0.02	0.01	0.01
query8	0.05	0.04	0.04
query9	0.57	0.52	0.53
query10	0.57	0.56	0.57
query11	0.16	0.12	0.12
query12	0.16	0.13	0.13
query13	0.62	0.61	0.60
query14	1.46	1.47	1.49
query15	0.90	0.87	0.87
query16	0.37	0.36	0.37
query17	1.03	1.05	1.03
query18	0.21	0.20	0.20
query19	1.92	1.81	1.84
query20	0.01	0.00	0.01
query21	15.40	0.66	0.65
query22	3.84	7.92	1.14
query23	17.89	1.43	1.43
query24	2.27	0.22	0.22
query25	0.18	0.08	0.07
query26	0.29	0.19	0.17
query27	0.08	0.08	0.08
query28	13.17	1.14	1.09
query29	12.49	3.34	3.37
query30	0.25	0.05	0.06
query31	2.87	0.42	0.41
query32	3.22	0.49	0.50
query33	3.01	3.03	3.07
query34	15.45	4.30	4.34
query35	4.37	4.36	4.33
query36	0.69	0.49	0.50
query37	0.19	0.17	0.17
query38	0.16	0.15	0.16
query39	0.04	0.04	0.04
query40	0.17	0.14	0.14
query41	0.11	0.05	0.05
query42	0.06	0.05	0.06
query43	0.05	0.04	0.04
Total cold run time: 107.97 s
Total hot run time: 31.07 s

@hubgeter hubgeter force-pushed the support_trino_func branch 2 times, most recently from 0dce774 to e56b87e Compare September 12, 2024 14:30
@hubgeter
Copy link
Contributor Author

run buildall

@hubgeter hubgeter force-pushed the support_trino_func branch 2 times, most recently from 02aa222 to d13fe4a Compare September 12, 2024 14:45
@hubgeter
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17606	8434	7290	7290
q2	2022	193	180	180
q3	10610	1422	1407	1407
q4	11832	1016	1070	1016
q5	7801	3259	3209	3209
q6	256	163	165	163
q7	1063	669	663	663
q8	9961	2078	2062	2062
q9	7012	6379	6388	6379
q10	7026	2533	2520	2520
q11	431	260	259	259
q12	427	248	237	237
q13	17765	3017	3073	3017
q14	291	254	266	254
q15	591	550	529	529
q16	542	445	433	433
q17	1020	967	960	960
q18	7506	6687	6735	6687
q19	1376	1233	1230	1230
q20	617	358	339	339
q21	4044	3602	3572	3572
q22	1084	1008	1036	1008
Total cold run time: 110883 ms
Total hot run time: 43414 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7240	7204	7179	7179
q2	335	230	238	230
q3	2947	2937	2908	2908
q4	2007	1966	2027	1966
q5	5471	5423	5439	5423
q6	235	150	152	150
q7	2051	1690	1651	1651
q8	3233	3329	3302	3302
q9	8417	8423	8451	8423
q10	3416	3465	3450	3450
q11	578	471	479	471
q12	784	597	599	597
q13	6998	3054	3081	3054
q14	317	285	285	285
q15	575	523	515	515
q16	501	451	457	451
q17	1736	1698	1678	1678
q18	8020	7790	7719	7719
q19	1719	1688	1693	1688
q20	2052	1811	1817	1811
q21	5657	5593	5466	5466
q22	1129	997	1013	997
Total cold run time: 65418 ms
Total hot run time: 59414 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.89% (9468/25666)
Line Coverage: 28.24% (77803/275508)
Region Coverage: 27.65% (40187/145345)
Branch Coverage: 24.26% (20423/84178)
Coverage Report: http://coverage.selectdb-in.cc/coverage/d13fe4af7a7a0fb3e42ea46a653ee2cd79cbe024_d13fe4af7a7a0fb3e42ea46a653ee2cd79cbe024/report/index.html

@doris-robot
Copy link

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

query1	933	382	379	379
query2	6488	1806	1851	1806
query3	6662	213	221	213
query4	26154	23917	23832	23832
query5	4983	554	526	526
query6	266	181	172	172
query7	4595	313	312	312
query8	291	232	231	231
query9	8509	2636	2625	2625
query10	459	293	283	283
query11	16061	15459	15660	15459
query12	170	108	104	104
query13	1694	407	397	397
query14	11777	6927	6872	6872
query15	228	171	174	171
query16	7525	491	475	475
query17	1548	588	608	588
query18	1962	301	300	300
query19	205	156	155	155
query20	124	114	117	114
query21	208	110	107	107
query22	4604	4268	4318	4268
query23	34564	33890	33794	33794
query24	9224	3217	3133	3133
query25	646	424	419	419
query26	728	164	167	164
query27	2131	293	294	293
query28	5189	2114	2104	2104
query29	890	433	449	433
query30	300	169	156	156
query31	988	784	789	784
query32	104	64	59	59
query33	665	319	312	312
query34	916	490	509	490
query35	880	765	771	765
query36	1048	912	924	912
query37	146	87	82	82
query38	3999	3917	3892	3892
query39	1479	1407	1437	1407
query40	213	127	118	118
query41	52	49	49	49
query42	120	103	103	103
query43	508	452	459	452
query44	1222	828	799	799
query45	202	173	174	173
query46	1129	844	811	811
query47	1900	1786	1796	1786
query48	392	304	302	302
query49	1071	469	465	465
query50	929	458	482	458
query51	6993	6969	6825	6825
query52	108	89	90	89
query53	266	192	193	192
query54	746	486	482	482
query55	86	79	80	79
query56	294	288	276	276
query57	1197	1101	1095	1095
query58	245	238	255	238
query59	2873	2763	2586	2586
query60	323	299	400	299
query61	106	127	105	105
query62	921	689	663	663
query63	215	195	192	192
query64	4937	690	681	681
query65	3247	3186	3154	3154
query66	1435	304	325	304
query67	15935	15610	15380	15380
query68	3456	889	855	855
query69	442	334	325	325
query70	1187	1149	1185	1149
query71	384	360	359	359
query72	6122	3367	3413	3367
query73	610	591	600	591
query74	9266	9103	9162	9103
query75	3192	3033	3015	3015
query76	2272	889	879	879
query77	461	411	420	411
query78	9428	9365	9301	9301
query79	945	902	890	890
query80	880	844	835	835
query81	456	267	270	267
query82	272	269	271	269
query83	196	187	197	187
query84	241	119	109	109
query85	676	420	413	413
query86	329	320	303	303
query87	4344	4295	4351	4295
query88	4231	4162	4169	4162
query89	381	379	373	373
query90	1270	333	324	324
query91	133	130	130	130
query92	81	78	78	78
query93	1053	1043	1059	1043
query94	578	378	403	378
query95	497	445	431	431
query96	478	480	479	479
query97	3137	3151	3160	3151
query98	228	240	234	234
query99	1544	1325	1308	1308
Total cold run time: 275778 ms
Total hot run time: 195758 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.07	0.04	0.04
query3	0.22	0.05	0.04
query4	1.67	0.06	0.07
query5	0.51	0.51	0.50
query6	1.13	0.74	0.74
query7	0.02	0.02	0.02
query8	0.05	0.04	0.06
query9	0.57	0.53	0.51
query10	0.57	0.57	0.57
query11	0.16	0.13	0.13
query12	0.17	0.13	0.13
query13	0.63	0.61	0.61
query14	1.47	1.46	1.46
query15	0.91	0.87	0.89
query16	0.36	0.37	0.36
query17	1.02	1.03	1.04
query18	0.22	0.20	0.20
query19	1.94	1.86	1.77
query20	0.01	0.01	0.01
query21	15.41	0.66	0.65
query22	3.94	7.28	1.21
query23	17.83	1.32	1.36
query24	2.25	0.24	0.22
query25	0.18	0.07	0.08
query26	0.28	0.19	0.18
query27	0.08	0.08	0.07
query28	13.17	1.14	1.11
query29	12.52	3.35	3.38
query30	0.24	0.06	0.05
query31	2.85	0.43	0.41
query32	3.23	0.50	0.48
query33	3.03	3.05	3.12
query34	15.44	4.34	4.33
query35	4.38	4.30	4.34
query36	0.69	0.49	0.48
query37	0.20	0.17	0.17
query38	0.17	0.16	0.15
query39	0.04	0.04	0.04
query40	0.16	0.14	0.14
query41	0.10	0.06	0.05
query42	0.06	0.06	0.06
query43	0.04	0.04	0.04
Total cold run time: 108.04 s
Total hot run time: 31.06 s

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18216	7408	7325	7325
q2	2723	164	176	164
q3	12380	1310	1197	1197
q4	10961	751	764	751
q5	7993	3215	3050	3050
q6	237	151	147	147
q7	990	617	593	593
q8	9429	2053	2046	2046
q9	6841	6416	6396	6396
q10	7013	2281	2328	2281
q11	430	232	240	232
q12	404	214	209	209
q13	17790	2968	2967	2967
q14	249	206	223	206
q15	592	512	525	512
q16	661	628	613	613
q17	985	856	822	822
q18	7477	6735	6677	6677
q19	1404	1007	1028	1007
q20	605	309	294	294
q21	4000	3371	3110	3110
q22	1135	1022	1021	1021
Total cold run time: 112515 ms
Total hot run time: 41620 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7249	7210	7224	7210
q2	324	226	229	226
q3	2866	2803	2761	2761
q4	1931	1693	1739	1693
q5	5347	5414	5419	5414
q6	232	137	140	137
q7	2063	1695	1686	1686
q8	3179	3330	3315	3315
q9	8350	8400	8415	8400
q10	3377	3346	3325	3325
q11	574	460	466	460
q12	741	564	563	563
q13	6530	3004	2984	2984
q14	286	267	258	258
q15	554	510	518	510
q16	697	671	676	671
q17	1763	1548	1520	1520
q18	7701	7607	7311	7311
q19	1678	1455	1406	1406
q20	2034	1834	1834	1834
q21	5426	5050	5213	5050
q22	1137	1006	1003	1003
Total cold run time: 64039 ms
Total hot run time: 57737 ms

@doris-robot
Copy link

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

query1	971	374	367	367
query2	6518	2177	2076	2076
query3	6708	209	220	209
query4	34378	23328	23346	23328
query5	4352	467	458	458
query6	260	164	161	161
query7	4637	297	303	297
query8	287	226	212	212
query9	9804	2667	2632	2632
query10	469	279	271	271
query11	18063	15239	15154	15154
query12	152	96	101	96
query13	1647	406	385	385
query14	10788	7433	7702	7433
query15	309	182	176	176
query16	7678	455	493	455
query17	1803	578	563	563
query18	1424	308	312	308
query19	362	149	163	149
query20	119	108	107	107
query21	222	104	105	104
query22	4650	4346	4209	4209
query23	34562	34075	33874	33874
query24	11152	2884	2893	2884
query25	645	395	408	395
query26	1162	157	158	157
query27	2320	284	286	284
query28	7637	2455	2425	2425
query29	789	421	417	417
query30	330	158	152	152
query31	1017	789	818	789
query32	100	56	56	56
query33	774	305	292	292
query34	946	494	483	483
query35	880	717	743	717
query36	1063	920	930	920
query37	150	92	81	81
query38	4029	3868	4033	3868
query39	1470	1463	1420	1420
query40	214	97	99	97
query41	53	50	51	50
query42	117	97	96	96
query43	529	497	485	485
query44	1230	814	807	807
query45	192	167	166	166
query46	1142	760	769	760
query47	1922	1811	1823	1811
query48	459	376	371	371
query49	1120	422	397	397
query50	806	412	404	404
query51	7077	6952	6949	6949
query52	101	87	87	87
query53	257	184	182	182
query54	1163	464	477	464
query55	75	75	78	75
query56	290	269	268	268
query57	1215	1117	1107	1107
query58	248	238	237	237
query59	3317	3114	2866	2866
query60	305	290	284	284
query61	128	124	123	123
query62	843	665	652	652
query63	226	188	186	186
query64	4102	643	638	638
query65	3355	3184	3179	3179
query66	857	304	292	292
query67	15897	15354	15670	15354
query68	4814	571	559	559
query69	481	297	292	292
query70	1154	1106	1124	1106
query71	322	267	277	267
query72	6426	4130	3988	3988
query73	778	321	329	321
query74	9520	9053	8895	8895
query75	3366	2621	2634	2621
query76	2934	898	884	884
query77	409	299	287	287
query78	10613	9242	9198	9198
query79	1582	541	548	541
query80	993	436	433	433
query81	561	247	242	242
query82	738	137	147	137
query83	210	137	133	133
query84	245	79	74	74
query85	975	297	276	276
query86	420	300	292	292
query87	4317	4273	4239	4239
query88	2996	2348	2334	2334
query89	381	285	278	278
query90	1837	187	193	187
query91	183	145	160	145
query92	76	47	49	47
query93	1299	535	529	529
query94	762	294	295	294
query95	348	249	250	249
query96	619	282	279	279
query97	3234	3175	3150	3150
query98	211	195	197	195
query99	1758	1273	1299	1273
Total cold run time: 296429 ms
Total hot run time: 190496 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.06	0.03	0.03
query3	0.23	0.07	0.06
query4	1.65	0.10	0.10
query5	0.50	0.51	0.52
query6	1.13	0.73	0.73
query7	0.02	0.01	0.02
query8	0.04	0.03	0.03
query9	0.57	0.50	0.50
query10	0.54	0.56	0.54
query11	0.13	0.10	0.10
query12	0.13	0.11	0.11
query13	0.60	0.59	0.60
query14	2.96	2.97	2.98
query15	0.90	0.82	0.83
query16	0.40	0.39	0.40
query17	1.05	1.03	1.06
query18	0.21	0.21	0.21
query19	1.97	1.82	1.93
query20	0.01	0.01	0.02
query21	15.35	0.58	0.59
query22	2.57	2.06	2.70
query23	17.41	0.75	0.88
query24	2.59	1.03	1.50
query25	0.33	0.18	0.10
query26	0.37	0.14	0.13
query27	0.04	0.03	0.05
query28	10.62	1.09	1.06
query29	12.55	3.18	3.22
query30	0.24	0.06	0.06
query31	2.90	0.38	0.36
query32	3.28	0.47	0.45
query33	3.01	2.99	3.05
query34	16.90	4.36	4.41
query35	4.49	4.41	4.40
query36	0.68	0.47	0.51
query37	0.08	0.05	0.06
query38	0.04	0.03	0.03
query39	0.03	0.02	0.03
query40	0.17	0.12	0.12
query41	0.07	0.02	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 106.93 s
Total hot run time: 32.9 s

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.30% (9593/25717)
Line Coverage: 28.68% (79255/276345)
Region Coverage: 28.14% (41025/145785)
Branch Coverage: 24.76% (20900/84394)
Coverage Report: http://coverage.selectdb-in.cc/coverage/fe6a801fd8ac6d992d36f5967fba26734fe44edc_fe6a801fd8ac6d992d36f5967fba26734fe44edc/report/index.html

Copy link
Contributor

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

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 20, 2024
Copy link
Contributor

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

@morningman morningman merged commit c82165e into apache:master Sep 20, 2024
23 of 28 checks passed
hubgeter added a commit to hubgeter/doris that referenced this pull request Sep 20, 2024
…_iso8601_date (apache#40695)

Added three functions: `normal_cdf`, `to_iso8601`, `from_iso8601_date`

1. `normal_cdf(mean, sd, v) → double` :
Compute the Normal cdf with given mean and standard deviation (sd): P(N
< value; mean, sd). The mean and value must be real values and the
standard deviation must be a real and positive value (all of type
DOUBLE).

2. `to_iso8601(DATE/DATETIME) → string`
For `DATE` type, it will be converted to `YYYY-MM-DD`.
For `DATETIME` type, it will be converted to
`YYYY-MM-DDThh:mm:ss.xxxxxx`.

3. `from_iso8601_date(string) →  DATE`
Convert iso8601 string to `DATE` type.
The supported iso8601 string formats are as follows:
    a.  Year : YYYY
    b. Calendar dates : YYYY-MM-DD   , YYYYMMDD ,   YYYY-MM
    c. Week dates : YYYY-Www  , YYYYWww  , YYYY-Www-D , YYYYWwwD
    d. Ordinal dates : YYYY-DDD , YYYYDDD
You can refer to this [document](https://en.wikipedia.org/wiki/ISO_8601)
to understand what these formats mean
Please note that:
a. Each date and time value has a fixed number of digits that must be
padded with leading zeros.
     b. The range of YYYY is 0001-9999.
outside these rules, the correctness of the results is not guaranteed.

For illegal values, the result is NULL.
yiguolei pushed a commit that referenced this pull request Sep 21, 2024
before pr : #40695 
## Proposed changes

Fix the bug that be will have this error when compiling on mac.
```
be/src/vec/functions/math.cpp:416:39: error: no member named 'numbers' in namespace 'std'
        constexpr double sqrt2 = std::numbers::sqrt2;
                                 ~~~~~^
1 error generated.
```
morningman pushed a commit that referenced this pull request Sep 24, 2024
hubgeter added a commit to hubgeter/doris that referenced this pull request Oct 9, 2024
…_iso8601_date (apache#40695)

## Proposed changes
Added three functions: `normal_cdf`, `to_iso8601`, `from_iso8601_date`

1. `normal_cdf(mean, sd, v) → double` : 
Compute the Normal cdf with given mean and standard deviation (sd): P(N
< value; mean, sd). The mean and value must be real values and the
standard deviation must be a real and positive value (all of type
DOUBLE).


2. `to_iso8601(DATE/DATETIME) → string`
For `DATE` type, it will be converted to `YYYY-MM-DD`.
For `DATETIME` type, it will be converted to
`YYYY-MM-DDThh:mm:ss.xxxxxx`.


3. `from_iso8601_date(string) →  DATE`
Convert iso8601 string to `DATE` type.
The supported iso8601 string formats are as follows:
    a.  Year : YYYY
    b. Calendar dates : YYYY-MM-DD   , YYYYMMDD ,   YYYY-MM 
    c. Week dates : YYYY-Www  , YYYYWww  , YYYY-Www-D , YYYYWwwD
    d. Ordinal dates : YYYY-DDD , YYYYDDD
You can refer to this [document](https://en.wikipedia.org/wiki/ISO_8601)
to understand what these formats mean
Please note that:
a. Each date and time value has a fixed number of digits that must be
padded with leading zeros.
     b. The range of YYYY is 0001-9999.
outside these rules, the correctness of the results is not guaranteed.


For illegal values, the result is NULL.
hubgeter added a commit to hubgeter/doris that referenced this pull request Oct 9, 2024
…41075)

before pr : apache#40695 
## Proposed changes

Fix the bug that be will have this error when compiling on mac.
```
be/src/vec/functions/math.cpp:416:39: error: no member named 'numbers' in namespace 'std'
        constexpr double sqrt2 = std::numbers::sqrt2;
                                 ~~~~~^
1 error generated.
```
morningman pushed a commit that referenced this pull request Oct 11, 2024
…_iso8601_date (#40695 and #41075) (#41600)

bp #40695 and #41075
#41075 : fix  #40695 mac compile 

## Proposed changes
Added three functions: `normal_cdf`, `to_iso8601`, `from_iso8601_date`

1. `normal_cdf(mean, sd, v) → double` : 
Compute the Normal cdf with given mean and standard deviation (sd): P(N
< value; mean, sd). The mean and value must be real values and the
standard deviation must be a real and positive value (all of type
DOUBLE).


2. `to_iso8601(DATE/DATETIME) → string`
For `DATE` type, it will be converted to `YYYY-MM-DD`.
For `DATETIME` type, it will be converted to
`YYYY-MM-DDThh:mm:ss.xxxxxx`.


3. `from_iso8601_date(string) →  DATE`
Convert iso8601 string to `DATE` type.
The supported iso8601 string formats are as follows:
    a.  Year : YYYY
    b. Calendar dates : YYYY-MM-DD   , YYYYMMDD ,   YYYY-MM 
    c. Week dates : YYYY-Www  , YYYYWww  , YYYY-Www-D , YYYYWwwD
    d. Ordinal dates : YYYY-DDD , YYYYDDD
You can refer to this [document](https://en.wikipedia.org/wiki/ISO_8601)
to understand what these formats mean
Please note that:
a. Each date and time value has a fixed number of digits that must be
padded with leading zeros.
     b. The range of YYYY is 0001-9999.
outside these rules, the correctness of the results is not guaranteed.


For illegal values, the result is NULL.
@yiguolei yiguolei mentioned this pull request Nov 6, 2024
@yiguolei yiguolei mentioned this pull request Jan 19, 2025
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.7-merged dev/3.0.3-merged reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants