Skip to content

[fix](fe) Support ClickHouse JDBC V2 metadata#65709

Merged
Gabriel39 merged 4 commits into
apache:masterfrom
Gabriel39:ai/opensource-419-clickhouse-v2
Jul 17, 2026
Merged

[fix](fe) Support ClickHouse JDBC V2 metadata#65709
Gabriel39 merged 4 commits into
apache:masterfrom
Gabriel39:ai/opensource-419-clickhouse-v2

Conversation

@Gabriel39

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: ClickHouse JDBC V2 exposes databases as schemas and reports distributed tables as REMOTE TABLE. Doris inferred the database metadata mode from the legacy databaseterm URL parameter and filtered the vendor table type, so V2 catalogs could not discover databases or distributed tables. This change uses JDBC metadata capabilities to select catalog/schema mode and includes remote tables in discovery in both JDBC client implementations.

Release note

Support ClickHouse JDBC V2 schema metadata and distributed table discovery.

Check List (For Author)

  • Test: Regression test and Unit Test
    • JdbcClickHouseClientTest
    • JdbcClickHouseConnectorClientTest
    • test_clickhouse_jdbc_v2
  • Behavior changed: Yes. ClickHouse JDBC V2 catalogs now use schema metadata and expose distributed tables.
  • Does this need documentation: No

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

@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/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.

Requesting changes for one JDBC V2 compatibility gap: ClickHouse 0.9.8 reports MaterializedView engines as MATERIALIZED VIEW, but both Doris ClickHouse allowlists omit that type, so V2 catalogs lose materialized views that V1 exposed as VIEW.

Critical checkpoint conclusions:

  • Goal/correctness: The capability-based namespace selection is correct for the inspected 0.4.x, 0.5+/0.7.x, proxy, and direct V2 drivers, and REMOTE TABLE makes the Distributed fixture discoverable and queryable. The missing MATERIALIZED VIEW type leaves the V2 support incomplete.
  • Scope/parallel paths: The production change is focused and updates both JDBC client stacks, but the accepted omission exists in both arrays and should be fixed together.
  • Concurrency/lifecycle/error handling: No new threads, locks, or special lifetime are added. The shared connector's two-field lazy publication issue was present in the base revision, and no supported-driver exception path newly introduced by this PR was found. JDBC resources and SQLExceptions follow existing client patterns.
  • Compatibility/configuration/persistence: No Doris dynamic config, FE-BE protocol, persisted format, transaction, or rolling-upgrade boundary changes. V1/V2 catalog-vs-schema argument propagation is consistent; the blocker is table-type compatibility when upgrading to V2.
  • Tests/results: The unit tests cover version/capability decisions and the new type string; the regression uses the real direct V2 class and proves ordinary plus Distributed counts. It does not include a materialized-view fixture, which is why the compatibility loss is missed. Per the review-runner contract, no local build or test was run; static evidence was checked against the exact upstream driver sources and current CI state.
  • Performance/observability/security: The capability decision is cached and not a hot-path regression; no extra metrics/logging are needed. The change is read-only metadata behavior over an admin-trusted external catalog and does not alter an in-scope trust boundary.
  • Data writes/visibility/FE-BE variables: Not applicable; no transaction, storage visibility, delete bitmap, write atomicity, or new transmitted variable is involved.
  • User focus: No additional user-provided focus points were supplied; the complete PR was reviewed.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17618	4306	4052	4052
q2	2006	337	206	206
q3	10322	1407	792	792
q4	4684	476	345	345
q5	7492	880	578	578
q6	181	166	136	136
q7	807	819	599	599
q8	9328	1567	1495	1495
q9	5680	4342	4371	4342
q10	6736	1757	1520	1520
q11	509	351	334	334
q12	732	575	453	453
q13	18152	3499	2778	2778
q14	268	262	248	248
q15	q16	793	775	712	712
q17	1048	1037	896	896
q18	6836	5776	5524	5524
q19	1302	1245	1090	1090
q20	768	696	552	552
q21	5895	2619	2428	2428
q22	442	360	294	294
Total cold run time: 101599 ms
Total hot run time: 29374 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4396	4327	4310	4310
q2	300	320	214	214
q3	4614	4953	4380	4380
q4	2070	2151	1387	1387
q5	4393	4282	4260	4260
q6	230	175	129	129
q7	1767	1872	1871	1871
q8	2604	2248	2169	2169
q9	8001	8164	7920	7920
q10	4670	4708	4225	4225
q11	568	409	373	373
q12	795	752	607	607
q13	3283	3636	2963	2963
q14	291	301	275	275
q15	q16	702	719	661	661
q17	1360	1307	1321	1307
q18	7942	7229	7205	7205
q19	1147	1143	1097	1097
q20	2211	2203	1946	1946
q21	5217	4567	4482	4482
q22	521	463	404	404
Total cold run time: 57082 ms
Total hot run time: 52185 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 177743 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 44add47d0763ab7229cb05468bea183301f6a851, data reload: false

query5	4310	639	489	489
query6	485	219	213	213
query7	4854	560	325	325
query8	344	186	169	169
query9	8770	4090	4053	4053
query10	463	372	307	307
query11	5929	2348	2144	2144
query12	179	105	102	102
query13	1259	631	431	431
query14	6240	5249	4922	4922
query14_1	4285	4262	4291	4262
query15	218	207	179	179
query16	996	473	482	473
query17	950	720	584	584
query18	2456	504	350	350
query19	212	195	150	150
query20	115	111	107	107
query21	238	171	143	143
query22	13600	13480	13287	13287
query23	17506	16435	16145	16145
query23_1	16220	16370	16232	16232
query24	7589	1772	1276	1276
query24_1	1300	1284	1286	1284
query25	566	457	404	404
query26	1315	363	210	210
query27	2605	619	375	375
query28	4488	2004	2013	2004
query29	1090	648	497	497
query30	330	265	235	235
query31	1118	1091	986	986
query32	108	64	62	62
query33	532	324	262	262
query34	1195	1164	651	651
query35	773	784	677	677
query36	1205	1176	1093	1093
query37	149	104	92	92
query38	1895	1702	1638	1638
query39	890	888	844	844
query39_1	831	827	867	827
query40	245	167	149	149
query41	65	62	62	62
query42	94	94	88	88
query43	318	323	282	282
query44	1403	763	766	763
query45	196	185	173	173
query46	1092	1181	753	753
query47	2123	2128	1987	1987
query48	430	427	303	303
query49	579	425	296	296
query50	1064	429	349	349
query51	10779	10680	10627	10627
query52	87	87	74	74
query53	258	278	201	201
query54	272	234	217	217
query55	74	69	66	66
query56	307	310	295	295
query57	1314	1293	1209	1209
query58	282	267	260	260
query59	1546	1647	1408	1408
query60	296	279	247	247
query61	146	146	147	146
query62	547	501	435	435
query63	253	203	203	203
query64	2839	1037	844	844
query65	4760	4634	4633	4633
query66	1842	517	370	370
query67	29411	29230	29162	29162
query68	3127	1579	1028	1028
query69	393	299	272	272
query70	1056	965	965	965
query71	379	335	330	330
query72	3133	2694	2275	2275
query73	798	766	439	439
query74	5098	5004	4702	4702
query75	2536	2480	2133	2133
query76	2343	1167	775	775
query77	378	375	279	279
query78	11884	11900	11337	11337
query79	1429	1181	772	772
query80	1023	554	456	456
query81	556	336	297	297
query82	569	160	122	122
query83	401	318	304	304
query84	328	161	128	128
query85	975	637	534	534
query86	401	296	262	262
query87	1856	1814	1772	1772
query88	3709	2752	2749	2749
query89	441	385	330	330
query90	1874	202	197	197
query91	204	187	161	161
query92	65	59	53	53
query93	1550	1554	928	928
query94	619	354	314	314
query95	801	599	476	476
query96	1089	781	340	340
query97	2598	2624	2471	2471
query98	213	207	201	201
query99	1092	1120	970	970
Total cold run time: 263487 ms
Total hot run time: 177743 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.19 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 44add47d0763ab7229cb05468bea183301f6a851, data reload: false

query1	0.01	0.01	0.00
query2	0.10	0.05	0.05
query3	0.25	0.13	0.13
query4	1.60	0.14	0.14
query5	0.27	0.22	0.24
query6	1.26	1.09	1.06
query7	0.04	0.01	0.01
query8	0.06	0.04	0.04
query9	0.40	0.32	0.32
query10	0.57	0.56	0.55
query11	0.19	0.14	0.14
query12	0.19	0.15	0.14
query13	0.49	0.48	0.48
query14	1.04	1.03	1.01
query15	0.63	0.59	0.61
query16	0.33	0.32	0.33
query17	1.16	1.11	1.09
query18	0.23	0.22	0.21
query19	2.13	1.93	2.02
query20	0.02	0.01	0.01
query21	15.43	0.22	0.13
query22	4.87	0.05	0.06
query23	16.10	0.31	0.12
query24	2.90	0.43	0.32
query25	0.13	0.05	0.05
query26	0.73	0.20	0.15
query27	0.04	0.04	0.04
query28	3.55	0.94	0.54
query29	12.56	4.29	3.36
query30	0.28	0.15	0.18
query31	2.78	0.59	0.31
query32	3.21	0.61	0.49
query33	3.28	3.16	3.20
query34	15.56	4.24	3.50
query35	3.55	3.56	3.56
query36	0.55	0.43	0.45
query37	0.09	0.07	0.07
query38	0.05	0.04	0.04
query39	0.04	0.03	0.04
query40	0.18	0.16	0.16
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.03	0.03
Total cold run time: 97.02 s
Total hot run time: 25.19 s

@Gabriel39
Gabriel39 force-pushed the ai/opensource-419-clickhouse-v2 branch from 44add47 to 888206f Compare July 16, 2026 11:11
Gabriel39 added a commit to Gabriel39/incubator-doris that referenced this pull request Jul 16, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: apache#65709

Problem Summary: ClickHouse JDBC V2 reports MaterializedView engines as
MATERIALIZED VIEW and filters getTables results by requested vendor table
types. Doris only requested VIEW, so catalogs upgraded from V1 to V2 could no
longer list or query materialized views. Include the V2 table type in both JDBC
client paths and cover it with a real-driver regression fixture.

### Release note

Preserve ClickHouse materialized view discovery with JDBC V2.

### Check List (For Author)

- Test
  - [x] Regression test
  - [x] Unit test
@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/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.

Requesting changes for one regression-infrastructure issue. The production-side ClickHouse JDBC V2 metadata fix is otherwise coherent, and the materialized-view omission raised in the existing thread is fixed on the current head.

Critical checkpoint conclusions:

  • Goal and correctness: The capability-based namespace selection matches the inspected ClickHouse driver contracts: legacy schema mode remains intact, 0.7.x follows its configured catalog/schema capability, and JDBC V2 0.9.8 is schema-only. Adding REMOTE TABLE and MATERIALIZED VIEW makes the new Distributed and materialized-view fixtures discoverable through both JDBC client stacks.
  • Scope and parallel paths: The production change is focused and updates the legacy JdbcClickHouseClient and plugin-driven JdbcClickHouseConnectorClient consistently. Database listing, table listing/existence, column lookup, and primary-key argument placement were traced end to end.
  • Concurrency and lifecycle: No new threads, locks, or lifecycle boundary are added. The plugin client's two-field lazy-publication race is real but unchanged from the base revision, so it was not attributed to this PR. Connector creation/reset and JDBC resource closure otherwise follow existing patterns.
  • Compatibility, configuration, and persistence: No Doris dynamic configuration, persisted format, edit-log, FE-BE protocol, transaction, or rolling-upgrade contract changes. The non-default ClickHouse 0.4.x catalog-mode limitation also predates this PR; the targeted 0.7.x and 0.9.8 paths are consistent.
  • Tests and results: The unit tests cover version/capability decisions and both vendor table types. The ClickHouse 23.8 fixture ordering and local default cluster make all three expected counts of 2 correct, and the suite routes through the SPI JDBC client. However, its only V2 driver is fetched directly from Maven Central before those assertions, bypassing the configured regression artifact store and making the end-to-end proof fail on bucket-only or slow public egress. Per the review-runner contract, no local build or test was run; thirdparty/installed/bin/protoc is unavailable. Current compile and style checks were inspected separately.
  • Performance and observability: The metadata capability decision is cached and not a hot-path regression; no new metric or log is needed.
  • Data writes, visibility, and transmitted variables: Not applicable. This changes external metadata discovery and test fixtures, not Doris transaction visibility, storage writes, delete bitmaps, or FE-BE variables.
  • User focus: No additional user-provided focus points were supplied; the complete PR was reviewed.

if (enabled != null && enabled.equalsIgnoreCase("true")) {
String clickhousePort = context.config.otherConfigs.get("clickhouse_22_port")
String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
String driverUrl = "https://repo.maven.apache.org/maven2/com/clickhouse/clickhouse-jdbc/0.9.8/clickhouse-jdbc-0.9.8-all.jar"

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.

[P1] Keep the V2 driver in the regression artifact store

Creating this catalog computes the driver checksum by streaming the complete 12.25 MB jar with JdbcResource's fixed 10-second HTTP timeouts. This is the only active JDBC regression driver URL in this suite that uses Maven Central; the existing ClickHouse and other JDBC cases all use the configured regression bucket. Workers with bucket-only egress (or a slow public route) will therefore fail before any V2 metadata behavior is exercised. Please upload the 0.9.8 all-jar under regression/jdbc_driver and build this URL with getS3BucketName() / getS3Endpoint(), matching the existing ClickHouse suite.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17733	4220	4238	4220
q2	2087	316	205	205
q3	10241	1390	843	843
q4	4679	469	340	340
q5	7526	900	574	574
q6	190	167	136	136
q7	778	862	615	615
q8	9335	1486	1545	1486
q9	5526	4345	4340	4340
q10	6746	1711	1486	1486
q11	507	369	325	325
q12	712	576	452	452
q13	18105	3414	2782	2782
q14	270	277	244	244
q15	q16	794	783	711	711
q17	987	1050	907	907
q18	7138	5743	5589	5589
q19	1318	1340	1096	1096
q20	823	740	596	596
q21	5890	2676	2437	2437
q22	429	354	296	296
Total cold run time: 101814 ms
Total hot run time: 29680 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4535	4525	4519	4519
q2	308	322	213	213
q3	4654	4991	4431	4431
q4	2089	2134	1378	1378
q5	4391	4298	4294	4294
q6	231	174	128	128
q7	1724	2331	1702	1702
q8	2597	2239	2332	2239
q9	8008	8050	7792	7792
q10	4698	4643	4173	4173
q11	621	419	407	407
q12	768	766	553	553
q13	3327	3630	2892	2892
q14	300	306	293	293
q15	q16	715	733	653	653
q17	1353	1363	1346	1346
q18	8083	7264	7243	7243
q19	1183	1139	1144	1139
q20	2218	2212	1950	1950
q21	5234	4555	4327	4327
q22	503	458	399	399
Total cold run time: 57540 ms
Total hot run time: 52071 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 177512 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 888206f531a09dc8bfa98071537bf67c1360143c, data reload: false

query5	4330	633	478	478
query6	468	231	204	204
query7	4842	576	349	349
query8	342	200	169	169
query9	8764	4063	4072	4063
query10	486	373	303	303
query11	5945	2326	2161	2161
query12	156	105	102	102
query13	1313	572	433	433
query14	6253	5239	4935	4935
query14_1	4297	4382	4307	4307
query15	222	206	183	183
query16	1015	479	487	479
query17	1078	720	576	576
query18	2461	493	363	363
query19	214	195	154	154
query20	113	120	108	108
query21	238	160	136	136
query22	13558	13616	13525	13525
query23	17383	16530	16172	16172
query23_1	16253	16273	16044	16044
query24	7621	1768	1278	1278
query24_1	1265	1300	1278	1278
query25	588	457	394	394
query26	1346	353	222	222
query27	2549	564	384	384
query28	4422	1981	1992	1981
query29	1084	615	500	500
query30	345	268	230	230
query31	1118	1096	991	991
query32	105	64	63	63
query33	537	338	261	261
query34	1188	1162	669	669
query35	771	784	695	695
query36	1164	1223	1064	1064
query37	156	118	96	96
query38	1884	1702	1695	1695
query39	875	900	840	840
query39_1	834	852	855	852
query40	253	165	143	143
query41	68	64	65	64
query42	99	89	91	89
query43	320	324	284	284
query44	1400	756	751	751
query45	192	182	168	168
query46	1070	1188	722	722
query47	2155	2121	1949	1949
query48	390	417	290	290
query49	578	408	309	309
query50	1103	427	339	339
query51	10802	10740	10421	10421
query52	93	88	75	75
query53	269	291	211	211
query54	293	233	217	217
query55	75	69	64	64
query56	287	304	275	275
query57	1332	1278	1187	1187
query58	329	269	259	259
query59	1588	1682	1448	1448
query60	293	279	263	263
query61	157	158	152	152
query62	546	490	437	437
query63	244	206	214	206
query64	2833	1082	894	894
query65	4717	4612	4639	4612
query66	1819	550	387	387
query67	29367	29294	29075	29075
query68	3109	1487	971	971
query69	403	303	265	265
query70	1063	965	940	940
query71	365	361	318	318
query72	3078	2753	2408	2408
query73	822	762	425	425
query74	5079	4948	4732	4732
query75	2538	2501	2144	2144
query76	2338	1192	758	758
query77	346	380	278	278
query78	12017	11863	11321	11321
query79	1396	1150	745	745
query80	1301	558	476	476
query81	548	332	303	303
query82	541	157	118	118
query83	404	327	297	297
query84	295	153	130	130
query85	1005	622	533	533
query86	424	309	286	286
query87	1841	1829	1733	1733
query88	3707	2776	2752	2752
query89	464	366	338	338
query90	1968	195	194	194
query91	206	194	167	167
query92	67	60	57	57
query93	1647	1527	1027	1027
query94	730	361	328	328
query95	788	513	475	475
query96	1094	849	359	359
query97	2627	2622	2517	2517
query98	212	202	202	202
query99	1097	1116	980	980
Total cold run time: 264105 ms
Total hot run time: 177512 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.06 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 888206f531a09dc8bfa98071537bf67c1360143c, data reload: false

query1	0.01	0.00	0.00
query2	0.10	0.05	0.05
query3	0.27	0.14	0.13
query4	1.61	0.15	0.14
query5	0.28	0.22	0.23
query6	1.25	1.06	1.07
query7	0.04	0.00	0.01
query8	0.06	0.04	0.04
query9	0.39	0.31	0.31
query10	0.58	0.54	0.55
query11	0.20	0.15	0.14
query12	0.18	0.14	0.14
query13	0.47	0.46	0.47
query14	1.03	1.01	1.03
query15	0.62	0.58	0.59
query16	0.31	0.33	0.32
query17	1.12	1.10	1.09
query18	0.22	0.21	0.20
query19	2.11	2.00	1.87
query20	0.01	0.01	0.01
query21	15.43	0.23	0.13
query22	4.74	0.06	0.05
query23	16.11	0.30	0.11
query24	3.04	0.44	0.34
query25	0.11	0.05	0.04
query26	0.76	0.22	0.15
query27	0.03	0.03	0.04
query28	3.47	0.96	0.53
query29	12.53	4.15	3.36
query30	0.28	0.15	0.15
query31	2.77	0.60	0.31
query32	3.22	0.59	0.48
query33	3.25	3.29	3.21
query34	15.51	4.24	3.52
query35	3.52	3.54	3.53
query36	0.56	0.43	0.45
query37	0.09	0.07	0.07
query38	0.05	0.04	0.04
query39	0.03	0.03	0.03
query40	0.18	0.15	0.16
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.71 s
Total hot run time: 25.06 s

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: ClickHouse JDBC V2 exposes databases as schemas and reports distributed tables as REMOTE TABLE. Doris inferred the database metadata mode from a legacy URL parameter and filtered the vendor table type, so V2 catalogs could not discover databases or distributed tables. Use JDBC metadata capabilities for catalog/schema mode and include remote tables in discovery.

### Release note

Support ClickHouse JDBC V2 schema metadata and distributed table discovery.

### Check List (For Author)

- Test: Regression test and Unit Test
    - JdbcClickHouseClientTest
    - JdbcClickHouseConnectorClientTest
    - test_clickhouse_jdbc_v2
- Behavior changed: Yes. ClickHouse JDBC V2 catalogs now use schema metadata and expose distributed tables.
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: apache#65709

Problem Summary: ClickHouse JDBC V2 reports MaterializedView engines as
MATERIALIZED VIEW and filters getTables results by requested vendor table
types. Doris only requested VIEW, so catalogs upgraded from V1 to V2 could no
longer list or query materialized views. Include the V2 table type in both JDBC
client paths and cover it with a real-driver regression fixture.

### Release note

Preserve ClickHouse materialized view discovery with JDBC V2.

### Check List (For Author)

- Test
  - [x] Regression test
  - [x] Unit test
### What problem does this PR solve?

Issue Number: None

Related PR: apache#65709

Problem Summary: The ClickHouse JDBC V2 regression downloaded a 12 MB driver
directly from Maven Central, which can fail on workers with restricted or slow
public egress. Resolve the driver from the configured regression artifact
bucket, consistent with the existing ClickHouse JDBC suites.

### Release note

None

### Check List (For Author)

- Test
  - [x] Regression suite URL assertion
@Gabriel39
Gabriel39 force-pushed the ai/opensource-419-clickhouse-v2 branch from 888206f to 56d2193 Compare July 16, 2026 14:48
@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Selected model is at capacity. Please try a different model.
Workflow run: https://github.com/apache/doris/actions/runs/29508273363

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17579	3869	3864	3864
q2	2000	306	191	191
q3	10306	1410	826	826
q4	4675	465	336	336
q5	7493	836	568	568
q6	181	168	135	135
q7	718	808	589	589
q8	9948	1539	1578	1539
q9	6101	4322	4287	4287
q10	6775	1717	1471	1471
q11	505	346	313	313
q12	756	582	463	463
q13	18124	3385	2740	2740
q14	267	264	250	250
q15	q16	792	771	706	706
q17	1036	986	1004	986
q18	6769	5915	5482	5482
q19	1773	1351	1067	1067
q20	823	674	562	562
q21	6026	2567	2492	2492
q22	428	355	293	293
Total cold run time: 103075 ms
Total hot run time: 29160 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4309	4226	4232	4226
q2	280	310	209	209
q3	4520	4916	4397	4397
q4	2043	2125	1358	1358
q5	4339	4201	4266	4201
q6	222	176	124	124
q7	1743	1908	1757	1757
q8	2474	2137	2083	2083
q9	7702	7828	7659	7659
q10	4642	4643	4215	4215
q11	554	422	381	381
q12	740	759	535	535
q13	3519	3537	2918	2918
q14	318	319	281	281
q15	q16	732	759	668	668
q17	1332	1306	1325	1306
q18	7946	7288	6945	6945
q19	1131	1032	1081	1032
q20	2214	2223	1937	1937
q21	5190	4533	4429	4429
q22	538	456	392	392
Total cold run time: 56488 ms
Total hot run time: 51053 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 177290 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 56d219379d7ca64d80c07f2cac45a021c64fb4e1, data reload: false

query5	4344	643	502	502
query6	461	224	222	222
query7	4854	562	348	348
query8	336	195	178	178
query9	8720	4073	4088	4073
query10	503	366	293	293
query11	5905	2345	2156	2156
query12	161	104	102	102
query13	1286	549	435	435
query14	6236	5218	4902	4902
query14_1	4290	4205	4274	4205
query15	204	209	181	181
query16	1003	471	450	450
query17	1156	690	562	562
query18	2470	444	334	334
query19	199	181	140	140
query20	110	105	106	105
query21	233	153	127	127
query22	13660	13529	13476	13476
query23	17247	16538	16071	16071
query23_1	16444	16612	16505	16505
query24	7525	1699	1247	1247
query24_1	1304	1262	1238	1238
query25	535	419	369	369
query26	1345	343	211	211
query27	2600	593	369	369
query28	4461	1952	1985	1952
query29	1045	606	464	464
query30	348	264	234	234
query31	1119	1089	989	989
query32	114	70	64	64
query33	531	304	233	233
query34	1158	1140	638	638
query35	784	771	664	664
query36	1178	1210	1048	1048
query37	156	106	84	84
query38	1879	1704	1635	1635
query39	880	876	856	856
query39_1	829	850	836	836
query40	253	162	135	135
query41	62	61	64	61
query42	92	97	92	92
query43	333	328	277	277
query44	1410	778	759	759
query45	191	179	174	174
query46	1075	1186	773	773
query47	2102	2087	2063	2063
query48	395	424	266	266
query49	574	436	295	295
query50	1068	426	386	386
query51	10909	10752	10532	10532
query52	85	91	76	76
query53	261	280	202	202
query54	283	229	214	214
query55	74	71	65	65
query56	294	319	288	288
query57	1295	1265	1171	1171
query58	292	264	259	259
query59	1623	1647	1468	1468
query60	306	267	250	250
query61	154	156	144	144
query62	543	488	440	440
query63	238	213	207	207
query64	2832	1019	845	845
query65	4742	4658	4638	4638
query66	1821	500	370	370
query67	29164	29174	28402	28402
query68	3283	1591	964	964
query69	408	302	273	273
query70	1073	950	958	950
query71	366	337	326	326
query72	2985	2682	2551	2551
query73	823	804	416	416
query74	5079	4921	4714	4714
query75	2542	2478	2143	2143
query76	2311	1174	783	783
query77	347	381	296	296
query78	11802	11836	11346	11346
query79	1389	1086	743	743
query80	684	575	495	495
query81	477	340	288	288
query82	585	160	119	119
query83	392	337	306	306
query84	280	161	132	132
query85	1010	690	625	625
query86	367	286	281	281
query87	1828	1815	1737	1737
query88	3712	2784	2754	2754
query89	432	375	326	326
query90	1845	203	188	188
query91	203	199	160	160
query92	62	62	55	55
query93	1599	1470	953	953
query94	566	326	314	314
query95	794	583	457	457
query96	1096	769	376	376
query97	2632	2637	2464	2464
query98	212	215	201	201
query99	1100	1108	975	975
Total cold run time: 262594 ms
Total hot run time: 177290 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.02 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 56d219379d7ca64d80c07f2cac45a021c64fb4e1, data reload: false

query1	0.01	0.01	0.00
query2	0.10	0.05	0.04
query3	0.24	0.14	0.13
query4	1.60	0.13	0.13
query5	0.23	0.22	0.22
query6	1.27	1.05	1.05
query7	0.04	0.00	0.00
query8	0.06	0.04	0.04
query9	0.39	0.30	0.33
query10	0.55	0.56	0.58
query11	0.20	0.14	0.14
query12	0.19	0.15	0.14
query13	0.46	0.47	0.47
query14	1.02	1.02	1.02
query15	0.62	0.59	0.58
query16	0.32	0.32	0.31
query17	1.09	1.13	1.13
query18	0.23	0.22	0.20
query19	2.04	1.93	2.01
query20	0.01	0.02	0.01
query21	15.42	0.21	0.13
query22	4.81	0.06	0.06
query23	16.13	0.30	0.12
query24	3.02	0.40	0.32
query25	0.10	0.05	0.05
query26	0.76	0.20	0.15
query27	0.05	0.04	0.03
query28	3.48	0.91	0.55
query29	12.45	4.12	3.27
query30	0.29	0.15	0.18
query31	2.76	0.57	0.31
query32	3.22	0.59	0.48
query33	3.13	3.17	3.17
query34	15.55	4.24	3.51
query35	3.58	3.53	3.53
query36	0.56	0.43	0.41
query37	0.09	0.07	0.06
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.17	0.16
query41	0.10	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.53 s
Total hot run time: 25.02 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

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

1 similar comment
@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

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

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/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.

Requesting changes for one JDBC connector compatibility regression: a repackaged ClickHouse 0.7.x driver without manifest version metadata worked in the base SPI connector, but the new numeric parser rejects it before namespace metadata can be initialized.

Critical checkpoint conclusions:

  • Goal/correctness: Official ClickHouse 0.3/0.4 legacy routing, configurable 0.5/0.7 catalog-or-schema routing, and direct V2 0.9.8 schema routing are consistent across database, table, column, and applicable primary-key metadata. REMOTE TABLE and MATERIALIZED VIEW cover the new fixtures. MAIN-1 leaves the custom-driver upgrade path incompatible.
  • Scope/parallel paths: Both the legacy FE client and plugin-driven SPI client were traced through database listing, table listing/existence, columns, and primary keys. The accepted failure is limited to the changed SPI version parser on the active JDBC catalog path; no second changed-path issue survived review.
  • Concurrency/lifecycle/error handling: No new supported-driver race or resource-lifetime defect was found; the SPI client's two-field lazy-publication ordering existed in the base revision. MAIN-1 is a deterministic hard failure: existing/replayed catalogs fail discovery after upgrade, default new catalog creation fails its metadata-backed connectivity check, and test_connection=false defers the failure until first metadata access.
  • Compatibility/configuration/persistence: Doris permits custom driver jars without requiring Implementation-Version, so strict numeric parsing changes an existing compatibility contract. No new dynamic configuration, persisted-field format, edit-log schema, FE-BE protocol, transaction, or storage-visibility behavior is introduced.
  • Tests/results: Unit and external regression coverage proves the official parseable drivers and direct V2 Distributed/materialized-view path, but it does not cover an empty reported version. The configured 0.9.8 artifact, SPI route, fixture order, and expected counts were verified. Current-head External Regression, FE UT, compile, CheckStyle, and other reported checks are green; per the review contract, no local build or test was run.
  • Performance/observability: Capability selection is cached at client initialization; no hot-path, metric, or logging issue was found.
  • Data writes/visibility/transmitted variables: Not applicable; this is external metadata discovery and does not change Doris writes, transaction visibility, delete bitmaps, or FE-BE variables.
  • Existing threads/user focus: The earlier materialized-view and artifact-host concerns are fixed on the current head and are not duplicated. No additional user focus was supplied; the complete seven-file patch was reviewed.

### What problem does this PR solve?

Issue Number: None

Related PR: apache#65709

Problem Summary: Custom ClickHouse JDBC jars can omit or rewrite manifest version metadata. Treat absent or unparseable versions as non-legacy so namespace selection falls back to JDBC metadata capabilities, while preserving the known legacy version override.

### Release note

None

### Check List (For Author)

- Test\n  - [x] JdbcClickHouseConnectorClientTest
@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/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.

Automated review completed for head d7f722241ce8e9be68737cc2edc52a248822f7d5.

No new non-duplicate inline findings remain. The current head correctly uses the driver's metadata capability for known ClickHouse V1/V2 namespace modes, preserves the 0.3/0.4 schema override, adds the exact V2 REMOTE TABLE and MATERIALIZED VIEW filters in both client stacks, and covers source, Distributed, and materialized-view discovery with coherent unit/regression fixtures.

The existing artifact-store thread remains unresolved across the configured provider-dependent URL path: https://doris-regression.storage.googleapis.com/regression/jdbc_driver/clickhouse-jdbc-0.9.8-all.jar currently returns 404, while the 0.4.2 and 0.7.1-patch1 objects at the same prefix return 200. Please replicate the 0.9.8 all-jar to every provider this dynamic URL can select, or use one canonical artifact host. I did not add a second inline comment because this is the same issue already reported in discussion r3595104335.

Critical checkpoints:

  • Goal and proof: the product change fixes V2 schema metadata plus Distributed/materialized-view discovery in both parallel FE client paths; the unit tests cover routing/type helpers and the regression queries force database, table-existence, column, and scan paths.
  • Scope and clarity: the product edits are focused on namespace selection and the vendor type allowlist. The version gate documents the known 0.3/0.4 exception and otherwise delegates to driver metadata.
  • Concurrency and lifecycle: no locks, threads, static initialization, or resource ownership are added. The connector's lazy two-field publication pattern is pre-existing, and supported driver capability methods are local constant/config reads, so this patch adds no substantiated concurrency or lifecycle regression.
  • Configuration, compatibility, and parallel paths: no Doris config or dynamic-setting contract is added. Known-version routing and table-type behavior were checked against ClickHouse JDBC 0.3/0.4, configurable 0.7.1, and schema-only 0.9.8 in both changed implementations; versionless fallback is verified on the production connector path. There is no new symbol, storage-format, rolling-upgrade, or persisted-metadata incompatibility.
  • Tests and results: the exact V1/V2 table types and scalar outputs are correct, and the two source inserts occur after materialized-view creation. The remaining provider-specific jar 404 means the new regression is not portable across every URL the test can construct. Per the review-runner contract, validation was static and no build or test command was run; GitHub CheckStyle was green and FE UT/compile were pending when inspected.
  • Other checkpoints: product code adds no transaction/persistence write, data mutation, FE-BE variable, lock-order, error-swallowing, observability, or hot-path performance concern; the capability is cached after initial namespace detection and is not evaluated on the steady-state hot path. There was no additional user-provided focus.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 40.00% (2/5) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17624	4120	4105	4105
q2	2048	313	203	203
q3	10305	1478	826	826
q4	4679	481	343	343
q5	7488	851	552	552
q6	182	168	136	136
q7	778	810	615	615
q8	9321	1631	1552	1552
q9	5670	4368	4327	4327
q10	6793	1806	1506	1506
q11	511	356	331	331
q12	719	604	461	461
q13	18094	3367	2710	2710
q14	264	268	247	247
q15	q16	794	786	716	716
q17	948	1052	962	962
q18	7122	6000	5685	5685
q19	1341	1228	1129	1129
q20	830	679	619	619
q21	5965	2711	2325	2325
q22	436	352	298	298
Total cold run time: 101912 ms
Total hot run time: 29648 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4394	4309	4297	4297
q2	293	320	214	214
q3	4558	5003	4445	4445
q4	2085	2191	1369	1369
q5	4412	4293	4317	4293
q6	231	177	129	129
q7	1729	2088	1769	1769
q8	2615	2215	2230	2215
q9	7981	8172	7745	7745
q10	4678	4680	4254	4254
q11	578	404	368	368
q12	749	783	541	541
q13	3251	3621	2944	2944
q14	308	299	274	274
q15	q16	701	753	640	640
q17	1341	1316	1305	1305
q18	8330	7550	7274	7274
q19	1146	1072	1092	1072
q20	2226	2204	1919	1919
q21	5233	4608	4433	4433
q22	513	454	410	410
Total cold run time: 57352 ms
Total hot run time: 51910 ms

@hello-stephen

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

query5	4358	631	483	483
query6	482	231	201	201
query7	4936	595	332	332
query8	341	185	171	171
query9	8787	4108	4105	4105
query10	487	363	310	310
query11	5914	2335	2137	2137
query12	167	103	100	100
query13	1323	606	423	423
query14	6273	5230	4914	4914
query14_1	4282	4297	4318	4297
query15	210	203	180	180
query16	1014	477	477	477
query17	970	745	584	584
query18	2513	522	338	338
query19	206	187	154	154
query20	112	105	109	105
query21	232	160	135	135
query22	13657	13542	13237	13237
query23	17404	16551	16091	16091
query23_1	16311	16208	16197	16197
query24	7601	1772	1283	1283
query24_1	1281	1289	1276	1276
query25	541	435	372	372
query26	1321	369	215	215
query27	2595	633	383	383
query28	4435	2013	1993	1993
query29	1043	593	491	491
query30	342	263	233	233
query31	1111	1091	975	975
query32	113	61	66	61
query33	523	312	246	246
query34	1207	1118	635	635
query35	769	796	662	662
query36	1283	1196	1082	1082
query37	149	103	88	88
query38	1888	1673	1675	1673
query39	871	883	847	847
query39_1	839	850	852	850
query40	246	164	141	141
query41	69	65	63	63
query42	96	90	96	90
query43	325	318	282	282
query44	1409	762	757	757
query45	195	184	172	172
query46	1052	1163	724	724
query47	2151	2152	2016	2016
query48	414	375	295	295
query49	578	412	304	304
query50	1070	426	332	332
query51	10707	10685	10632	10632
query52	89	85	74	74
query53	258	281	209	209
query54	279	231	219	219
query55	72	71	72	71
query56	319	304	274	274
query57	1319	1297	1199	1199
query58	282	245	245	245
query59	1564	1660	1492	1492
query60	327	271	264	264
query61	150	148	151	148
query62	546	505	426	426
query63	243	202	203	202
query64	2852	1013	902	902
query65	4766	4590	4664	4590
query66	1849	493	379	379
query67	29392	29321	28522	28522
query68	3229	1508	961	961
query69	409	296	259	259
query70	1076	932	926	926
query71	369	327	311	311
query72	3141	2750	2414	2414
query73	877	778	419	419
query74	5068	4941	4700	4700
query75	2546	2498	2139	2139
query76	2314	1187	794	794
query77	358	380	287	287
query78	11951	11821	11449	11449
query79	1243	1235	744	744
query80	593	555	467	467
query81	453	333	294	294
query82	238	159	121	121
query83	319	329	301	301
query84	300	162	130	130
query85	889	617	531	531
query86	332	276	280	276
query87	1835	1836	1779	1779
query88	3720	2793	2782	2782
query89	416	387	331	331
query90	2193	199	199	199
query91	204	211	185	185
query92	66	63	58	58
query93	1494	1623	956	956
query94	552	383	341	341
query95	799	643	492	492
query96	1055	803	370	370
query97	2620	2660	2494	2494
query98	220	212	213	212
query99	1096	1120	995	995
Total cold run time: 262601 ms
Total hot run time: 177501 ms

@hello-stephen

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

query1	0.01	0.00	0.00
query2	0.11	0.09	0.05
query3	0.25	0.14	0.13
query4	1.61	0.14	0.14
query5	0.23	0.22	0.23
query6	1.23	1.09	1.06
query7	0.04	0.01	0.00
query8	0.06	0.04	0.03
query9	0.38	0.32	0.32
query10	0.54	0.55	0.55
query11	0.20	0.13	0.14
query12	0.19	0.14	0.14
query13	0.47	0.49	0.48
query14	1.03	1.02	1.01
query15	0.61	0.60	0.61
query16	0.32	0.34	0.30
query17	1.12	1.13	1.12
query18	0.22	0.22	0.21
query19	1.99	1.89	1.95
query20	0.02	0.01	0.02
query21	15.44	0.24	0.14
query22	4.87	0.05	0.04
query23	16.15	0.30	0.12
query24	2.94	0.41	0.31
query25	0.12	0.05	0.04
query26	0.73	0.21	0.15
query27	0.05	0.03	0.04
query28	3.49	0.90	0.52
query29	12.48	4.08	3.26
query30	0.27	0.16	0.15
query31	2.76	0.59	0.32
query32	3.22	0.59	0.50
query33	3.18	3.22	3.21
query34	15.52	4.23	3.56
query35	3.55	3.55	3.54
query36	0.55	0.43	0.44
query37	0.10	0.07	0.06
query38	0.05	0.04	0.03
query39	0.04	0.03	0.04
query40	0.18	0.18	0.17
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 96.49 s
Total hot run time: 25.1 s

@Gabriel39
Gabriel39 merged commit 8a3d741 into apache:master Jul 17, 2026
31 of 32 checks passed
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.

3 participants