Skip to content

[refactor](jdbc) Unify JDBC scanning into FileQueryScanNode/JniReader framework - #61141

Merged
morningman merged 24 commits into
apache:masterfrom
morningman:wt-new-jni-refactor
Mar 16, 2026
Merged

morningman merged 24 commits into
apache:masterfrom
morningman:wt-new-jni-refactor

Conversation

@morningman

@morningman morningman commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Refactor the JDBC data source scanning architecture to integrate with the
unified FileScanner/JniReader framework, replacing the standalone
ExternalScanNode-based JDBC scan path.

Motivation

The JDBC scan path was independently implemented with its own operator
(JDBCScanLocalState), scanner (JdbcScanner), and JNI connector (JniConnector
→ BaseJdbcExecutor hierarchy), while other JNI-based data sources (Paimon,
Hudi, MaxCompute, TrinoConnector) already use the unified FileScanner →
JniReader → JniScanner path. This caused code duplication, maintenance burden,
and architectural inconsistency.

Changes

  1. BE: Split JniConnector into two focused classes:

    • JniReader: JNI lifecycle management (open/read/close), base class for
      all JNI readers (PaimonJniReader, HudiJniReader, JdbcJniReader, etc.)
    • JniDataBridge: Stateless data exchange between C++ Blocks and Java
      shared memory via JNI
  2. Java: Introduce Strategy Pattern for database-specific type handling:

    • JdbcTypeHandler interface with DefaultTypeHandler base implementation
    • Per-database handlers: MySQLTypeHandler, OracleTypeHandler,
      PostgreSQLTypeHandler, ClickHouseTypeHandler, SQLServerTypeHandler,
      DB2TypeHandler, SapHanaTypeHandler, TrinoTypeHandler, GbaseTypeHandler
    • JdbcTypeHandlerFactory for handler selection
    • JdbcJniScanner (extends JniScanner) for read path
    • JdbcJniWriter (extends JniWriter) for write path
    • Old BaseJdbcExecutor subclasses marked @deprecated but preserved
  3. FE: Migrate JdbcScanNode from ExternalScanNode to FileQueryScanNode:

    • JdbcScanNode now extends FileQueryScanNode
    • Introduces JdbcSplit (extends FileSplit) to carry JDBC params
    • Uses TFileScanRange with FORMAT_JNI and table_format_type="jdbc"
    • Adds jdbc_params field to TTableFormatFileDesc in Thrift
    • Adapts PhysicalPlanTranslator.visitPhysicalJdbcScan() accordingly
  4. BE: Add JdbcJniReader and integrate into FileScanner:

    • JdbcJniReader handles special types (bitmap, HLL, quantile_state, JSONB)
      via string-based intermediary and CAST
    • FileScanner._get_next_reader() adds "jdbc" table_format_type branch
    • JdbcUtils utility for JDBC driver URL resolution
    • Existing JdbcScanner preserved as transitional (deprecated)

All predicate push-down logic (createJdbcFilters, getJdbcQueryStr, etc.)
is preserved from the original JdbcScanNode implementation.

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen

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

@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot

Copy link
Copy Markdown

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 79.35% (1798/2266)
Line Coverage 64.55% (32219/49910)
Region Coverage 65.43% (16131/24653)
Branch Coverage 55.97% (8597/15360)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

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

@doris-robot

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

------ Round 1 ----------------------------------
============================================
q1	17660	4491	4355	4355
q2	q3	10733	824	532	532
q4	4752	372	252	252
q5	8174	1200	1048	1048
q6	229	177	150	150
q7	825	836	677	677
q8	10796	1511	1357	1357
q9	6658	4819	4765	4765
q10	6532	2016	1651	1651
q11	444	256	242	242
q12	736	569	474	474
q13	18087	2943	2207	2207
q14	229	228	217	217
q15	944	814	810	810
q16	751	719	666	666
q17	731	872	403	403
q18	5980	5362	5177	5177
q19	1185	1009	592	592
q20	500	504	393	393
q21	4847	1953	1526	1526
q22	368	306	264	264
Total cold run time: 101161 ms
Total hot run time: 27758 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4839	4621	4584	4584
q2	q3	3887	4340	3847	3847
q4	909	1211	872	872
q5	4134	4394	4406	4394
q6	174	173	140	140
q7	1791	1635	1547	1547
q8	2489	2749	2644	2644
q9	7519	7570	7485	7485
q10	3788	3964	3622	3622
q11	554	428	406	406
q12	510	587	454	454
q13	2673	3374	2327	2327
q14	286	303	294	294
q15	882	785	772	772
q16	725	773	701	701
q17	1166	1521	1339	1339
q18	7256	6763	6719	6719
q19	859	856	894	856
q20	2042	2121	2002	2002
q21	4059	3519	3400	3400
q22	479	449	391	391
Total cold run time: 51021 ms
Total hot run time: 48796 ms

@doris-robot

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

query5	4321	648	507	507
query6	308	226	213	213
query7	4209	471	266	266
query8	349	251	246	246
query9	8711	2785	2769	2769
query10	531	374	360	360
query11	7372	5911	5548	5548
query12	193	131	126	126
query13	1280	463	358	358
query14	5842	3885	3564	3564
query14_1	2878	2836	2835	2835
query15	200	199	179	179
query16	1027	487	481	481
query17	1109	727	631	631
query18	2437	459	356	356
query19	219	211	185	185
query20	137	129	130	129
query21	227	154	130	130
query22	4872	5047	4985	4985
query23	16810	16101	15689	15689
query23_1	15870	15880	15743	15743
query24	8780	1740	1348	1348
query24_1	1323	1275	1275	1275
query25	568	500	442	442
query26	1261	260	157	157
query27	2786	499	284	284
query28	4499	1859	1844	1844
query29	810	572	467	467
query30	313	251	206	206
query31	1330	1298	1193	1193
query32	80	69	74	69
query33	509	328	285	285
query34	923	888	565	565
query35	642	658	598	598
query36	1101	1096	1021	1021
query37	141	102	82	82
query38	2974	2888	2885	2885
query39	1031	866	849	849
query39_1	831	828	837	828
query40	235	150	136	136
query41	64	59	57	57
query42	310	301	304	301
query43	237	249	220	220
query44	
query45	201	188	178	178
query46	897	969	602	602
query47	2135	2166	2052	2052
query48	312	303	221	221
query49	629	457	380	380
query50	670	268	212	212
query51	4105	4108	4066	4066
query52	286	295	288	288
query53	292	335	283	283
query54	300	269	264	264
query55	98	90	86	86
query56	307	322	300	300
query57	1362	1333	1282	1282
query58	287	282	304	282
query59	1347	1441	1286	1286
query60	347	344	322	322
query61	148	142	150	142
query62	646	578	541	541
query63	300	277	281	277
query64	5039	1259	975	975
query65	
query66	1459	474	361	361
query67	16390	16499	16346	16346
query68	
query69	387	308	288	288
query70	993	971	1005	971
query71	338	307	303	303
query72	2745	2683	2452	2452
query73	533	563	317	317
query74	9964	9929	9726	9726
query75	2831	2748	2476	2476
query76	2268	1041	663	663
query77	357	384	308	308
query78	11200	11308	10684	10684
query79	2388	756	636	636
query80	1713	619	541	541
query81	563	281	247	247
query82	972	153	120	120
query83	325	267	248	248
query84	250	122	95	95
query85	900	506	459	459
query86	442	304	287	287
query87	3141	3102	3010	3010
query88	3536	2642	2626	2626
query89	427	377	348	348
query90	2032	181	176	176
query91	165	166	140	140
query92	82	74	72	72
query93	1005	841	502	502
query94	636	301	299	299
query95	570	344	315	315
query96	633	512	223	223
query97	2462	2573	2380	2380
query98	234	216	221	216
query99	956	978	912	912
Total cold run time: 237236 ms
Total hot run time: 153274 ms

@morningman
morningman force-pushed the wt-new-jni-refactor branch from 9409202 to a246700 Compare March 9, 2026 17:13
@morningman
morningman force-pushed the wt-new-jni-refactor branch from a246700 to 8c2975a Compare March 9, 2026 17:14
@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 79.35% (1795/2262)
Line Coverage 64.57% (32197/49863)
Region Coverage 65.55% (16127/24602)
Branch Coverage 56.00% (8598/15354)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

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

@doris-robot

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

------ Round 1 ----------------------------------
============================================
q1	17620	4450	4272	4272
q2	q3	10719	794	525	525
q4	4724	382	260	260
q5	8138	1221	1020	1020
q6	246	175	145	145
q7	824	855	662	662
q8	10793	1475	1348	1348
q9	6673	4812	4708	4708
q10	6491	1921	1652	1652
q11	453	273	231	231
q12	764	564	458	458
q13	18061	2955	2186	2186
q14	241	227	223	223
q15	940	799	786	786
q16	754	739	687	687
q17	739	841	428	428
q18	6469	5335	5330	5330
q19	1138	994	597	597
q20	494	510	387	387
q21	4598	1912	1467	1467
q22	369	329	281	281
Total cold run time: 101248 ms
Total hot run time: 27653 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4666	4569	4528	4528
q2	q3	3873	4385	3886	3886
q4	882	1197	762	762
q5	4078	4373	4387	4373
q6	183	181	141	141
q7	1788	1651	1507	1507
q8	2674	2711	2555	2555
q9	7539	7221	7508	7221
q10	3810	3975	3646	3646
q11	510	484	425	425
q12	507	582	459	459
q13	2698	3217	2284	2284
q14	284	379	388	379
q15	904	797	793	793
q16	708	770	730	730
q17	1177	1460	1388	1388
q18	7340	6962	6666	6666
q19	925	891	906	891
q20	2106	2171	2026	2026
q21	4067	3443	3252	3252
q22	456	422	381	381
Total cold run time: 51175 ms
Total hot run time: 48293 ms

@doris-robot

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

query5	4328	608	495	495
query6	319	229	203	203
query7	4205	473	261	261
query8	332	256	240	240
query9	8729	2727	2730	2727
query10	525	385	327	327
query11	7436	5871	5649	5649
query12	195	127	125	125
query13	1262	464	349	349
query14	6028	3845	3625	3625
query14_1	2802	2809	2815	2809
query15	199	192	174	174
query16	978	489	480	480
query17	1068	680	596	596
query18	2427	438	331	331
query19	204	200	172	172
query20	134	126	127	126
query21	223	142	122	122
query22	4943	5010	4810	4810
query23	16702	16105	15978	15978
query23_1	15838	15807	15890	15807
query24	7354	1624	1237	1237
query24_1	1253	1223	1261	1223
query25	553	489	430	430
query26	1244	270	157	157
query27	2766	472	293	293
query28	4557	1881	1869	1869
query29	817	577	505	505
query30	320	250	211	211
query31	1360	1288	1227	1227
query32	84	74	76	74
query33	519	348	294	294
query34	948	910	589	589
query35	648	685	613	613
query36	1090	1112	998	998
query37	129	98	88	88
query38	3016	2914	2857	2857
query39	912	873	844	844
query39_1	833	832	826	826
query40	232	163	142	142
query41	68	66	63	63
query42	305	306	300	300
query43	234	245	235	235
query44	
query45	204	195	184	184
query46	872	971	602	602
query47	2119	2147	2091	2091
query48	325	327	232	232
query49	647	476	393	393
query50	678	278	216	216
query51	4112	4083	4064	4064
query52	291	301	281	281
query53	292	334	282	282
query54	311	281	276	276
query55	99	86	87	86
query56	334	326	322	322
query57	1386	1413	1283	1283
query58	284	279	275	275
query59	1350	1427	1250	1250
query60	339	330	327	327
query61	147	148	148	148
query62	608	593	536	536
query63	305	272	286	272
query64	4839	1232	976	976
query65	
query66	1450	454	344	344
query67	16400	16330	16369	16330
query68	
query69	375	312	278	278
query70	990	961	957	957
query71	344	308	302	302
query72	2841	2693	2402	2402
query73	534	539	314	314
query74	10002	9887	9772	9772
query75	2863	2753	2470	2470
query76	2281	1019	676	676
query77	366	391	301	301
query78	11098	11297	10637	10637
query79	1730	786	600	600
query80	1333	605	548	548
query81	573	283	244	244
query82	969	153	118	118
query83	335	254	242	242
query84	254	118	98	98
query85	894	478	426	426
query86	417	306	288	288
query87	3164	3121	3008	3008
query88	3492	2649	2623	2623
query89	425	369	340	340
query90	2002	181	171	171
query91	168	164	136	136
query92	78	78	69	69
query93	989	837	509	509
query94	635	286	294	286
query95	631	341	379	341
query96	633	511	226	226
query97	2446	2468	2441	2441
query98	233	220	220	220
query99	1032	1014	921	921
Total cold run time: 234299 ms
Total hot run time: 153313 ms

@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 79.35% (1795/2262)
Line Coverage 64.53% (32176/49863)
Region Coverage 65.51% (16118/24602)
Branch Coverage 55.95% (8591/15354)

@doris-robot

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

------ Round 1 ----------------------------------
============================================
q1	17672	4518	4280	4280
q2	q3	10533	788	508	508
q4	4670	365	252	252
q5	7553	1184	1015	1015
q6	178	182	144	144
q7	770	821	667	667
q8	9297	1454	1310	1310
q9	4793	4714	4695	4695
q10	6310	1893	1624	1624
q11	467	261	247	247
q12	685	580	492	492
q13	18038	2928	2176	2176
q14	238	223	228	223
q15	944	787	842	787
q16	762	746	692	692
q17	738	852	449	449
q18	6108	5420	5224	5224
q19	1604	984	620	620
q20	512	485	403	403
q21	4752	2184	1504	1504
q22	368	315	269	269
Total cold run time: 96992 ms
Total hot run time: 27581 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4832	4580	4638	4580
q2	q3	3863	4440	3866	3866
q4	876	1202	770	770
q5	4149	4426	4445	4426
q6	194	173	140	140
q7	1763	1615	1577	1577
q8	2480	2690	2557	2557
q9	7439	7269	7232	7232
q10	3725	3987	3630	3630
q11	552	445	424	424
q12	504	628	436	436
q13	2856	3224	2408	2408
q14	282	301	279	279
q15	872	800	810	800
q16	699	746	741	741
q17	1182	1395	1300	1300
q18	7238	6779	6657	6657
q19	852	860	869	860
q20	2105	2177	2086	2086
q21	3955	3543	3354	3354
q22	440	424	376	376
Total cold run time: 50858 ms
Total hot run time: 48499 ms

@doris-robot

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

query5	4336	625	530	530
query6	315	225	220	220
query7	4211	471	270	270
query8	349	287	221	221
query9	8708	2713	2735	2713
query10	528	408	348	348
query11	7347	5867	5639	5639
query12	192	130	124	124
query13	1265	459	346	346
query14	5928	3832	3627	3627
query14_1	2829	2803	2851	2803
query15	202	195	174	174
query16	1016	488	471	471
query17	1103	758	597	597
query18	2473	435	333	333
query19	212	201	176	176
query20	137	128	127	127
query21	225	141	126	126
query22	4797	5124	4697	4697
query23	15944	15504	15347	15347
query23_1	15463	16168	16003	16003
query24	7484	1677	1287	1287
query24_1	1286	1262	1257	1257
query25	568	496	423	423
query26	1476	284	159	159
query27	3204	527	315	315
query28	4846	1945	1961	1945
query29	984	588	534	534
query30	458	273	218	218
query31	1413	1365	1301	1301
query32	87	76	75	75
query33	560	369	288	288
query34	1060	986	594	594
query35	645	676	605	605
query36	1121	1135	947	947
query37	150	92	80	80
query38	2947	2938	2903	2903
query39	869	877	836	836
query39_1	807	831	830	830
query40	231	147	136	136
query41	63	62	57	57
query42	301	304	311	304
query43	243	241	235	235
query44	
query45	192	188	182	182
query46	877	986	609	609
query47	2152	2180	2055	2055
query48	298	311	230	230
query49	625	455	387	387
query50	680	268	204	204
query51	4150	4120	4044	4044
query52	291	290	285	285
query53	293	333	283	283
query54	298	267	260	260
query55	93	89	85	85
query56	319	313	316	313
query57	1369	1311	1264	1264
query58	291	281	274	274
query59	1325	1476	1346	1346
query60	352	336	318	318
query61	142	141	140	140
query62	618	560	537	537
query63	308	277	274	274
query64	4935	1259	971	971
query65	
query66	1435	470	358	358
query67	16415	16349	16229	16229
query68	
query69	399	309	280	280
query70	974	957	878	878
query71	349	319	304	304
query72	2914	2826	2607	2607
query73	537	548	322	322
query74	10043	9949	9812	9812
query75	2858	2783	2496	2496
query76	2297	1033	681	681
query77	374	389	318	318
query78	11138	11492	10664	10664
query79	1141	795	590	590
query80	826	671	602	602
query81	510	275	248	248
query82	1347	152	122	122
query83	326	272	247	247
query84	253	118	92	92
query85	919	480	431	431
query86	412	307	300	300
query87	3173	3115	2978	2978
query88	3555	2641	2640	2640
query89	437	366	347	347
query90	1849	177	172	172
query91	169	166	133	133
query92	77	75	75	75
query93	915	836	502	502
query94	485	333	304	304
query95	577	332	391	332
query96	636	512	228	228
query97	2466	2527	2442	2442
query98	235	218	218	218
query99	1015	1000	921	921
Total cold run time: 233104 ms
Total hot run time: 153276 ms

@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: JDBC Data Source Refactoring

Reviewed this PR that refactors JDBC scanning/writing to use the unified FileScanner/JniReader framework. The architecture is well-designed — splitting JniConnector into JniReader (lifecycle) + JniDataBridge (stateless data exchange), and introducing the JdbcTypeHandler strategy pattern are good abstractions.

However, I found several issues, including one critical data loss bug. See inline comments for details.

Critical Checkpoints (per code-review skill)

Checkpoint Conclusion
Goal accomplished? Partially. The scan path refactoring looks correct, but the write path has a critical transaction commit bug that causes silent data loss.
Modification focused? Mostly yes, though 74 files / 5000+ lines is a large changeset. The TypeHandler strategy pattern extraction adds complexity but is justified.
Concurrency No new concurrency issues introduced. JniReader lifecycle is single-threaded per scanner instance.
Lifecycle management _file_slot_descs stored as reference is fragile but currently safe (documented in comment).
Incompatible changes / rolling upgrade JdbcScanNode now extends FileQueryScanNode. Thrift field jdbc_params added as optional (field 11) in TTableFormatFileDesc — backward compatible. Old FE → new BE path should work since old path still exists.
Parallel code paths The internal_service.cpp test_jdbc_connection path was updated consistently.
Test coverage PR claims "Previous test can cover this change" with no new tests for a 5000+ line refactor. This is concerning — the transaction commit bug would have been caught by any transactional write test.
Observability No new metrics or logging added for the new JNI-based JDBC path. The old path had some timing counters.
Data writes CRITICAL: Transactional writes are broken — see inline comment #1.
FE-BE variable passing jdbc_driver_checksum is missing from the scanner params path — see inline comment #5.

Comment thread be/src/format/table/jdbc_jni_reader.cpp Resolved
Comment thread be/src/util/jdbc_utils.cpp Resolved
Comment thread be/src/exec/scan/jdbc_scanner.cpp Resolved
@morningman
morningman force-pushed the wt-new-jni-refactor branch from b8d722f to 836de99 Compare March 13, 2026 06:37
@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 79.24% (1798/2269)
Line Coverage 64.53% (32283/50026)
Region Coverage 65.44% (16165/24702)
Branch Coverage 55.83% (8607/15416)

@doris-robot

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17705	4516	4339	4339
q2	q3	10711	796	554	554
q4	4729	366	264	264
q5	8213	1195	1035	1035
q6	236	174	147	147
q7	826	835	683	683
q8	10657	1515	1299	1299
q9	6750	4804	4758	4758
q10	6324	1911	1648	1648
q11	456	259	245	245
q12	696	590	460	460
q13	18110	2931	2175	2175
q14	233	228	223	223
q15	q16	740	805	671	671
q17	728	838	452	452
q18	5903	5493	5184	5184
q19	1124	982	627	627
q20	533	481	369	369
q21	4634	1974	1459	1459
q22	397	345	275	275
Total cold run time: 99705 ms
Total hot run time: 26867 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4730	4616	4543	4543
q2	q3	3919	4373	3867	3867
q4	897	1194	763	763
q5	4064	4370	4370	4370
q6	181	173	140	140
q7	1760	1713	1586	1586
q8	2530	2719	2588	2588
q9	7478	7485	7340	7340
q10	3727	3984	3674	3674
q11	534	441	426	426
q12	510	606	492	492
q13	2840	3251	2363	2363
q14	292	310	278	278
q15	q16	738	804	704	704
q17	1160	1306	1442	1306
q18	7219	6833	6536	6536
q19	885	909	929	909
q20	2060	2267	2047	2047
q21	4059	3458	3319	3319
q22	442	449	365	365
Total cold run time: 50025 ms
Total hot run time: 47616 ms

@doris-robot

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

query5	4327	657	513	513
query6	333	230	208	208
query7	4213	478	271	271
query8	342	265	234	234
query9	8673	2734	2702	2702
query10	482	387	349	349
query11	6979	5102	4865	4865
query12	193	127	124	124
query13	1279	486	362	362
query14	5746	3699	3478	3478
query14_1	2843	2804	2778	2778
query15	200	201	178	178
query16	985	476	461	461
query17	966	740	619	619
query18	2447	456	353	353
query19	221	211	205	205
query20	136	132	127	127
query21	218	133	116	116
query22	13271	14278	14997	14278
query23	16262	16132	15764	15764
query23_1	15716	15633	15749	15633
query24	7933	1612	1215	1215
query24_1	1228	1220	1235	1220
query25	567	502	441	441
query26	1251	262	201	201
query27	2713	469	299	299
query28	4472	1858	1872	1858
query29	797	564	469	469
query30	296	225	196	196
query31	1011	929	850	850
query32	80	74	66	66
query33	508	331	281	281
query34	885	877	528	528
query35	634	684	595	595
query36	1107	1124	960	960
query37	138	97	81	81
query38	2913	2937	2813	2813
query39	862	827	821	821
query39_1	792	793	801	793
query40	231	152	132	132
query41	63	59	61	59
query42	263	252	257	252
query43	243	245	211	211
query44	
query45	197	184	180	180
query46	869	983	604	604
query47	2138	2200	2058	2058
query48	323	309	225	225
query49	638	482	384	384
query50	678	277	210	210
query51	4051	4084	4037	4037
query52	259	267	254	254
query53	294	339	279	279
query54	322	266	256	256
query55	90	84	82	82
query56	315	316	303	303
query57	1936	1960	1708	1708
query58	281	278	268	268
query59	2754	3002	2750	2750
query60	337	335	326	326
query61	154	189	148	148
query62	631	588	538	538
query63	308	272	270	270
query64	5000	1273	1003	1003
query65	
query66	1470	464	353	353
query67	24335	24364	24189	24189
query68	
query69	402	308	284	284
query70	983	948	883	883
query71	332	311	309	309
query72	2805	2708	2435	2435
query73	533	536	308	308
query74	9605	9578	9366	9366
query75	2846	2774	2480	2480
query76	2282	1013	679	679
query77	381	407	302	302
query78	10904	11129	10491	10491
query79	1909	768	570	570
query80	1526	627	541	541
query81	552	263	220	220
query82	981	146	121	121
query83	339	259	243	243
query84	297	120	103	103
query85	919	490	477	477
query86	415	314	292	292
query87	3124	3121	3069	3069
query88	3498	2625	2635	2625
query89	418	367	343	343
query90	2012	183	170	170
query91	164	163	138	138
query92	77	75	68	68
query93	960	830	496	496
query94	646	313	301	301
query95	585	403	305	305
query96	655	501	232	232
query97	2436	2460	2417	2417
query98	239	219	225	219
query99	1004	1011	955	955
Total cold run time: 250583 ms
Total hot run time: 168660 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.70% (19725/37430)
Line Coverage 36.28% (184429/508347)
Region Coverage 32.45% (142413/438919)
Branch Coverage 33.61% (62206/185085)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.60% (26231/36635)
Line Coverage 54.39% (275536/506625)
Region Coverage 51.62% (228643/442967)
Branch Coverage 53.07% (98476/185567)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.59% (26228/36635)
Line Coverage 54.38% (275482/506625)
Region Coverage 51.61% (228616/442967)
Branch Coverage 53.06% (98462/185567)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.58% (26225/36635)
Line Coverage 54.37% (275439/506625)
Region Coverage 51.61% (228602/442967)
Branch Coverage 53.05% (98441/185567)

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Mar 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@morningman
morningman merged commit 9770ecf into apache:master Mar 16, 2026
32 of 40 checks passed
morningman added a commit to morningman/doris that referenced this pull request Mar 25, 2026
… framework (apache#61141)

Refactor the JDBC data source scanning architecture to integrate with
the
unified FileScanner/JniReader framework, replacing the standalone
ExternalScanNode-based JDBC scan path.

The JDBC scan path was independently implemented with its own operator
(JDBCScanLocalState), scanner (JdbcScanner), and JNI connector
(JniConnector
→ BaseJdbcExecutor hierarchy), while other JNI-based data sources
(Paimon,
Hudi, MaxCompute, TrinoConnector) already use the unified FileScanner →
JniReader → JniScanner path. This caused code duplication, maintenance
burden,
and architectural inconsistency.

1. BE: Split JniConnector into two focused classes:
- JniReader: JNI lifecycle management (open/read/close), base class for
all JNI readers (PaimonJniReader, HudiJniReader, JdbcJniReader, etc.)
   - JniDataBridge: Stateless data exchange between C++ Blocks and Java
     shared memory via JNI

2. Java: Introduce Strategy Pattern for database-specific type handling:
- JdbcTypeHandler interface with DefaultTypeHandler base implementation
   - Per-database handlers: MySQLTypeHandler, OracleTypeHandler,
     PostgreSQLTypeHandler, ClickHouseTypeHandler, SQLServerTypeHandler,
DB2TypeHandler, SapHanaTypeHandler, TrinoTypeHandler, GbaseTypeHandler
   - JdbcTypeHandlerFactory for handler selection
   - JdbcJniScanner (extends JniScanner) for read path
   - JdbcJniWriter (extends JniWriter) for write path
   - Old BaseJdbcExecutor subclasses marked @deprecated but preserved

3. FE: Migrate JdbcScanNode from ExternalScanNode to FileQueryScanNode:
   - JdbcScanNode now extends FileQueryScanNode
   - Introduces JdbcSplit (extends FileSplit) to carry JDBC params
   - Uses TFileScanRange with FORMAT_JNI and table_format_type="jdbc"
   - Adds jdbc_params field to TTableFormatFileDesc in Thrift
   - Adapts PhysicalPlanTranslator.visitPhysicalJdbcScan() accordingly

4. BE: Add JdbcJniReader and integrate into FileScanner:
- JdbcJniReader handles special types (bitmap, HLL, quantile_state,
JSONB)
     via string-based intermediary and CAST
   - FileScanner._get_next_reader() adds "jdbc" table_format_type branch
   - JdbcUtils utility for JDBC driver URL resolution
   - Existing JdbcScanner preserved as transitional (deprecated)

All predicate push-down logic (createJdbcFilters, getJdbcQueryStr, etc.)
is preserved from the original JdbcScanNode implementation.
morningman added a commit to morningman/doris that referenced this pull request Mar 25, 2026
… framework (apache#61141)

Refactor the JDBC data source scanning architecture to integrate with
the
unified FileScanner/JniReader framework, replacing the standalone
ExternalScanNode-based JDBC scan path.

The JDBC scan path was independently implemented with its own operator
(JDBCScanLocalState), scanner (JdbcScanner), and JNI connector
(JniConnector
→ BaseJdbcExecutor hierarchy), while other JNI-based data sources
(Paimon,
Hudi, MaxCompute, TrinoConnector) already use the unified FileScanner →
JniReader → JniScanner path. This caused code duplication, maintenance
burden,
and architectural inconsistency.

1. BE: Split JniConnector into two focused classes:
- JniReader: JNI lifecycle management (open/read/close), base class for
all JNI readers (PaimonJniReader, HudiJniReader, JdbcJniReader, etc.)
   - JniDataBridge: Stateless data exchange between C++ Blocks and Java
     shared memory via JNI

2. Java: Introduce Strategy Pattern for database-specific type handling:
- JdbcTypeHandler interface with DefaultTypeHandler base implementation
   - Per-database handlers: MySQLTypeHandler, OracleTypeHandler,
     PostgreSQLTypeHandler, ClickHouseTypeHandler, SQLServerTypeHandler,
DB2TypeHandler, SapHanaTypeHandler, TrinoTypeHandler, GbaseTypeHandler
   - JdbcTypeHandlerFactory for handler selection
   - JdbcJniScanner (extends JniScanner) for read path
   - JdbcJniWriter (extends JniWriter) for write path
   - Old BaseJdbcExecutor subclasses marked @deprecated but preserved

3. FE: Migrate JdbcScanNode from ExternalScanNode to FileQueryScanNode:
   - JdbcScanNode now extends FileQueryScanNode
   - Introduces JdbcSplit (extends FileSplit) to carry JDBC params
   - Uses TFileScanRange with FORMAT_JNI and table_format_type="jdbc"
   - Adds jdbc_params field to TTableFormatFileDesc in Thrift
   - Adapts PhysicalPlanTranslator.visitPhysicalJdbcScan() accordingly

4. BE: Add JdbcJniReader and integrate into FileScanner:
- JdbcJniReader handles special types (bitmap, HLL, quantile_state,
JSONB)
     via string-based intermediary and CAST
   - FileScanner._get_next_reader() adds "jdbc" table_format_type branch
   - JdbcUtils utility for JDBC driver URL resolution
   - Existing JdbcScanner preserved as transitional (deprecated)

All predicate push-down logic (createJdbcFilters, getJdbcQueryStr, etc.)
is preserved from the original JdbcScanNode implementation.
morningman added a commit to morningman/doris that referenced this pull request Oct 31, 2026
… in the suite comment

### What problem does this PR solve?

Issue Number: None

Related PR: apache#61141, apache#69601

Problem Summary: The header comment of test_tvf_avro_format_rejected said
that apache#69601 removed the BE Avro reader. On master the reader was removed by
apache#61141; apache#69601 made FE reject format=avro during analysis and added a BE-side
guard. Correct the PR number in the comment. Comment only.

### Release note

None

### Check List (For Author)

- Test: No need to test (comment-only change); the suite still passes the
  offline Groovy parse check
- Behavior changed: No
- Does this need documentation: No

Co-Authored-By: Claude Opus 5.5 <[email protected]>
morningman added a commit that referenced this pull request Oct 31, 2026
…69849)

### What problem does this PR solve?

Issue Number: None

Related PR: #69601, #64699

Problem Summary:

**In short.** #69601 made FE reject `format=avro` while it parses file
format properties. This PR adds end-to-end coverage for that: a
regression suite that runs `s3()` and `hdfs()` with `format=avro` and
checks that they fail during analysis, and a unit test for the two
table-function constructors. Test only, no code change.

**Background.** Master no longer reads standalone Avro files: #61141
removed the BE reader, #65733 the scanner module, and #69601 made
`FileFormatProperties.createFileFormatProperties` throw `Avro file reads
are no longer supported`. Before #69601, FE accepted the format and the
query failed later in BE with `Not supported file format in fetch table
schema: 12`. branch-4.2 still reads Avro through the JNI scanner (#64699
fixed a crash in it), so users who upgrade from 4.x with Avro table
functions or loads get this error.

**What was missing.** #69601's unit test calls
`createFileFormatProperties` directly. Nothing checks that a table
function reaches that check before it validates storage properties or
lists files. If a constructor validated the location first,
`format=avro` against an unreachable location would report a storage
error instead, and no test would notice.

**What this PR adds.**

- `external_table_p0/tvf/test_tvf_avro_format_rejected`: `s3()` and
`hdfs()` with `format` set to `avro` and to `AVRO`, against a made-up
bucket, made-up credentials and an HDFS address nothing listens on. Each
call must fail with `Avro file reads are no longer supported`.
-
`UnsupportedExternalReadsTest#testAvroTableFunctionsAreRejectedBeforeStorageAccess`:
constructs `S3TableValuedFunction` and `HdfsTableValuedFunction` with
`format=avro` / `AVRO` and checks the same message.

**Results.** On master `2a4191c1dc9` with this change, all four
statements of the suite fail during analysis with `Can not build s3():
Avro file reads are no longer supported` / `Can not build hdfs(): ...`,
and the unit test passes. Before #69601 the same `s3()` call would have
gone on to validate and list the made-up location, so the suite pins the
order as well as the message.
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/4.1.x reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants