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

[feat](metatable) support table$partitions for hive table #40774

Merged
merged 14 commits into from
Sep 24, 2024

Conversation

morningman
Copy link
Contributor

@morningman morningman commented Sep 12, 2024

Support new grammar: table_name$partitions

User can query partition info by using:

select * from table_name$partitions

table_name$partitions is a special meta table corresponding to the table.

Its schema is the partition columns of the table, and column type is always "String".
And the value is the partition column's value

You can use DESC table_name$partitions to get schema:

mysql> desc partition_values_all_types$partitions;
+-------+----------------+------+------+---------+-------+
| Field | Type           | Null | Key  | Default | Extra |
+-------+----------------+------+------+---------+-------+
| p1    | boolean        | Yes  | true | NULL    | NONE  |
| p2    | tinyint        | Yes  | true | NULL    | NONE  |
| p3    | smallint       | Yes  | true | NULL    | NONE  |
| p4    | int            | Yes  | true | NULL    | NONE  |
| p5    | bigint         | Yes  | true | NULL    | NONE  |
| p6    | date           | Yes  | true | NULL    | NONE  |
| p7    | datetime(6)    | Yes  | true | NULL    | NONE  |
| p8    | varchar(65533) | Yes  | true | NULL    | NONE  |
| p9    | decimal(9,2)   | Yes  | true | NULL    | NONE  |
| p10   | decimal(18,10) | Yes  | true | NULL    | NONE  |
| p11   | decimal(38,9)  | Yes  | true | NULL    | NONE  |
+-------+----------------+------+------+---------+-------+

Where px are partition columns of table partition_values_all_types;

mysql> select * from partition_values_all_types$partitions order by p1,p2,p3;
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| p1   | p2   | p3     | p4          | p5                   | p6         | p7                         | p8     | p9          | p10                  | p11                                      |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| NULL | NULL |   NULL |        NULL |                 NULL | NULL       | NULL                       | NULL   |        NULL |                 NULL |                                     NULL |
|    0 | -128 | -32768 | -2147483648 | -9223372036854775808 | 1900-01-01 | 1899-01-01 23:59:59.000000 | NULL   | -9999999.99 | -99999999.9999999999 | -99999999999999999999999999999.999999999 |
|    0 |  127 |  32767 |  2147483647 |  9223372036854775807 | 9999-12-31 | 0001-01-01 00:00:01.321000 | boston |  9999999.99 |  99999999.9999999999 |  99999999999999999999999999999.999999999 |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+

Currently, this grammar can only be used for partition table's in Hive Catalog.
Table in other catalogs or non partition table can not use this grammar.

Internally, it is implemented as a table valued function: partition_values

mysql> select * from partition_values("catalog" = "hive", "database" = "multi_catalog", "table" = "partition_values_all_types");
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| p1   | p2   | p3     | p4          | p5                   | p6         | p7                         | p8     | p9          | p10                  | p11                                      |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
|    0 |  127 |  32767 |  2147483647 |  9223372036854775807 | 9999-12-31 | 0001-01-01 00:00:01.321000 | boston |  9999999.99 |  99999999.9999999999 |  99999999999999999999999999999.999999999 |
|    0 | -128 | -32768 | -2147483648 | -9223372036854775808 | 1900-01-01 | 1899-01-01 23:59:59.000000 | NULL   | -9999999.99 | -99999999.9999999999 | -99999999999999999999999999999.999999999 |
| NULL | NULL |   NULL |        NULL |                 NULL | NULL       | NULL                       | NULL   |        NULL |                 NULL |                                     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.

@morningman
Copy link
Contributor Author

run buildall

1 similar comment
@morningman
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17592	7670	7231	7231
q2	2027	184	175	175
q3	10545	1363	1344	1344
q4	10208	1042	1073	1042
q5	7728	3247	3174	3174
q6	238	151	150	150
q7	1084	653	611	611
q8	9468	2063	2035	2035
q9	6831	6376	6351	6351
q10	7027	2545	2564	2545
q11	437	254	254	254
q12	412	232	226	226
q13	17783	3058	3034	3034
q14	295	240	256	240
q15	585	536	531	531
q16	518	426	425	425
q17	1000	959	954	954
q18	7621	6883	6795	6795
q19	1378	1251	1240	1240
q20	608	349	338	338
q21	3922	3559	3546	3546
q22	1072	992	989	989
Total cold run time: 108379 ms
Total hot run time: 43230 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7131	7189	7201	7189
q2	355	236	236	236
q3	3135	3086	3020	3020
q4	1960	1980	1973	1973
q5	5493	5462	5449	5449
q6	230	142	141	141
q7	2067	1698	1655	1655
q8	3237	3599	3301	3301
q9	8454	8449	8470	8449
q10	3408	3450	3467	3450
q11	557	471	477	471
q12	792	605	606	605
q13	8771	3039	3024	3024
q14	310	262	280	262
q15	572	525	516	516
q16	485	450	435	435
q17	1787	1735	1738	1735
q18	7971	7668	7588	7588
q19	1738	1719	1724	1719
q20	2026	1801	1833	1801
q21	5686	5497	5553	5497
q22	1053	982	965	965
Total cold run time: 67218 ms
Total hot run time: 59481 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.90% (9471/25664)
Line Coverage: 28.27% (77889/275507)
Region Coverage: 27.67% (40217/145328)
Branch Coverage: 24.28% (20433/84156)
Coverage Report: http://coverage.selectdb-in.cc/coverage/17e68a6bfb7e73759a120574a6007918ba2b10b2_17e68a6bfb7e73759a120574a6007918ba2b10b2/report/index.html

@doris-robot
Copy link

TPC-DS: Total hot run time: 195876 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 17e68a6bfb7e73759a120574a6007918ba2b10b2, data reload: false

query1	928	378	386	378
query2	6462	1773	1763	1763
query3	6656	207	214	207
query4	26186	24086	26228	24086
query5	5302	553	530	530
query6	262	172	171	171
query7	4595	307	314	307
query8	281	216	224	216
query9	8524	2576	2572	2572
query10	477	302	306	302
query11	16151	15637	15436	15436
query12	156	100	104	100
query13	1701	410	398	398
query14	11306	7035	7145	7035
query15	217	175	179	175
query16	7595	493	483	483
query17	1559	586	572	572
query18	1986	302	305	302
query19	196	151	150	150
query20	119	114	113	113
query21	212	106	105	105
query22	4365	4233	4179	4179
query23	34532	34009	33888	33888
query24	10059	3141	3095	3095
query25	661	418	416	416
query26	770	159	174	159
query27	2176	289	293	289
query28	6231	2103	2091	2091
query29	940	431	431	431
query30	293	161	157	157
query31	1045	803	809	803
query32	114	67	59	59
query33	734	314	304	304
query34	915	475	486	475
query35	892	774	746	746
query36	1057	900	897	897
query37	143	87	82	82
query38	3984	3974	3974	3974
query39	1468	1417	1436	1417
query40	211	123	120	120
query41	54	52	50	50
query42	128	98	101	98
query43	505	449	463	449
query44	1307	804	783	783
query45	204	188	175	175
query46	1131	856	834	834
query47	1902	1823	1825	1823
query48	374	298	297	297
query49	1123	469	475	469
query50	921	432	430	430
query51	7198	7022	6850	6850
query52	101	90	89	89
query53	261	186	186	186
query54	838	479	496	479
query55	87	81	78	78
query56	289	292	277	277
query57	1198	1102	1076	1076
query58	249	240	248	240
query59	2910	2796	2567	2567
query60	318	290	298	290
query61	125	120	221	120
query62	913	691	689	689
query63	229	196	203	196
query64	4229	699	684	684
query65	3271	3165	3166	3165
query66	1034	297	298	297
query67	16138	15464	15548	15464
query68	3184	878	866	866
query69	450	328	334	328
query70	1196	1174	1144	1144
query71	361	352	345	345
query72	6094	3358	3412	3358
query73	586	584	581	581
query74	9181	9039	9153	9039
query75	3136	3041	3027	3027
query76	1914	849	853	849
query77	448	421	423	421
query78	9409	9318	9328	9318
query79	913	895	880	880
query80	867	822	806	806
query81	453	264	273	264
query82	264	257	259	257
query83	188	191	190	190
query84	231	108	110	108
query85	690	400	392	392
query86	342	312	317	312
query87	4415	4291	4386	4291
query88	4182	4105	4110	4105
query89	383	367	380	367
query90	1355	326	320	320
query91	121	158	127	127
query92	80	77	76	76
query93	1049	1040	1043	1040
query94	604	379	357	357
query95	482	436	423	423
query96	473	474	472	472
query97	3134	3146	3159	3146
query98	230	227	229	227
query99	1553	1324	1302	1302
Total cold run time: 276466 ms
Total hot run time: 195876 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.08	0.04	0.04
query3	0.22	0.04	0.04
query4	1.69	0.07	0.07
query5	0.51	0.51	0.50
query6	1.16	0.73	0.73
query7	0.02	0.02	0.01
query8	0.05	0.04	0.04
query9	0.56	0.53	0.51
query10	0.57	0.57	0.57
query11	0.16	0.12	0.12
query12	0.15	0.13	0.12
query13	0.63	0.62	0.62
query14	1.47	1.48	1.49
query15	0.91	0.87	0.89
query16	0.36	0.36	0.37
query17	1.01	1.03	1.02
query18	0.16	0.16	0.16
query19	1.93	1.75	1.78
query20	0.01	0.01	0.01
query21	15.39	0.67	0.67
query22	4.11	8.35	1.02
query23	17.76	1.41	1.34
query24	2.26	0.22	0.22
query25	0.17	0.08	0.07
query26	0.28	0.18	0.18
query27	0.08	0.08	0.07
query28	13.17	1.13	1.10
query29	12.52	3.35	3.33
query30	0.25	0.06	0.05
query31	2.88	0.41	0.42
query32	3.24	0.48	0.49
query33	3.00	3.08	3.07
query34	15.43	4.30	4.32
query35	4.33	4.35	4.33
query36	0.69	0.50	0.49
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.13	0.15
query41	0.10	0.05	0.04
query42	0.06	0.05	0.05
query43	0.04	0.03	0.04
Total cold run time: 108.03 s
Total hot run time: 30.8 s

@morningman
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.32% (9577/25663)
Line Coverage: 28.70% (79128/275723)
Region Coverage: 28.19% (40980/145380)
Branch Coverage: 24.80% (20881/84190)
Coverage Report: http://coverage.selectdb-in.cc/coverage/0d8fcd86f7cdc4ee4959dbe420888587946ddc7d_0d8fcd86f7cdc4ee4959dbe420888587946ddc7d/report/index.html

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17739	7289	7170	7170
q2	2059	161	156	156
q3	10915	1165	1267	1165
q4	10325	867	955	867
q5	7765	3138	3179	3138
q6	239	154	152	152
q7	1034	616	602	602
q8	9428	2018	2037	2018
q9	6846	6431	6451	6431
q10	7067	2400	2334	2334
q11	434	245	251	245
q12	407	221	214	214
q13	17797	2978	2993	2978
q14	241	221	226	221
q15	560	507	521	507
q16	507	416	418	416
q17	1000	929	950	929
q18	7360	6850	6935	6850
q19	1381	1236	1233	1233
q20	581	281	289	281
q21	3891	3382	3534	3382
q22	1133	1022	1017	1017
Total cold run time: 108709 ms
Total hot run time: 42306 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7114	7106	7118	7106
q2	331	231	233	231
q3	3084	3110	3045	3045
q4	2062	2074	2036	2036
q5	5626	5613	5701	5613
q6	239	144	142	142
q7	2190	1760	1811	1760
q8	3381	3463	3454	3454
q9	8855	8970	8869	8869
q10	3501	3506	3547	3506
q11	579	496	494	494
q12	814	591	617	591
q13	8893	3199	3157	3157
q14	308	268	279	268
q15	558	530	516	516
q16	537	473	479	473
q17	1805	1749	1753	1749
q18	8459	8234	8203	8203
q19	1769	1744	1733	1733
q20	2115	1860	1896	1860
q21	5524	5295	5402	5295
q22	1139	1041	1015	1015
Total cold run time: 68883 ms
Total hot run time: 61116 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 198605 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 0d8fcd86f7cdc4ee4959dbe420888587946ddc7d, data reload: false

query1	1298	870	886	870
query2	6389	1741	1810	1741
query3	10783	3997	3884	3884
query4	55016	25428	24106	24106
query5	5150	514	484	484
query6	408	177	158	158
query7	5757	321	305	305
query8	280	213	214	213
query9	6864	2577	2561	2561
query10	446	296	280	280
query11	16567	15540	15587	15540
query12	153	103	99	99
query13	1483	410	396	396
query14	10418	7281	6968	6968
query15	214	180	184	180
query16	6833	489	475	475
query17	1185	599	582	582
query18	1791	318	314	314
query19	199	147	147	147
query20	118	108	112	108
query21	218	103	110	103
query22	4760	4512	4673	4512
query23	34517	33950	33751	33751
query24	6090	3077	3084	3077
query25	497	372	372	372
query26	632	158	156	156
query27	1618	289	284	284
query28	2853	2088	2054	2054
query29	664	409	398	398
query30	220	155	146	146
query31	965	738	805	738
query32	74	53	54	53
query33	458	291	296	291
query34	895	475	469	469
query35	872	732	710	710
query36	1011	919	915	915
query37	132	76	77	76
query38	4064	3875	3980	3875
query39	1451	1394	1397	1394
query40	206	118	91	91
query41	49	43	45	43
query42	116	93	93	93
query43	499	454	437	437
query44	1183	784	769	769
query45	190	165	157	157
query46	1092	824	806	806
query47	1909	1812	1796	1796
query48	429	344	381	344
query49	677	386	379	379
query50	941	439	429	429
query51	7076	7021	6846	6846
query52	102	86	90	86
query53	249	176	178	176
query54	556	445	446	445
query55	79	73	82	73
query56	283	251	274	251
query57	1216	1083	1069	1069
query58	222	229	219	219
query59	2887	2626	2515	2515
query60	287	262	257	257
query61	103	95	99	95
query62	804	665	671	665
query63	211	187	182	182
query64	1442	685	602	602
query65	3216	3183	3181	3181
query66	662	300	296	296
query67	16343	15540	15460	15460
query68	1860	889	857	857
query69	422	346	348	346
query70	1147	1137	1130	1130
query71	343	336	334	334
query72	4695	3337	3322	3322
query73	600	586	593	586
query74	9235	9308	9150	9150
query75	3058	2914	3001	2914
query76	941	861	860	860
query77	471	355	356	355
query78	9515	9402	9288	9288
query79	913	892	871	871
query80	604	579	565	565
query81	448	237	235	235
query82	196	193	199	193
query83	155	156	153	153
query84	223	103	97	97
query85	641	378	391	378
query86	319	310	321	310
query87	4430	4273	4402	4273
query88	4111	4048	4031	4031
query89	369	373	365	365
query90	1448	300	299	299
query91	158	155	163	155
query92	75	74	74	74
query93	1047	1024	1020	1020
query94	548	381	373	373
query95	442	407	418	407
query96	472	467	470	467
query97	3165	3133	3160	3133
query98	219	230	215	215
query99	1357	1302	1303	1302
Total cold run time: 289999 ms
Total hot run time: 198605 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.07	0.04	0.04
query3	0.23	0.05	0.04
query4	1.67	0.06	0.06
query5	0.49	0.49	0.50
query6	1.16	0.72	0.72
query7	0.02	0.02	0.02
query8	0.06	0.04	0.05
query9	0.56	0.53	0.52
query10	0.57	0.56	0.56
query11	0.17	0.13	0.12
query12	0.16	0.13	0.13
query13	0.62	0.62	0.63
query14	1.46	1.48	1.48
query15	0.91	0.87	0.86
query16	0.36	0.37	0.38
query17	1.02	1.02	1.05
query18	0.17	0.17	0.15
query19	1.91	1.85	1.76
query20	0.02	0.01	0.01
query21	15.40	0.68	0.67
query22	3.72	7.69	1.23
query23	17.75	1.19	1.28
query24	2.28	0.22	0.22
query25	0.20	0.08	0.09
query26	0.28	0.18	0.18
query27	0.08	0.07	0.08
query28	13.18	1.14	1.10
query29	12.55	3.34	3.28
query30	0.26	0.07	0.06
query31	2.86	0.42	0.41
query32	3.23	0.50	0.50
query33	3.02	3.07	3.11
query34	15.45	4.32	4.33
query35	4.34	4.31	4.35
query36	0.69	0.49	0.50
query37	0.19	0.17	0.16
query38	0.16	0.15	0.15
query39	0.05	0.03	0.04
query40	0.16	0.14	0.14
query41	0.10	0.04	0.05
query42	0.06	0.04	0.04
query43	0.04	0.04	0.04
Total cold run time: 107.72 s
Total hot run time: 30.83 s

@caiconghui
Copy link
Contributor

mysql> select * from multi_catalog.orc_partitioned_columns$partitions;
+----------------------------+---------+----------+
| t_int | t_float | t_string |
+----------------------------+---------+----------+
| HIVE_DEFAULT_PARTITION | 0.2 | test2 |
| 100 | 0.3 | test3 |
| HIVE_DEFAULT_PARTITION | 0.1 | test1 |
+----------------------------+---------+----------+

here should return NULL for t_int

@morningman
Copy link
Contributor Author

mysql> select * from multi_catalog.orc_partitioned_columns$partitions; +----------------------------+---------+----------+ | t_int | t_float | t_string | +----------------------------+---------+----------+ | HIVE_DEFAULT_PARTITION | 0.2 | test2 | | 100 | 0.3 | test3 | | HIVE_DEFAULT_PARTITION | 0.1 | test1 | +----------------------------+---------+----------+

here should return NULL for t_int

done

@morningman
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17929	7440	7227	7227
q2	2046	170	155	155
q3	10693	1104	1181	1104
q4	10302	819	765	765
q5	7788	3072	3094	3072
q6	238	148	148	148
q7	1001	626	602	602
q8	9470	2045	2051	2045
q9	6846	6408	6441	6408
q10	7015	2279	2281	2279
q11	435	244	246	244
q12	410	210	215	210
q13	17764	2973	3002	2973
q14	238	218	208	208
q15	570	514	522	514
q16	695	613	615	613
q17	985	788	809	788
q18	7467	6694	6750	6694
q19	1410	1013	1021	1013
q20	579	290	296	290
q21	4061	3296	3236	3236
q22	1118	1000	1010	1000
Total cold run time: 109060 ms
Total hot run time: 41588 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7206	7213	7210	7210
q2	323	231	233	231
q3	3049	2974	2992	2974
q4	2015	1793	1845	1793
q5	5651	5621	5692	5621
q6	239	141	140	140
q7	2209	1810	1807	1807
q8	3320	3478	3406	3406
q9	8773	8914	8781	8781
q10	3470	3428	3458	3428
q11	572	504	485	485
q12	824	603	625	603
q13	10047	3165	3169	3165
q14	323	257	282	257
q15	581	531	534	531
q16	729	673	688	673
q17	1798	1612	1592	1592
q18	8329	7881	7875	7875
q19	1723	1670	1578	1578
q20	2151	1875	1879	1875
q21	5593	5456	5459	5456
q22	1182	1046	1061	1046
Total cold run time: 70107 ms
Total hot run time: 60527 ms

@doris-robot
Copy link

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

query1	1303	885	917	885
query2	6348	2137	2121	2121
query3	10770	3890	3984	3890
query4	63122	29266	23533	23533
query5	5092	470	466	466
query6	415	162	162	162
query7	5453	305	296	296
query8	315	226	233	226
query9	8362	2677	2702	2677
query10	466	290	270	270
query11	17362	15178	15819	15178
query12	165	105	101	101
query13	1502	413	439	413
query14	10965	7672	7763	7672
query15	204	178	176	176
query16	6825	522	454	454
query17	1185	602	583	583
query18	1523	314	307	307
query19	208	147	150	147
query20	135	110	111	110
query21	220	101	104	101
query22	4725	4735	4754	4735
query23	35156	34240	33956	33956
query24	6105	2984	2966	2966
query25	534	401	413	401
query26	641	159	162	159
query27	1621	291	287	287
query28	4342	2476	2439	2439
query29	673	430	435	430
query30	240	154	159	154
query31	974	776	800	776
query32	71	54	56	54
query33	449	309	291	291
query34	911	506	487	487
query35	848	737	724	724
query36	1112	961	1004	961
query37	159	87	87	87
query38	4081	4023	3989	3989
query39	1443	1397	1418	1397
query40	207	99	95	95
query41	51	48	50	48
query42	120	98	100	98
query43	522	489	493	489
query44	1189	835	836	835
query45	204	165	164	164
query46	1139	760	777	760
query47	1869	1803	1852	1803
query48	501	373	371	371
query49	708	419	418	418
query50	817	416	436	416
query51	7094	6940	6944	6940
query52	100	87	89	87
query53	250	175	178	175
query54	586	453	463	453
query55	76	82	76	76
query56	275	246	252	246
query57	1197	1046	1114	1046
query58	215	225	221	221
query59	3199	3158	3041	3041
query60	303	273	278	273
query61	106	109	108	108
query62	766	651	653	651
query63	218	194	191	191
query64	1395	683	667	667
query65	3283	3195	3199	3195
query66	680	299	301	299
query67	16062	15709	15221	15221
query68	1283	570	547	547
query69	414	277	287	277
query70	1175	1131	1088	1088
query71	319	264	264	264
query72	6092	4019	4030	4019
query73	762	328	335	328
query74	9396	8913	8912	8912
query75	3323	2639	2653	2639
query76	1347	854	893	854
query77	401	289	309	289
query78	10794	9906	9345	9345
query79	1159	880	859	859
query80	764	579	559	559
query81	509	249	248	248
query82	238	233	233	233
query83	163	163	160	160
query84	280	100	101	100
query85	761	377	367	367
query86	322	303	315	303
query87	4569	4431	4366	4366
query88	4644	4081	4069	4069
query89	386	358	359	358
query90	1568	314	306	306
query91	161	162	168	162
query92	87	74	72	72
query93	943	896	891	891
query94	668	390	398	390
query95	439	417	413	413
query96	498	491	498	491
query97	3193	3118	3097	3097
query98	222	222	225	222
query99	1491	1276	1299	1276
Total cold run time: 307528 ms
Total hot run time: 199952 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.33% (9583/25672)
Line Coverage: 28.71% (79215/275909)
Region Coverage: 28.19% (41019/145525)
Branch Coverage: 24.81% (20903/84260)
Coverage Report: http://coverage.selectdb-in.cc/coverage/d6b2e338a5347ac8e32e5c28b46b1c3231a15745_d6b2e338a5347ac8e32e5c28b46b1c3231a15745/report/index.html

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.08	0.05	0.04
query3	0.23	0.05	0.05
query4	1.68	0.08	0.08
query5	0.51	0.50	0.50
query6	1.14	0.73	0.73
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.56	0.52	0.50
query10	0.54	0.56	0.56
query11	0.16	0.13	0.12
query12	0.15	0.12	0.12
query13	0.61	0.59	0.59
query14	2.93	2.94	2.94
query15	0.92	0.83	0.83
query16	0.36	0.37	0.38
query17	1.08	0.98	1.00
query18	0.18	0.18	0.18
query19	1.90	1.83	2.04
query20	0.01	0.01	0.02
query21	15.38	0.66	0.65
query22	4.20	7.16	1.98
query23	18.25	1.47	1.31
query24	2.09	0.22	0.21
query25	0.14	0.07	0.08
query26	0.28	0.18	0.18
query27	0.07	0.08	0.08
query28	13.33	1.17	1.15
query29	12.60	3.43	3.41
query30	0.25	0.06	0.06
query31	2.88	0.40	0.41
query32	3.22	0.48	0.47
query33	2.98	3.03	3.04
query34	17.12	4.42	4.38
query35	4.46	4.43	4.52
query36	0.65	0.47	0.50
query37	0.20	0.16	0.16
query38	0.16	0.15	0.15
query39	0.05	0.04	0.04
query40	0.16	0.14	0.12
query41	0.10	0.05	0.05
query42	0.06	0.05	0.05
query43	0.05	0.04	0.04
Total cold run time: 111.84 s
Total hot run time: 33.42 s

@morningman
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.32% (9583/25680)
Line Coverage: 28.70% (79183/275916)
Region Coverage: 28.19% (41026/145546)
Branch Coverage: 24.81% (20904/84240)
Coverage Report: http://coverage.selectdb-in.cc/coverage/f0050cb312002a4018507de47e225991d12b9a6a_f0050cb312002a4018507de47e225991d12b9a6a/report/index.html

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17915	7539	7348	7348
q2	2060	168	159	159
q3	10658	1066	1152	1066
q4	10403	797	677	677
q5	7768	3127	3113	3113
q6	239	148	150	148
q7	1011	623	612	612
q8	9447	2091	2097	2091
q9	6951	6458	6452	6452
q10	7016	2330	2291	2291
q11	439	258	247	247
q12	407	215	218	215
q13	17765	3016	2960	2960
q14	252	210	226	210
q15	574	540	539	539
q16	683	640	621	621
q17	989	819	834	819
q18	7482	6758	6675	6675
q19	1398	1095	988	988
q20	589	296	285	285
q21	4169	3228	3282	3228
q22	1111	987	1010	987
Total cold run time: 109326 ms
Total hot run time: 41731 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7296	7270	7288	7270
q2	345	231	236	231
q3	3079	3026	3027	3026
q4	2069	1866	1819	1819
q5	5627	5586	5771	5586
q6	231	145	137	137
q7	2219	1805	1870	1805
q8	3316	3477	3482	3477
q9	8857	8851	8815	8815
q10	3453	3525	3555	3525
q11	594	497	476	476
q12	812	629	629	629
q13	9591	3146	3184	3146
q14	304	291	272	272
q15	564	533	532	532
q16	729	681	683	681
q17	1816	1630	1590	1590
q18	8263	7863	7793	7793
q19	1761	1556	1616	1556
q20	2124	1906	1885	1885
q21	5394	5350	5522	5350
q22	1177	1078	1021	1021
Total cold run time: 69621 ms
Total hot run time: 60622 ms

@doris-robot
Copy link

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

query1	1255	876	856	856
query2	6382	2134	2027	2027
query3	10814	4089	3972	3972
query4	64708	26991	23398	23398
query5	5285	461	474	461
query6	423	162	159	159
query7	5469	297	287	287
query8	310	227	229	227
query9	8443	2654	2643	2643
query10	452	288	269	269
query11	18004	15280	15904	15280
query12	153	106	105	105
query13	1449	412	412	412
query14	10849	7524	7678	7524
query15	202	172	181	172
query16	6502	487	473	473
query17	1143	610	595	595
query18	1465	314	305	305
query19	211	155	156	155
query20	130	120	114	114
query21	221	109	105	105
query22	4643	4646	4728	4646
query23	34913	33942	33826	33826
query24	5985	2858	2870	2858
query25	513	403	410	403
query26	615	158	159	158
query27	1593	287	287	287
query28	4222	2464	2424	2424
query29	664	433	427	427
query30	228	154	166	154
query31	978	790	820	790
query32	75	55	56	55
query33	410	286	291	286
query34	907	486	481	481
query35	821	740	727	727
query36	1053	945	907	907
query37	150	83	86	83
query38	4092	3905	3887	3887
query39	1474	1421	1422	1421
query40	201	103	98	98
query41	50	49	50	49
query42	115	99	94	94
query43	518	498	483	483
query44	1133	805	796	796
query45	195	159	163	159
query46	1142	762	777	762
query47	1902	1792	1803	1792
query48	463	360	367	360
query49	689	401	412	401
query50	831	426	390	390
query51	7056	6946	6898	6898
query52	97	83	87	83
query53	253	173	177	173
query54	569	462	454	454
query55	76	73	74	73
query56	271	262	256	256
query57	1214	1059	1083	1059
query58	217	225	242	225
query59	3066	2908	2894	2894
query60	289	269	262	262
query61	102	101	103	101
query62	747	681	657	657
query63	212	189	179	179
query64	1272	636	629	629
query65	3265	3189	3194	3189
query66	665	297	304	297
query67	15731	15543	15540	15540
query68	4303	576	564	564
query69	444	293	293	293
query70	1206	1121	1133	1121
query71	386	270	270	270
query72	6404	3902	3946	3902
query73	785	339	333	333
query74	9869	9025	8988	8988
query75	3388	2660	2677	2660
query76	1736	925	949	925
query77	492	295	286	286
query78	9913	9119	9178	9119
query79	1092	557	541	541
query80	781	426	430	426
query81	532	238	240	238
query82	1211	140	141	140
query83	241	132	138	132
query84	285	80	77	77
query85	883	283	267	267
query86	326	305	297	297
query87	4395	4343	4291	4291
query88	3266	2339	2337	2337
query89	384	286	273	273
query90	1869	186	178	178
query91	174	145	137	137
query92	61	46	47	46
query93	1077	542	537	537
query94	700	304	298	298
query95	341	247	251	247
query96	607	287	280	280
query97	3257	3088	3074	3074
query98	212	201	199	199
query99	1704	1299	1329	1299
Total cold run time: 311871 ms
Total hot run time: 195487 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.04
query2	0.08	0.04	0.04
query3	0.22	0.06	0.06
query4	1.65	0.09	0.09
query5	0.51	0.50	0.50
query6	1.13	0.76	0.75
query7	0.02	0.01	0.01
query8	0.05	0.04	0.04
query9	0.55	0.50	0.49
query10	0.55	0.58	0.56
query11	0.15	0.11	0.12
query12	0.14	0.12	0.12
query13	0.62	0.60	0.60
query14	2.98	2.94	2.95
query15	0.90	0.83	0.81
query16	0.38	0.38	0.38
query17	1.04	0.99	1.06
query18	0.17	0.17	0.17
query19	1.94	1.86	2.05
query20	0.02	0.01	0.00
query21	15.35	0.67	0.66
query22	3.61	6.91	2.40
query23	18.25	1.33	1.30
query24	2.07	0.22	0.21
query25	0.16	0.08	0.08
query26	0.28	0.18	0.18
query27	0.08	0.07	0.07
query28	13.28	1.15	1.14
query29	12.67	3.37	3.32
query30	0.24	0.05	0.06
query31	2.88	0.42	0.41
query32	3.23	0.49	0.48
query33	3.04	3.01	3.04
query34	17.11	4.40	4.38
query35	4.45	4.45	4.48
query36	0.66	0.49	0.48
query37	0.18	0.16	0.15
query38	0.16	0.15	0.15
query39	0.06	0.04	0.03
query40	0.16	0.12	0.12
query41	0.09	0.05	0.05
query42	0.06	0.05	0.06
query43	0.06	0.05	0.04
Total cold run time: 111.28 s
Total hot run time: 33.77 s

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Sep 23, 2024
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.

Copy link
Contributor

@kaka11chen kaka11chen left a comment

Choose a reason for hiding this comment

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

LGTM

@morningman morningman merged commit 370ddd8 into apache:master Sep 24, 2024
23 of 28 checks passed
morningman added a commit to morningman/doris that referenced this pull request Sep 24, 2024
Support new grammar:  `table_name$partitions`

User can query partition info by using:

```
select * from table_name$partitions
```

`table_name$partitions` is a special meta table corresponding to the
table.

Its schema is the partition columns of the table, and column type is
always "String".
And the value is the partition column's value

You can use `DESC table_name$partitions` to get schema:

```
mysql> desc partition_values_all_types$partitions;
+-------+----------------+------+------+---------+-------+
| Field | Type           | Null | Key  | Default | Extra |
+-------+----------------+------+------+---------+-------+
| p1    | boolean        | Yes  | true | NULL    | NONE  |
| p2    | tinyint        | Yes  | true | NULL    | NONE  |
| p3    | smallint       | Yes  | true | NULL    | NONE  |
| p4    | int            | Yes  | true | NULL    | NONE  |
| p5    | bigint         | Yes  | true | NULL    | NONE  |
| p6    | date           | Yes  | true | NULL    | NONE  |
| p7    | datetime(6)    | Yes  | true | NULL    | NONE  |
| p8    | varchar(65533) | Yes  | true | NULL    | NONE  |
| p9    | decimal(9,2)   | Yes  | true | NULL    | NONE  |
| p10   | decimal(18,10) | Yes  | true | NULL    | NONE  |
| p11   | decimal(38,9)  | Yes  | true | NULL    | NONE  |
+-------+----------------+------+------+---------+-------+
```
Where `px` are partition columns of table `partition_values_all_types`;

```
mysql> select * from partition_values_all_types$partitions order by p1,p2,p3;
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| p1   | p2   | p3     | p4          | p5                   | p6         | p7                         | p8     | p9          | p10                  | p11                                      |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| NULL | NULL |   NULL |        NULL |                 NULL | NULL       | NULL                       | NULL   |        NULL |                 NULL |                                     NULL |
|    0 | -128 | -32768 | -2147483648 | -9223372036854775808 | 1900-01-01 | 1899-01-01 23:59:59.000000 | NULL   | -9999999.99 | -99999999.9999999999 | -99999999999999999999999999999.999999999 |
|    0 |  127 |  32767 |  2147483647 |  9223372036854775807 | 9999-12-31 | 0001-01-01 00:00:01.321000 | boston |  9999999.99 |  99999999.9999999999 |  99999999999999999999999999999.999999999 |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
```

Currently, this grammar can only be used for partition table's in Hive
Catalog.
Table in other catalogs or non partition table can not use this grammar.

Internally, it is implemented as a table valued function:
`partition_values`

```
mysql> select * from partition_values("catalog" = "hive", "database" = "multi_catalog", "table" = "partition_values_all_types");
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| p1   | p2   | p3     | p4          | p5                   | p6         | p7                         | p8     | p9          | p10                  | p11                                      |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
|    0 |  127 |  32767 |  2147483647 |  9223372036854775807 | 9999-12-31 | 0001-01-01 00:00:01.321000 | boston |  9999999.99 |  99999999.9999999999 |  99999999999999999999999999999.999999999 |
|    0 | -128 | -32768 | -2147483648 | -9223372036854775808 | 1900-01-01 | 1899-01-01 23:59:59.000000 | NULL   | -9999999.99 | -99999999.9999999999 | -99999999999999999999999999999.999999999 |
| NULL | NULL |   NULL |        NULL |                 NULL | NULL       | NULL                       | NULL   |        NULL |                 NULL |                                     NULL |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
```
morningman added a commit that referenced this pull request Sep 25, 2024
…41230)

bp #40774
and pick part of #34552, add `isPartitionedTable()` interface in `TableIf`
dataroaring pushed a commit that referenced this pull request Oct 9, 2024
Support new grammar:  `table_name$partitions`

User can query partition info by using:

```
select * from table_name$partitions
```

`table_name$partitions` is a special meta table corresponding to the
table.

Its schema is the partition columns of the table, and column type is
always "String".
And the value is the partition column's value

You can use `DESC table_name$partitions` to get schema:

```
mysql> desc partition_values_all_types$partitions;
+-------+----------------+------+------+---------+-------+
| Field | Type           | Null | Key  | Default | Extra |
+-------+----------------+------+------+---------+-------+
| p1    | boolean        | Yes  | true | NULL    | NONE  |
| p2    | tinyint        | Yes  | true | NULL    | NONE  |
| p3    | smallint       | Yes  | true | NULL    | NONE  |
| p4    | int            | Yes  | true | NULL    | NONE  |
| p5    | bigint         | Yes  | true | NULL    | NONE  |
| p6    | date           | Yes  | true | NULL    | NONE  |
| p7    | datetime(6)    | Yes  | true | NULL    | NONE  |
| p8    | varchar(65533) | Yes  | true | NULL    | NONE  |
| p9    | decimal(9,2)   | Yes  | true | NULL    | NONE  |
| p10   | decimal(18,10) | Yes  | true | NULL    | NONE  |
| p11   | decimal(38,9)  | Yes  | true | NULL    | NONE  |
+-------+----------------+------+------+---------+-------+
```
Where `px` are partition columns of table `partition_values_all_types`;

```
mysql> select * from partition_values_all_types$partitions order by p1,p2,p3;
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| p1   | p2   | p3     | p4          | p5                   | p6         | p7                         | p8     | p9          | p10                  | p11                                      |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| NULL | NULL |   NULL |        NULL |                 NULL | NULL       | NULL                       | NULL   |        NULL |                 NULL |                                     NULL |
|    0 | -128 | -32768 | -2147483648 | -9223372036854775808 | 1900-01-01 | 1899-01-01 23:59:59.000000 | NULL   | -9999999.99 | -99999999.9999999999 | -99999999999999999999999999999.999999999 |
|    0 |  127 |  32767 |  2147483647 |  9223372036854775807 | 9999-12-31 | 0001-01-01 00:00:01.321000 | boston |  9999999.99 |  99999999.9999999999 |  99999999999999999999999999999.999999999 |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
```

Currently, this grammar can only be used for partition table's in Hive
Catalog.
Table in other catalogs or non partition table can not use this grammar.

Internally, it is implemented as a table valued function:
`partition_values`

```
mysql> select * from partition_values("catalog" = "hive", "database" = "multi_catalog", "table" = "partition_values_all_types");
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
| p1   | p2   | p3     | p4          | p5                   | p6         | p7                         | p8     | p9          | p10                  | p11                                      |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
|    0 |  127 |  32767 |  2147483647 |  9223372036854775807 | 9999-12-31 | 0001-01-01 00:00:01.321000 | boston |  9999999.99 |  99999999.9999999999 |  99999999999999999999999999999.999999999 |
|    0 | -128 | -32768 | -2147483648 | -9223372036854775808 | 1900-01-01 | 1899-01-01 23:59:59.000000 | NULL   | -9999999.99 | -99999999.9999999999 | -99999999999999999999999999999.999999999 |
| NULL | NULL |   NULL |        NULL |                 NULL | NULL       | NULL                       | NULL   |        NULL |                 NULL |                                     NULL |
+------+------+--------+-------------+----------------------+------------+----------------------------+--------+-------------+----------------------+------------------------------------------+
```
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.

5 participants