Skip to content

[feat](paimon) support jdbc catalog type - #61094

Merged
morningman merged 13 commits into
apache:masterfrom
xylaaaaa:feat/paimon-jdbc-catalog
Mar 12, 2026
Merged

morningman merged 13 commits into
apache:masterfrom
xylaaaaa:feat/paimon-jdbc-catalog

Conversation

@xylaaaaa

@xylaaaaa xylaaaaa commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add Paimon JDBC metastore properties and driver loading support
  • register paimon.catalog.type=jdbc in paimon properties/catalog factory
  • allow paimon jdbc type in external table/system table thrift conversion
  • add FE unit tests for jdbc properties mapping and validation

Test

  • ./run-fe-ut.sh --run org.apache.doris.datasource.property.metastore.PaimonJdbcMetaStorePropertiesTest

Copilot AI review requested due to automatic review settings March 6, 2026 02:14
@hello-stephen

Copy link
Copy Markdown
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?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds support for Apache Paimon JDBC catalog type in FE by introducing JDBC-specific metastore properties (including optional dynamic JDBC driver loading), wiring the new type through the Paimon properties factory, and enabling thrift conversion paths to accept paimon.catalog.type=jdbc.

Changes:

  • Introduce PaimonJdbcMetaStoreProperties and register paimon.catalog.type=jdbc in the Paimon metastore properties factory.
  • Extend Paimon external catalog/table thrift conversion to treat jdbc as a supported catalog type.
  • Add FE unit tests covering JDBC property mapping, passthrough, and validation.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/PaimonJdbcMetaStoreProperties.java New Paimon JDBC metastore implementation with JDBC options mapping and dynamic driver registration.
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/PaimonPropertiesFactory.java Registers jdbc as a supported Paimon catalog subtype.
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalCatalog.java Adds PAIMON_JDBC constant for catalog type.
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalCatalogFactory.java Allows creating Paimon catalogs with jdbc type.
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java Treats jdbc as a supported Paimon catalog type for thrift conversion.
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonSysExternalTable.java Treats jdbc as a supported Paimon catalog type for thrift conversion.
fe/fe-core/src/test/java/org/apache/doris/datasource/property/metastore/PaimonJdbcMetaStorePropertiesTest.java New unit tests for JDBC properties mapping/validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +167 to +171
Class<?> loadedDriverClass = Class.forName(driverClassName, true, classLoader);
java.sql.Driver driver = (java.sql.Driver) loadedDriverClass.getDeclaredConstructor().newInstance();
java.sql.DriverManager.registerDriver(new DriverShim(driver));
LOG.info("Successfully registered JDBC driver for Paimon catalog: {} from {}",
driverClassName, fullDriverUrl);

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

registerJdbcDriver calls DriverManager.registerDriver(new DriverShim(driver)) every time the catalog is initialized. Since DriverManager keeps a global static list, repeated initialization (or multiple catalogs using the same driver URL/class) will accumulate duplicate driver instances and classloaders, leading to memory/permgen pressure and slower driver resolution. Consider tracking already-registered (driverUrl, driverClass) pairs (or checking DriverManager.getDrivers() for an existing shim) and skipping registration when it’s already registered.

Copilot uses AI. Check for mistakes.
Comment on lines +157 to +160
ClassLoader classLoader = DRIVER_CLASS_LOADER_CACHE.computeIfAbsent(url, u -> {
ClassLoader parent = getClass().getClassLoader();
return URLClassLoader.newInstance(new URL[] {u}, parent);
});

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

DRIVER_CLASS_LOADER_CACHE.computeIfAbsent(...) permanently caches a classloader for a URL. If driver loading fails (bad jar, transient download issue, wrong class), the cached entry can keep subsequent retries stuck using the same (potentially poisoned) loader. Consider removing the cache entry on failures (e.g., in the ClassNotFoundException/generic catch path) so users can fix the driver and retry without restarting FE.

Copilot uses AI. Check for mistakes.
Comment on lines +183 to +187
private static class DriverShim implements java.sql.Driver {
private final java.sql.Driver delegate;

DriverShim(java.sql.Driver delegate) {
this.delegate = delegate;

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

The nested DriverShim is duplicated in IcebergJdbcMetaStoreProperties with the same behavior. Consider extracting a shared utility/shim to avoid divergence when future fixes are needed (e.g., preventing duplicate registrations, cache invalidation).

Copilot uses AI. Check for mistakes.
} else {
throw new IllegalArgumentException(
"Currently only supports hms/dlf/rest/filesystem catalog, do not support :" + catalogType);
"Currently only supports hms/dlf/rest/filesystem/jdbc catalog, do not support :" + catalogType);

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

Error message formatting: the string contains an extra space before the colon ("do not support :"), which reads awkwardly and makes log/error matching harder. Consider changing to "do not support: " + catalogType (also adding a space after the colon for readability).

Suggested change
"Currently only supports hms/dlf/rest/filesystem/jdbc catalog, do not support :" + catalogType);
"Currently only supports hms/dlf/rest/filesystem/jdbc catalog, do not support: " + catalogType);

Copilot uses AI. Check for mistakes.
} else {
throw new IllegalArgumentException(
"Currently only supports hms/dlf/rest/filesystem catalog, do not support :"
"Currently only supports hms/dlf/rest/filesystem/jdbc catalog, do not support :"

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

Error message formatting: this string includes "do not support :" (space before colon). Consider changing to "do not support: " + getPaimonCatalogType() for consistent, cleaner messages.

Suggested change
"Currently only supports hms/dlf/rest/filesystem/jdbc catalog, do not support :"
"Currently only supports hms/dlf/rest/filesystem/jdbc catalog, do not support: "

Copilot uses AI. Check for mistakes.
@xylaaaaa

xylaaaaa commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@xylaaaaa

xylaaaaa commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot

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

------ Round 1 ----------------------------------
============================================
q1	17642	4628	4342	4342
q2	q3	10647	800	508	508
q4	4675	376	253	253
q5	7560	1208	997	997
q6	172	173	144	144
q7	791	834	657	657
q8	9296	1445	1297	1297
q9	4819	4728	4670	4670
q10	6236	1882	1641	1641
q11	483	253	261	253
q12	739	565	481	481
q13	18050	2960	2189	2189
q14	226	222	217	217
q15	926	797	805	797
q16	757	716	677	677
q17	725	859	419	419
q18	6039	5284	5301	5284
q19	1121	978	610	610
q20	498	486	390	390
q21	4426	2035	1515	1515
q22	434	301	264	264
Total cold run time: 96262 ms
Total hot run time: 27605 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4772	4565	4508	4508
q2	q3	3850	4331	3830	3830
q4	861	1234	786	786
q5	4074	4402	4316	4316
q6	184	180	149	149
q7	1764	1677	1543	1543
q8	2500	2832	2569	2569
q9	7484	7411	7481	7411
q10	3819	4081	3584	3584
q11	526	429	410	410
q12	468	588	446	446
q13	2698	3209	2496	2496
q14	285	296	272	272
q15	878	810	845	810
q16	733	789	724	724
q17	1156	1396	1316	1316
q18	7227	6909	6760	6760
q19	901	898	872	872
q20	2055	2162	2007	2007
q21	3970	3491	3358	3358
q22	564	443	395	395
Total cold run time: 50769 ms
Total hot run time: 48562 ms

@doris-robot

Copy link
Copy Markdown
TPC-DS: Total hot run time: 152524 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 4a4b729dafe44c271b0ff5e3f8e7796346204f60, data reload: false

query5	4323	648	520	520
query6	319	215	204	204
query7	4203	468	260	260
query8	327	236	228	228
query9	8757	2741	2769	2741
query10	485	384	329	329
query11	7366	5927	5558	5558
query12	182	125	123	123
query13	1266	451	348	348
query14	6318	3824	3594	3594
query14_1	2817	2816	2801	2801
query15	203	192	175	175
query16	995	506	460	460
query17	1083	719	585	585
query18	2509	439	338	338
query19	207	204	175	175
query20	137	124	128	124
query21	221	139	121	121
query22	5086	4766	4696	4696
query23	15926	15538	15217	15217
query23_1	15444	16318	15791	15791
query24	7670	1733	1301	1301
query24_1	1323	1303	1264	1264
query25	598	527	437	437
query26	1628	306	170	170
query27	2947	502	310	310
query28	5000	1992	1923	1923
query29	847	571	473	473
query30	309	242	208	208
query31	1392	1274	1218	1218
query32	81	69	71	69
query33	508	318	272	272
query34	922	939	569	569
query35	639	672	602	602
query36	1127	1094	1003	1003
query37	129	104	78	78
query38	2923	2976	2851	2851
query39	887	844	847	844
query39_1	824	825	805	805
query40	230	148	133	133
query41	62	56	56	56
query42	307	301	300	300
query43	230	241	219	219
query44	
query45	192	190	188	188
query46	882	977	600	600
query47	2132	2138	2066	2066
query48	327	315	222	222
query49	620	452	377	377
query50	693	278	206	206
query51	4230	4096	4039	4039
query52	288	291	278	278
query53	323	333	288	288
query54	295	275	254	254
query55	91	80	85	80
query56	302	315	305	305
query57	1372	1340	1277	1277
query58	282	287	274	274
query59	1300	1393	1291	1291
query60	348	333	318	318
query61	153	146	162	146
query62	630	587	549	549
query63	315	280	270	270
query64	4984	1267	980	980
query65	
query66	1424	454	353	353
query67	16397	16596	16331	16331
query68	
query69	382	318	285	285
query70	985	993	965	965
query71	340	305	302	302
query72	2864	3048	2591	2591
query73	541	548	329	329
query74	9961	9994	9814	9814
query75	2872	2778	2475	2475
query76	2316	1041	683	683
query77	370	374	317	317
query78	11231	11364	10687	10687
query79	1127	798	605	605
query80	942	660	576	576
query81	524	278	245	245
query82	1336	151	118	118
query83	373	261	234	234
query84	244	114	98	98
query85	867	465	440	440
query86	413	322	295	295
query87	3140	3088	2975	2975
query88	3538	2660	2651	2651
query89	418	372	341	341
query90	1869	174	174	174
query91	159	162	134	134
query92	73	76	68	68
query93	920	841	509	509
query94	517	319	274	274
query95	587	396	325	325
query96	651	515	233	233
query97	2485	2476	2398	2398
query98	225	216	215	215
query99	994	999	919	919
Total cold run time: 234662 ms
Total hot run time: 152524 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 42.86% (33/77) 🎉
Increment coverage report
Complete coverage report

@xylaaaaa

xylaaaaa commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 1.30% (1/77) 🎉
Increment coverage report
Complete coverage report

@doris-robot

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

------ Round 1 ----------------------------------
============================================
q1	17600	4452	4312	4312
q2	q3	10649	776	514	514
q4	4684	362	251	251
q5	7568	1192	1009	1009
q6	177	174	148	148
q7	775	841	666	666
q8	9317	1445	1300	1300
q9	4748	4794	4728	4728
q10	6255	1912	1650	1650
q11	463	268	248	248
q12	734	568	473	473
q13	18031	2916	2186	2186
q14	237	244	216	216
q15	895	804	800	800
q16	739	710	675	675
q17	711	872	399	399
q18	5865	5384	5233	5233
q19	1275	971	608	608
q20	505	505	385	385
q21	4712	2045	1550	1550
q22	357	333	278	278
Total cold run time: 96297 ms
Total hot run time: 27629 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4675	4593	4565	4565
q2	q3	3836	4332	3810	3810
q4	900	1186	810	810
q5	4053	4332	4354	4332
q6	186	179	144	144
q7	1768	1633	1527	1527
q8	2434	2703	2596	2596
q9	7718	7455	7359	7359
q10	3781	3970	3605	3605
q11	507	430	415	415
q12	509	594	443	443
q13	2684	3111	2334	2334
q14	287	310	281	281
q15	855	801	787	787
q16	723	753	869	753
q17	1165	1464	1332	1332
q18	7218	6862	6660	6660
q19	949	871	906	871
q20	2082	2207	2101	2101
q21	4100	3611	3384	3384
q22	467	420	386	386
Total cold run time: 50897 ms
Total hot run time: 48495 ms

@doris-robot

Copy link
Copy Markdown
TPC-DS: Total hot run time: 153208 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 a60413017ecbda3dc6afb928481df92273c5980a, data reload: false

query5	4354	621	499	499
query6	341	228	211	211
query7	4223	472	273	273
query8	350	248	233	233
query9	8764	2707	2770	2707
query10	527	380	330	330
query11	7416	5763	5616	5616
query12	187	132	129	129
query13	1270	467	360	360
query14	5758	3816	3557	3557
query14_1	2814	2790	2757	2757
query15	202	191	184	184
query16	988	462	440	440
query17	903	730	626	626
query18	2449	444	358	358
query19	222	213	186	186
query20	145	130	133	130
query21	224	146	130	130
query22	5022	4955	4849	4849
query23	16584	15805	15789	15789
query23_1	15822	15667	15785	15667
query24	7865	1622	1210	1210
query24_1	1238	1238	1242	1238
query25	541	466	404	404
query26	1229	259	154	154
query27	2782	485	282	282
query28	4508	1854	1853	1853
query29	847	553	481	481
query30	311	245	214	214
query31	1371	1284	1212	1212
query32	91	75	72	72
query33	528	338	322	322
query34	928	936	556	556
query35	631	718	579	579
query36	1092	1142	989	989
query37	130	97	82	82
query38	2915	2896	2885	2885
query39	898	877	863	863
query39_1	818	815	805	805
query40	233	156	134	134
query41	62	58	57	57
query42	310	298	318	298
query43	244	246	222	222
query44	
query45	198	188	185	185
query46	884	978	608	608
query47	2105	2113	2054	2054
query48	318	312	243	243
query49	623	455	374	374
query50	674	276	215	215
query51	4108	4150	4052	4052
query52	290	288	288	288
query53	289	335	292	292
query54	294	280	261	261
query55	90	87	79	79
query56	313	322	308	308
query57	1381	1343	1274	1274
query58	288	282	271	271
query59	1306	1452	1320	1320
query60	351	330	311	311
query61	143	179	147	147
query62	617	585	538	538
query63	307	276	280	276
query64	5093	1294	1000	1000
query65	
query66	1461	460	352	352
query67	16392	16412	16356	16356
query68	
query69	389	310	274	274
query70	1029	966	946	946
query71	334	301	294	294
query72	2765	2723	2708	2708
query73	546	542	323	323
query74	9972	9953	9796	9796
query75	2880	2761	2491	2491
query76	2295	1045	693	693
query77	377	397	310	310
query78	11105	11371	10664	10664
query79	1143	803	594	594
query80	760	653	568	568
query81	503	277	246	246
query82	1363	170	130	130
query83	397	275	255	255
query84	306	126	111	111
query85	945	567	534	534
query86	366	303	302	302
query87	3175	3101	2996	2996
query88	3494	2637	2633	2633
query89	422	371	341	341
query90	1992	175	177	175
query91	171	159	140	140
query92	76	76	69	69
query93	1014	827	506	506
query94	459	331	308	308
query95	584	408	310	310
query96	633	518	223	223
query97	2450	2472	2404	2404
query98	229	235	218	218
query99	1025	981	930	930
Total cold run time: 233821 ms
Total hot run time: 153208 ms

@xylaaaaa

xylaaaaa commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot

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

------ Round 1 ----------------------------------
============================================
q1	17685	4525	4288	4288
q2	q3	10648	784	508	508
q4	4677	357	272	272
q5	7564	1184	1025	1025
q6	182	177	149	149
q7	790	840	673	673
q8	9312	1472	1337	1337
q9	4847	4686	4460	4460
q10	6306	1906	1639	1639
q11	476	253	242	242
q12	768	565	471	471
q13	18068	2918	2193	2193
q14	228	234	219	219
q15	933	786	801	786
q16	780	724	676	676
q17	739	867	395	395
q18	5843	5373	5142	5142
q19	1115	1000	669	669
q20	500	483	391	391
q21	4480	1952	1603	1603
q22	411	338	265	265
Total cold run time: 96352 ms
Total hot run time: 27403 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4676	4677	4680	4677
q2	q3	3846	4371	3812	3812
q4	879	1209	770	770
q5	4029	4354	4322	4322
q6	194	174	144	144
q7	1749	1637	1556	1556
q8	2505	2781	2606	2606
q9	7433	7372	7289	7289
q10	3788	4105	3577	3577
q11	505	433	432	432
q12	504	598	480	480
q13	2738	3289	2500	2500
q14	282	299	281	281
q15	843	813	810	810
q16	708	749	728	728
q17	1165	1741	1377	1377
q18	7190	6945	6650	6650
q19	931	917	961	917
q20	2078	2156	2024	2024
q21	3947	3414	3391	3391
q22	467	423	390	390
Total cold run time: 50457 ms
Total hot run time: 48733 ms

@doris-robot

Copy link
Copy Markdown
TPC-DS: Total hot run time: 154038 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 a2afce4f42d587af683650c8efd9353bd73d54b6, data reload: false

query5	4328	655	548	548
query6	320	223	205	205
query7	4208	472	263	263
query8	328	237	228	228
query9	8713	2740	2730	2730
query10	544	399	353	353
query11	7376	5896	5651	5651
query12	177	123	120	120
query13	1252	467	344	344
query14	5727	3776	3600	3600
query14_1	2884	2804	2777	2777
query15	204	187	174	174
query16	993	471	456	456
query17	1000	687	602	602
query18	2435	447	366	366
query19	207	205	174	174
query20	128	132	125	125
query21	223	142	122	122
query22	4885	4978	4796	4796
query23	16420	16008	15951	15951
query23_1	15676	15747	15842	15747
query24	8408	1694	1288	1288
query24_1	1282	1405	1332	1332
query25	589	522	486	486
query26	1807	305	184	184
query27	2892	551	320	320
query28	4496	1884	1877	1877
query29	901	589	521	521
query30	310	247	207	207
query31	1364	1265	1229	1229
query32	88	70	74	70
query33	507	338	268	268
query34	924	913	561	561
query35	631	683	596	596
query36	1062	1095	964	964
query37	135	96	85	85
query38	2926	2901	2937	2901
query39	889	877	855	855
query39_1	857	806	825	806
query40	231	152	134	134
query41	66	62	59	59
query42	309	308	291	291
query43	254	254	223	223
query44	
query45	192	192	184	184
query46	892	977	618	618
query47	2091	2124	2064	2064
query48	313	306	234	234
query49	632	460	380	380
query50	680	277	211	211
query51	4094	4213	4029	4029
query52	289	302	281	281
query53	290	345	295	295
query54	300	276	272	272
query55	93	85	81	81
query56	318	313	321	313
query57	1364	1341	1266	1266
query58	284	280	278	278
query59	1355	1460	1300	1300
query60	368	322	325	322
query61	154	142	147	142
query62	637	592	532	532
query63	308	275	283	275
query64	5061	1294	991	991
query65	
query66	1459	478	366	366
query67	16319	16536	16291	16291
query68	
query69	383	312	296	296
query70	948	972	955	955
query71	345	316	308	308
query72	2791	2764	2705	2705
query73	540	563	333	333
query74	10025	9875	9803	9803
query75	2909	2808	2461	2461
query76	2304	1039	688	688
query77	384	398	324	324
query78	11186	11330	10645	10645
query79	1155	874	620	620
query80	1335	645	586	586
query81	564	280	280	280
query82	1024	153	124	124
query83	352	277	246	246
query84	282	127	100	100
query85	972	563	490	490
query86	409	316	328	316
query87	3165	3129	3027	3027
query88	3587	2682	2668	2668
query89	426	371	348	348
query90	2005	188	179	179
query91	159	163	143	143
query92	76	84	74	74
query93	1007	833	529	529
query94	654	329	302	302
query95	579	407	319	319
query96	636	525	229	229
query97	2512	2493	2394	2394
query98	230	218	217	217
query99	1012	974	909	909
Total cold run time: 235843 ms
Total hot run time: 154038 ms

@xylaaaaa

xylaaaaa commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot

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

------ Round 1 ----------------------------------
============================================
q1	17644	4550	4303	4303
q2	q3	10647	780	516	516
q4	4682	360	260	260
q5	7558	1183	1020	1020
q6	172	177	148	148
q7	776	818	668	668
q8	9311	1441	1318	1318
q9	4914	4733	5035	4733
q10	6310	1900	1649	1649
q11	467	247	255	247
q12	757	573	456	456
q13	18049	2983	2190	2190
q14	233	225	213	213
q15	913	791	814	791
q16	749	723	685	685
q17	708	841	409	409
q18	5913	5467	5324	5324
q19	1134	978	600	600
q20	500	488	393	393
q21	4516	2125	1477	1477
q22	353	326	275	275
Total cold run time: 96306 ms
Total hot run time: 27675 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4767	4622	4531	4531
q2	q3	3901	4326	3802	3802
q4	850	1189	767	767
q5	3999	4390	4314	4314
q6	188	169	140	140
q7	1745	1717	1561	1561
q8	2547	2731	2562	2562
q9	7468	7372	7341	7341
q10	3827	4026	3559	3559
q11	503	421	418	418
q12	475	599	446	446
q13	2711	3223	2300	2300
q14	275	293	269	269
q15	862	814	827	814
q16	704	763	746	746
q17	1139	1372	1318	1318
q18	7238	6705	6558	6558
q19	913	922	880	880
q20	2091	2150	1983	1983
q21	3985	3466	3434	3434
q22	491	447	369	369
Total cold run time: 50679 ms
Total hot run time: 48112 ms

@doris-robot

Copy link
Copy Markdown
TPC-DS: Total hot run time: 152762 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 465746c188ba4b4e0b3d2c505d4cf76ee247ee0b, data reload: false

query5	4369	634	517	517
query6	336	224	199	199
query7	4216	465	262	262
query8	349	250	235	235
query9	8726	2763	2761	2761
query10	530	364	331	331
query11	7393	5850	5552	5552
query12	185	124	119	119
query13	1252	426	330	330
query14	5641	3867	3503	3503
query14_1	2798	2760	2767	2760
query15	211	190	171	171
query16	968	476	455	455
query17	1032	748	630	630
query18	2436	451	349	349
query19	218	213	184	184
query20	141	126	127	126
query21	223	145	128	128
query22	4911	4813	4633	4633
query23	16711	16112	15813	15813
query23_1	15775	15910	15843	15843
query24	8493	1707	1285	1285
query24_1	1302	1276	1280	1276
query25	609	541	456	456
query26	1505	277	172	172
query27	2977	507	297	297
query28	4507	1871	1889	1871
query29	850	594	499	499
query30	316	250	215	215
query31	1373	1289	1233	1233
query32	90	72	70	70
query33	522	336	296	296
query34	959	919	565	565
query35	640	690	614	614
query36	1072	1097	973	973
query37	130	97	88	88
query38	2927	2881	2886	2881
query39	931	874	858	858
query39_1	835	850	833	833
query40	233	157	142	142
query41	69	67	66	66
query42	316	307	296	296
query43	237	262	220	220
query44	
query45	194	232	182	182
query46	882	981	607	607
query47	2095	2129	2018	2018
query48	311	327	223	223
query49	631	455	380	380
query50	670	274	218	218
query51	4130	4141	4129	4129
query52	288	290	284	284
query53	285	341	284	284
query54	295	276	271	271
query55	98	86	85	85
query56	312	336	311	311
query57	1374	1339	1277	1277
query58	285	274	267	267
query59	1344	1441	1315	1315
query60	342	322	331	322
query61	146	147	147	147
query62	624	587	527	527
query63	313	283	273	273
query64	5019	1262	1017	1017
query65	
query66	1451	444	369	369
query67	16411	16442	16136	16136
query68	
query69	393	306	284	284
query70	991	986	945	945
query71	344	315	299	299
query72	2833	2627	2411	2411
query73	540	547	326	326
query74	9969	9945	9764	9764
query75	2857	2755	2446	2446
query76	2298	1017	692	692
query77	351	376	317	317
query78	11211	11392	10661	10661
query79	1161	800	590	590
query80	996	613	557	557
query81	546	285	254	254
query82	1355	154	118	118
query83	349	270	242	242
query84	268	127	96	96
query85	1010	493	438	438
query86	420	339	303	303
query87	3159	3094	2988	2988
query88	3513	2635	2638	2635
query89	422	366	347	347
query90	1829	172	172	172
query91	179	166	135	135
query92	75	75	73	73
query93	913	824	505	505
query94	529	321	287	287
query95	587	332	321	321
query96	662	521	226	226
query97	2450	2459	2420	2420
query98	245	221	224	221
query99	1026	1004	913	913
Total cold run time: 235478 ms
Total hot run time: 152762 ms

@morningman

Copy link
Copy Markdown
Contributor

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review Summary: feat support jdbc catalog type

Goal

Add Paimon JDBC metastore support, allowing users to create Paimon catalogs backed by a JDBC-based metastore (e.g., PostgreSQL/MySQL). The code follows the established pattern from IcebergJdbcMetaStoreProperties.

Critical Checkpoint Conclusions

  1. Does the code accomplish the goal? Is there a test? — Yes, the core FE plumbing is correct: factory registration, catalog type constants, thrift conversion, and property binding all follow existing patterns. FE unit tests cover property mapping and validation. A regression test is provided but has a significant correctness issue (see below).

  2. Is the modification minimal and focused? — Yes. 9 files changed, ~608 additions. The scope is appropriate.

  3. Concurrency? — The DRIVER_CLASS_LOADER_CACHE uses ConcurrentHashMap.computeIfAbsent, which is thread-safe. However, registerJdbcDriver unconditionally calls DriverManager.registerDriver() on every initializeCatalog() invocation without deduplication, leading to driver leak (see inline comment). This is a pre-existing issue copied from IcebergJdbcMetaStoreProperties but should be fixed here rather than propagated.

  4. Lifecycle management? — URLClassLoader instances are cached forever in a static map. Acceptable for a long-running server with a small set of drivers, consistent with JdbcClient pattern.

  5. Incompatible changes? — No. This is purely additive.

  6. Parallel code paths? — All 3 locations enumerating Paimon catalog types (PaimonExternalTable.toThrift, PaimonSysExternalTable.toThrift, PaimonExternalCatalogFactory) have been updated. PaimonMetadataOps.performCreateDb is intentionally HMS-only and does not need changes.

  7. Test coverage? — FE unit tests cover property binding, required field validation, and factory dispatch. Regression test has a likely correctness issue: the Spark seed catalog uses metastore=filesystem while Doris uses JDBC metastore. Data written by Spark via filesystem metastore won't have table metadata registered in the JDBC metastore, so the query through the JDBC catalog may not see the Spark-written data. The test needs the Spark seed catalog to also use metastore=jdbc pointing to the same PostgreSQL instance.

  8. Observability? — Adequate LOG.info for driver registration success.

  9. Performance? — No concerns. The java.net.URL as ConcurrentHashMap key is a known Java footgun (DNS resolution in equals/hashCode), but for file:// URLs this is benign. Consistent with existing IcebergJdbcMetaStoreProperties.

  10. Other issues? — The driverClassName blank check happens AFTER the ClassLoader is already created/cached. Should validate before the computeIfAbsent call to avoid unnecessary ClassLoader creation.

Issues Found

  • [Medium] Driver leak: DriverManager.registerDriver called on every initializeCatalog with no deduplication guard
  • [Medium] Regression test Spark seed catalog uses filesystem metastore instead of jdbc, data may not be visible
  • [Low] Parameter validation order: driverClassName blank check should precede DRIVER_CLASS_LOADER_CACHE.computeIfAbsent


Class<?> loadedDriverClass = Class.forName(driverClassName, true, classLoader);
java.sql.Driver driver = (java.sql.Driver) loadedDriverClass.getDeclaredConstructor().newInstance();
java.sql.DriverManager.registerDriver(new DriverShim(driver));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Medium] Driver leak: DriverManager.registerDriver called without deduplication.

registerJdbcDriver is called from initializeCatalog() which can be invoked multiple times (catalog creation, refresh, etc.). Each call registers a new DriverShim with DriverManager. There is no corresponding deregisterDriver or deduplication guard.

Over time, DriverManager's internal list grows unboundedly. Each DriverShim holds a reference to the actual driver and its ClassLoader, preventing garbage collection. DriverManager.getConnection() iterates all registered drivers, so this also has a progressive performance impact.

This is a pre-existing issue copied from IcebergJdbcMetaStoreProperties, but it would be good to fix it here rather than propagate. Suggested fix:

private static final Set<URL> REGISTERED_DRIVER_URLS = ConcurrentHashMap.newKeySet();

// In registerJdbcDriver, before the registerDriver call:
if (!REGISTERED_DRIVER_URLS.add(url)) {
    LOG.info("JDBC driver already registered for URL: {}", url);
    return;
}

return URLClassLoader.newInstance(new URL[] {u}, parent);
});

if (StringUtils.isBlank(driverClassName)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Low] Validation order: check driverClassName before creating ClassLoader.

The StringUtils.isBlank(driverClassName) check happens after DRIVER_CLASS_LOADER_CACHE.computeIfAbsent(url, ...) which may create a new URLClassLoader. If driverClassName is blank, this ClassLoader is created for nothing (and cached permanently).

Move this check before the computeIfAbsent call:

if (StringUtils.isBlank(driverClassName)) {
    throw new IllegalArgumentException(...);
}
ClassLoader classLoader = DRIVER_CLASS_LOADER_CACHE.computeIfAbsent(url, u -> { ... });

String escapedSql = sqlText.replaceAll('"', '\\\\"')
String command = """docker exec ${sparkContainerName} spark-sql --master spark://${sparkContainerName}:7077 \
--conf spark.sql.extensions=org.apache.paimon.spark.extensions.PaimonSparkSessionExtensions \
--conf spark.sql.catalog.${sparkSeedCatalogName}=org.apache.paimon.spark.SparkCatalog \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Medium] Spark seed catalog uses metastore=filesystem but Doris catalog uses JDBC metastore.

The Doris catalog is created with paimon.catalog.type=jdbc backed by PostgreSQL. But the Spark seed catalog here uses metastore=filesystem. When Spark writes data via the filesystem metastore, the table metadata is stored on S3 as filesystem-based metadata files. The Doris JDBC catalog looks for metadata in PostgreSQL, not on S3 filesystem metadata files.

This means the INSERT done via Spark may not be visible when querying through the Doris JDBC catalog, because the JDBC metastore doesn't know about the data written by the filesystem metastore.

The Spark seed catalog should use metastore=jdbc pointing to the same PostgreSQL instance, e.g.:

--conf spark.sql.catalog.${sparkSeedCatalogName}.metastore=jdbc \
--conf spark.sql.catalog.${sparkSeedCatalogName}.uri=jdbc:postgresql://${externalEnvIp}:${jdbcPort}/postgres \
--conf spark.sql.catalog.${sparkSeedCatalogName}.jdbc.user=postgres \
--conf spark.sql.catalog.${sparkSeedCatalogName}.jdbc.password=123456 \

Alternatively, if the intent is to test that JDBC catalog can read data written on the same storage path by another tool, then the test design should be documented with a clear comment explaining this, and the table creation through Doris SQL (which registers in JDBC metastore) should be sufficient for metadata. But then Spark should NOT recreate/shadow the table metadata.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 34.12% (29/85) 🎉
Increment coverage report
Complete coverage report

@xylaaaaa

Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot

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

------ Round 1 ----------------------------------
============================================
q1	17699	4500	4308	4308
q2	q3	10651	778	513	513
q4	4681	363	256	256
q5	7534	1202	1023	1023
q6	173	181	144	144
q7	765	835	656	656
q8	9297	1436	1343	1343
q9	4819	4781	4743	4743
q10	6303	1895	1643	1643
q11	458	271	239	239
q12	740	563	468	468
q13	18038	2916	2186	2186
q14	231	229	217	217
q15	949	791	830	791
q16	749	732	680	680
q17	685	852	420	420
q18	5929	5446	5285	5285
q19	1095	989	624	624
q20	486	483	387	387
q21	4654	1958	1554	1554
q22	360	326	311	311
Total cold run time: 96296 ms
Total hot run time: 27791 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4847	4568	4764	4568
q2	q3	3904	4358	3889	3889
q4	877	1209	831	831
q5	4102	4393	4336	4336
q6	178	180	142	142
q7	1723	1644	1537	1537
q8	2474	2706	2511	2511
q9	7444	7309	7247	7247
q10	3703	3958	3725	3725
q11	517	440	420	420
q12	518	611	457	457
q13	2772	3152	2285	2285
q14	281	322	313	313
q15	906	850	829	829
q16	767	742	719	719
q17	1150	1388	1488	1388
q18	7218	6861	6758	6758
q19	904	893	900	893
q20	2075	2141	1986	1986
q21	3922	3454	3378	3378
q22	456	422	411	411
Total cold run time: 50738 ms
Total hot run time: 48623 ms

@doris-robot

Copy link
Copy Markdown
TPC-DS: Total hot run time: 153249 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 75b828c25256a8dc26eea4e7a11468171e80a232, data reload: false

query5	4384	658	537	537
query6	332	229	207	207
query7	4961	467	268	268
query8	407	258	265	258
query9	8836	2802	2789	2789
query10	532	393	333	333
query11	7319	5806	5634	5634
query12	185	132	124	124
query13	1275	459	380	380
query14	5769	3850	3566	3566
query14_1	2803	2801	2777	2777
query15	210	195	181	181
query16	983	476	454	454
query17	1026	738	617	617
query18	2451	454	354	354
query19	218	215	182	182
query20	138	128	129	128
query21	224	144	122	122
query22	4962	5185	4754	4754
query23	16685	16025	15776	15776
query23_1	15691	15966	15734	15734
query24	8674	1701	1277	1277
query24_1	1290	1306	1313	1306
query25	578	502	431	431
query26	1234	275	148	148
query27	2773	459	279	279
query28	4569	1840	1836	1836
query29	800	568	472	472
query30	307	242	212	212
query31	1365	1291	1223	1223
query32	76	72	74	72
query33	502	328	289	289
query34	922	911	561	561
query35	643	657	604	604
query36	1109	1138	1039	1039
query37	131	97	90	90
query38	2899	2887	2923	2887
query39	877	860	848	848
query39_1	823	820	822	820
query40	230	152	140	140
query41	61	58	58	58
query42	299	307	293	293
query43	241	245	216	216
query44	
query45	200	190	183	183
query46	867	986	598	598
query47	2130	2151	2071	2071
query48	314	331	234	234
query49	630	481	374	374
query50	675	276	223	223
query51	4109	4127	4025	4025
query52	287	289	277	277
query53	293	330	282	282
query54	297	263	262	262
query55	96	82	85	82
query56	308	331	316	316
query57	1403	1335	1279	1279
query58	288	278	277	277
query59	1329	1424	1300	1300
query60	347	334	316	316
query61	152	140	170	140
query62	632	596	534	534
query63	311	278	276	276
query64	4986	1302	1007	1007
query65	
query66	1444	488	347	347
query67	16209	16259	16285	16259
query68	
query69	389	313	286	286
query70	984	959	901	901
query71	330	307	288	288
query72	2857	2663	2585	2585
query73	551	555	340	340
query74	9909	9928	9789	9789
query75	2859	2775	2483	2483
query76	2302	1021	688	688
query77	387	415	311	311
query78	11052	11229	10630	10630
query79	3032	811	613	613
query80	1787	655	611	611
query81	597	285	251	251
query82	996	147	120	120
query83	325	263	247	247
query84	280	116	104	104
query85	921	488	436	436
query86	488	300	326	300
query87	3171	3150	3015	3015
query88	3514	2626	2625	2625
query89	414	366	339	339
query90	2062	178	170	170
query91	169	162	136	136
query92	82	76	71	71
query93	1566	846	489	489
query94	647	320	289	289
query95	586	333	373	333
query96	643	505	226	226
query97	2507	2508	2419	2419
query98	239	222	215	215
query99	992	992	931	931
Total cold run time: 239370 ms
Total hot run time: 153249 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 34.12% (29/85) 🎉
Increment coverage report
Complete coverage report

@morningman morningman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added approved Indicates a PR has been approved by one committer. reviewed labels Mar 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@morningman
morningman merged commit 79153d3 into apache:master Mar 12, 2026
19 checks passed
xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request Mar 25, 2026
## Summary
- add Paimon JDBC metastore properties and driver loading support
- register paimon.catalog.type=jdbc in paimon properties/catalog factory
- allow paimon jdbc type in external table/system table thrift
conversion
- add FE unit tests for jdbc properties mapping and validation

## Test
- ./run-fe-ut.sh --run
org.apache.doris.datasource.property.metastore.PaimonJdbcMetaStorePropertiesTest

(cherry picked from commit 79153d3)
yiguolei pushed a commit that referenced this pull request Mar 26, 2026
xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request May 26, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: apache#61094

Problem Summary: Add shared FE and Java extension utilities to validate JDBC driver checksums before dynamically loading JDBC driver jars.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - MAVEN_OPTS='-Dmaven.build.cache.enabled=false' ./run-fe-ut.sh --run org.apache.doris.catalog.JdbcDriverLoaderTest,org.apache.doris.common.jdbc.JdbcDriverUtilsTest
- Behavior changed: No
- Does this need documentation: No
xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request May 26, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: apache#61094

Problem Summary: Add shared FE and Java extension utilities to validate JDBC driver checksums before dynamically loading JDBC driver jars.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - MAVEN_OPTS='-Dmaven.build.cache.enabled=false' ./run-fe-ut.sh --run org.apache.doris.catalog.JdbcDriverLoaderTest,org.apache.doris.common.jdbc.JdbcDriverUtilsTest
- Behavior changed: No
- Does this need documentation: No
xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request May 26, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: apache#61094

Problem Summary: Add shared FE and Java extension utilities to validate JDBC driver checksums before dynamically loading JDBC driver jars.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - MAVEN_OPTS='-Dmaven.build.cache.enabled=false' ./run-fe-ut.sh --run org.apache.doris.catalog.JdbcDriverLoaderTest,org.apache.doris.common.jdbc.JdbcDriverUtilsTest
- Behavior changed: No
- Does this need documentation: No
xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request May 26, 2026
Issue Number: None

Related PR: apache#61094

Problem Summary: Paimon JDBC catalog dynamic driver loading bypassed the normal JDBC checksum path. Persist and propagate driver checksums, then validate jars before FE and BE dynamic loading.

None

- Test: Unit Test
    - ./run-fe-ut.sh --run org.apache.doris.datasource.paimon.PaimonExternalCatalogTest,org.apache.doris.datasource.property.metastore.PaimonJdbcMetaStorePropertiesTest,org.apache.doris.datasource.paimon.source.PaimonScanNodeTest
    - MAVEN_OPTS='-Dmaven.build.cache.enabled=false' ./run-fe-ut.sh --run org.apache.doris.catalog.JdbcDriverLoaderTest,org.apache.doris.common.jdbc.JdbcDriverUtilsTest,org.apache.doris.paimon.PaimonJdbcDriverUtilsTest
- Behavior changed: Yes. Paimon JDBC catalogs now validate dynamic JDBC driver checksums before loading driver jars.
- Does this need documentation: No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants