Skip to content

[feature](external) Support reading Delta Lake tables natively with Delta Kernel - #69904

Open
xylaaaaa wants to merge 45 commits into
apache:masterfrom
xylaaaaa:codex/delta-m1-reader
Open

xylaaaaa wants to merge 45 commits into
apache:masterfrom
xylaaaaa:codex/delta-m1-reader

Conversation

@xylaaaaa

@xylaaaaa xylaaaaa commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: #69884

Problem Summary:

Add native read-only Delta Lake support through a Kernel 4.4.1 FE connector and
FileScannerV2's native Parquet reader. The reader preserves the transaction-log
snapshot, logical/physical column mapping and deletion-vector row positions.
Catalogs can discover tables through Hive Metastore or a filesystem warehouse;
existing Hive catalogs can route Delta tables to the same native path.

This is a draft for implementation review. Performance acceptance, the remaining
storage matrix, the website documentation PR and final acceptance are open.

Integrated master 5af2df3231 in fcc32e2885 after the original TeamCity COMPILE, FE UT, Cloud UT and BE UT jobs all stopped at the same merge conflicts. Delta now uses the request-based streaming SPI and master's unified scanner; closing sources, stopping failed queries and publishing successful scan profiles follow the current split lifecycle. The standard FE UT reactor now includes Delta.

Delta validates the physical format of every range and propagates missing committed data or deletion-vector files instead of returning a partial snapshot.

Local integration checks: full FE/Checkstyle and ASAN BE builds passed. Of 859 selected FE tests, 857 passed and two opt-in cases were skipped; the final real SplitAssignment fixture was also rerun (39/39 overlapping lifecycle/producer tests passed). The ASAN BE runner passed all 239 selected tests, including 3 scanner-dispatch/format/missing-file cases, 14 Delta reader and 3 deletion-vector cases. C++ clang-format 16, header hygiene and changed-line clang-tidy passed.

On integration commit fcc32e2885, COMPILE, FE UT, Cloud UT and BE UT all passed. The separate FE coverage check failed on that commit.

The November 3 test change runs the Delta basic and features suites with the deprecated scanner option set to true. The Hive gateway and native dispatch tests retain false-setting coverage. Both suites passed generation and comparison against the retained fixtures. Removing 32 duplicate result blocks dropped 526 expected-output lines. All 146 retained blocks were byte-identical. Full CI requested on 338108051b.

The row-count change in 3d4899eb94 restores master’s FE table-level row-count cache for ordinary reads and removes the extra Hive snapshot-statistics forwarding. Delta keeps versioned logical counts and same-version CRC fallback. An access after the FE refresh interval (10 minutes by default) triggers an asynchronous update. The full FE build and 102 targeted unit tests passed. The statistics p0 passed for filesystem, HMS and Hive. Under the default refresh interval all three routes converged to 3 and 35 rows for the two reference tables. All 24 TPC-DS manifest counts matched and Q1 passed on both readers in the focused p2 run. Full CI requested.

CI diagnosis and verification. Benchmark, SQL and scale figures below are historical results at or before measurement head f0a229f7b9.

Implemented scope:

  • HMS/filesystem discovery, catalog properties, type/reader-feature validation,
    statement-pinned snapshots and catalog-owned filesystem clients.
  • Native Parquet scans; none/name/id column mapping, nested schema evolution,
    timestamps/NTZ and the tested type-widening combinations.
  • Portable disk and inline deletion vectors, including file-global row positions
    across byte-range splits. Legacy native bitmap encoding is rejected.
  • Partition/file skipping, native Parquet row-group/page pruning, and exact
    unfiltered metadata COUNT when all required file statistics are present,
    subtracting deletion-vector cardinality. Other cases scan normally.
  • Classic/multipart/V2 JSON and Parquet checkpoints, sidecars and log compaction.
    Fixed latest-version TTL (hits do not extend it), user-scoped snapshot caching,
    REFRESH invalidation and lazy streaming split enumeration.
  • Basic optimizer row/size statistics, added on 2026-11-02: logical rows are cached
    by user/table identity/version and exclude deletion-vector cardinality. A bounded
    background pool collects active-file statistics; cold lookups use same-version
    CRC bytes when available. Ordinary Delta reads use the standard FE row-count
    cache through direct and Hive catalogs. Exact COUNT is independent. Shared real
    checkpoint/DV snapshots have concurrent scan coverage.
  • EXPLAIN/profile diagnostics for snapshot version, files, partitions and splits.
    Streaming sources close before scheduling completion; close failures propagate.
  • Optional Spark/HMS/MinIO fixtures, retained test data, storage regression and a
    shared-file Hive/Delta benchmark. Normal restarts reuse initialized fixtures.

Time travel, Unity/Glue catalogs, variant, Delta writes and column-level NDV /
histogram statistics are out of scope for this PR. Basic table row/size statistics are included. No additional log/checkpoint content cache is introduced: the
million-file measurements did not justify it here.

Compatibility: all new Thrift fields are optional. deltalake_params uses
TTableFormatFileDesc field 17: master took field 16 for mongodb_params (#70327),
so the merge of master at e321ede256 moved Delta to 17. Field 17 is unused on master and
branch-4.2/4.1/4.0/3.1 (highest existing IDs: 16/13/12/10/9); no ID is reused and
existing meanings are preserved. Native Delta queries require compatible FE/BE
versions; older BE versions do not implement this reader.

Outbound HTTP / SSRF surface: object-store endpoints supplied through catalog
properties cause FE log/checkpoint reads and BE Parquet/DV reads through existing
filesystem clients. Configuring endpoints requires catalog CREATE_PRIV or
ALTER_PRIV; SELECT_PRIV can trigger reads. This implementation reuses
fe-filesystem configuration and does not fetch/load runtime artifacts from
catalog-supplied URLs.

Release note

Add native read-only Delta Lake catalogs backed by Hive Metastore or filesystem
warehouses, plus native Delta reads through Hive catalogs. Support mapped/evolved
schemas, portable deletion vectors, V2 checkpoints, pruning, metadata COUNT and
streaming file planning, with asynchronous versioned basic optimizer statistics.
A missing file referenced by the Delta snapshot fails the query.

Check List (For Author)

  • Test

    • Regression test: eight Delta p0 suites passed twice against the optional
      Docker environment; million-file planning p2 passed; MinIO and ordinary
      HDFS 3.2.1 storage p2 passed using the same generated expected output.
    • The basic partition and Parquet deletion-vector suites passed using the default streaming threshold of 1 and passed again with synchronous scheduling. The completed query profiles for filesystem and HMS each showed one file and one split for the filtered partition, and one file and five splits for the cross-split deletion-vector query.
    • Unit Test: 165 ASAN BE tests (including existing Iceberg/Paimon readers),
      75 Delta connector, 2 metastore, 25 FE core and 274 Hive-related tests passed.
    • Manual test: full FE and ASAN BE builds on local macOS ARM64;
      clang-format 16, header hygiene and clang-tidy passed. Thirteen physical
      Parquet fixtures matched PyArrow; semantic golden fixtures matched Spark.
      Metadata COUNT profiles verified zero data reads. Three million-file
      source passes completed in a 512 MiB JVM (first split 22–60 ms, enumeration
      1.46–1.86 s, sampled heap peak about 200 MiB). This synthetic fixture has
      no physical data objects and measures planning/count only. Restart checks
      preserved all 1,227 MinIO objects by path, size and SHA-256.
    • Statistics follow-up (2026-11-02, head cc12b56819): final full FE build
      and Checkstyle; 87 Delta + 2 metastore tests, broad 267 Hive / 114 FE core
      tests, and focused 22 Paimon / 7 Iceberg compatibility tests passed. Eight
      concurrent scans share one real checkpoint/DV snapshot. Seven Delta p0
      suites passed on the final FE build, including the new statistics suite
      through filesystem/HMS/Hive; expected output was generated by the official
      script and then verified without generation. Background auth/classloader,
      invalidation, cancellation, retry, identity/version isolation and missing
      stats are covered. Existing 1,227 MinIO objects still match their retained
      path/size/SHA-256 manifest.
    • Million-file statistics in a 512 MiB JVM: cold lookup 0.491 ms, background
      completion 2.170 s, sampled heap peak 100,255,200 bytes (about 96 MiB).
      This synthetic fixture measures metadata planning/statistics, not data scans.
    • TPC-DS statistics-ready rerun (2026-11-02): all 103 query files / 824
      executions passed in one official suite, with three alternating measured
      pairs and unchanged controls. All 24 Delta cardinalities matched the
      independent fixture manifest before timing. Eight complete diagnostic
      profiles and a separate Q4 repeat are retained without replacing the full
      samples. All 1,227 data objects still match the retained checksum manifest.
    • Linux CI and remaining acceptance gates below.
  • Behavior changed:

    • Yes. Adds native Delta catalogs/Hive routing and scan diagnostics;
      streaming source-close errors now fail scheduling instead of being logged
      after completion. Delta provides logical row counts and CRC size estimates
      through the existing table statistics API.
  • Does this need documentation?

    • Yes. The connector README documents basic statistics and configuration.
      Local design/tasklist and paired EN/ZH website patches are updated. Documentation PR and
      full website build are pending.

Performance evidence and remaining gates

On the November 2 build with the earlier FE statistics path, all 103 TPC-DS queries
passed and the measured gap narrowed from 26.1% to 16.5%. Performance acceptance remains open.

TPC-DS summed per-query medians Hive Delta Delta / Hive
Before statistics 232.545 s 293.214 s 1.2609
After statistics, 103 queries 225.408 s 262.556 s 1.1648
After, 91 nonempty-result queries 212.654 s 246.057 s 1.1571

The full rerun uses the same retained SF1 data, ASAN build, query settings and
Q85/Q30 controls. An optional independent-manifest check waits for Delta's
asynchronous statistics before timing and records Hive estimates. Medians still
come from three alternating pairs, excluding first executions. Delta's total
falls 10.46% and Hive's 3.07%; this before/after observation does not isolate the
cause of every timing change.

Separate complete profiles confirm Q43's build side falls from 2.75M rows to
366 and Q72 no longer builds from 11.745M inventory rows. Q22 is still about 40%
slower; Q4/Q11/Q74 lost earlier Delta advantages. A separate Q4 repeat still shows
a 44.2% gap and is excluded from the 103-query aggregate. Detailed samples and
before/after CSV/JSON remain in the local benchmark report; the benchmark README
contains the reproducible setup and result summary.

Earlier baseline, retained below: TPC-H has not been rerun. The following
125-query comparison predates basic statistics; it is not a new result.

All 22 TPC-H and 103 TPC-DS queries completed cross-reader result comparison and
three alternating paired repetitions on the same retained SF1 Parquet objects.
This combines several official regression invocations, with original failures
retained; it is not an unmodified full-suite pass. Both paths use FileScannerV2,
four pipeline tasks, disabled SQL/file caches, UTC, 8 GiB/query and 120 seconds.

Local ASAN -O0 measurement Hive sum of per-query medians Delta sum Delta / Hive
TPC-H, 22 queries 134.565 s 96.342 s 0.716
TPC-DS, 103 queries 232.545 s 293.214 s 1.261

These are local relative observations, not RELEASE performance, concurrent
throughput or certified TPC results. TPC-DS uses the repository's SF100 query
parameters on SF1 data; 12 queries have empty results. Excluding them, the
TPC-DS ratio is 1.215.

Explicit controls: Q7 and Q85 use the same fixed join order on both readers after
default Hive plans exceeded memory; Q15 uses an equivalent CTE; Q30 projects the
current generator's review-date string column. Results use the framework's typed
comparator (exact integer/decimal, floating tolerance 1e-8). Q39's original exact
comparison differed by one ULP in one cell; the original difference is retained.

Nine complete profile pairs show different join build sides, runtime-filter
placement and scanner parallelism. For example, Q72's Delta plan builds from
11.745M inventory rows versus Hive's 62,699-row filtered build side; Q43 builds
from 2.750M sales rows versus Hive's 366 date rows. Missing statistics were one observed planning limitation; basic row/size
statistics are now available. Column statistics remain absent, and the full gap
has not been attributed solely to this omission. Q22 variability and small-table streaming startup still
need isolation; performance parity is not accepted yet.

  • Resolve performance gaps within the scope of this PR.
  • Validate OSS, COS, OBS, Azure, GCS and Kerberos HDFS when environments become
    available. MinIO does not establish acceptance against live cloud services.
  • Submit the EN/ZH documentation PR and run website validation.
  • Integrate master 5af2df3231 and resolve the four conflicts against the current scanner and connector SPI.
  • Complete Linux CI on the integrated PR head.
  • Finish final acceptance and reconcile the implementation/design checklist.

The local tasklist currently records 63/67 completed items, including the three
basic-statistics/concurrency follow-ups. Environment configs,
local toolchains, large generated datasets and diagnostic logs are excluded from
this PR; reusable fixture generators and regression suites are included.

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?

@xylaaaaa xylaaaaa mentioned this pull request Oct 30, 2026
1 of 31 tasks
@xylaaaaa

Copy link
Copy Markdown
Contributor Author

run buildall

xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Nov 2, 2026
### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: Ordinary external-table queries only consulted the table-keyed
row-count cache, which could keep a cold estimate after versioned connector
statistics completed. Prefer statistics at the statement's pinned snapshot for
ordinary and versioned queries, reuse the existing size/row-width fallback, and
forward the pinned snapshot through the Hive sibling gateway. This covers STAT-02.

### Release note

External-table optimizer estimates can use completed statistics for the query's
pinned snapshot without waiting for the table-only row-count cache to refresh.

### Check List (For Author)

- Test: Full FE build and Checkstyle; 114 FE core and 267 Hive tests; focused
  compatibility run including 22 Paimon and 7 Iceberg tests; seven Delta p0 suites
  on the combined change, including new filesystem/HMS/Hive cardinality coverage.
- Behavior changed: Yes, ordinary pinned queries prefer snapshot statistics.
- Does this need documentation: Yes, Delta connector README and prepared EN/ZH
  website patch are updated in the accompanying statistics change; website PR pending.
xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Nov 2, 2026
### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: The native Delta connector did not supply basic table statistics
to the optimizer. Cache logical row counts by user, table identity and version,
summing active AddFile numRecords minus deletion-vector cardinality. Collect in a
bounded background pool and return same-version CRC size while cold; missing row
statistics stay unknown. Shared cache invalidation cancels pending work, and exact
COUNT remains independent of optimizer estimates. Add shared-snapshot concurrency,
real checkpoint/DV, lifecycle, authentication and million-file tests (STAT-01/03),
plus filesystem/HMS/Hive regression coverage and connector documentation.

### Release note

Native Delta Lake catalogs and Hive gateway queries gain basic versioned row/size
statistics with asynchronous collection and a CRC size fallback.

### Check List (For Author)

- Test: Full FE build and Checkstyle; 87 Delta and 2 metastore tests, including the
  opt-in million-file fixture in a 512 MiB JVM; focused compatibility/authentication
  rerun; seven Delta p0 suites passed on the final build. New .out generated by the
  official regression script and then verified without generation. Preserved all
  1,227 MinIO objects, checked by path, size and SHA-256.
- Behavior changed: Yes, Delta exposes basic optimizer statistics. Exact COUNT
  semantics and Delta data are unchanged; column NDV/histograms are not supplied.
- Does this need documentation: Yes, connector README included; local design,
  tasklist and EN/ZH website patch updated. Website PR/full site build pending.
@xylaaaaa

xylaaaaa commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Nov 2, 2026
…stics

### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: Delta table row counts load asynchronously, so a post-statistics
benchmark needs to distinguish ready statistics from a cold metadata lookup.
Add an optional retained-manifest check that waits for Delta EXPLAIN cardinalities
before timing and records Hive estimates. Keep the existing query texts, common
controls, result comparator and three alternating measured pairs unchanged.
Document the complete local TPC-DS rerun: the summed median gap narrows from
26.1% to 16.5%, with remaining regressions retained rather than replaced by
focused samples. No production code or fixture data changes.

### Release note

None

### Check List (For Author)

- Test: Official regression script passed all 103 TPC-DS queries (824 executions)
  with matching results; all 24 Delta cardinalities match the independent manifest.
  A separate Q4 rerun passed, and eight complete diagnostic profiles were retained.
  All 1,227 MinIO objects match their original path/size/SHA-256 before and after.
  Source whitespace checks and code-review checkpoints passed.
- Behavior changed: No production change. Optional benchmark warmup is disabled
  unless deltalakeBenchmarkStatisticsManifest is provided.
- Does this need documentation: Yes, benchmark README includes warmup usage,
  before/after measurements, controls and remaining performance limitations.
@xylaaaaa

xylaaaaa commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@xylaaaaa

xylaaaaa commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Nov 2, 2026
### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: COMPILE, FE UT, Cloud UT and BE UT all failed while merging
the PR into master 5af2df3, before their build or test commands ran.
Keep master's unified FileScannerV2 and split-producer lifecycle. Route Delta
through the request-based streaming SPI, honor cancellation and partition
selection, and validate the physical format on every Delta scan range.
Propagate missing snapshot files and scheduling errors. Include Delta in the
default FE unit-test reactor so the CI invocation exercises the connector.

### Release note

Delta scans fail if a committed data or deletion-vector file cannot be found,
instead of silently skipping a range when ignore_not_found_file is enabled.

### Check List (For Author)

- Test: Full FE and ASAN BE builds; standard FE unit-test selection (857
  passed, 2 opt-in cases skipped); FE Checkstyle, clang-format 16 and BE
  header hygiene. ASAN BE unit tests and a final FE lifecycle fixture
  recheck were still running or queued at commit time.
- Behavior changed: Yes. Delta uses master's common scanner and streamed
  split lifecycle and fails on missing snapshot files.
- Does this need documentation: Yes (connector README updated in this PR;
  the end-user documentation PR is tracked in apache#69884).
@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (17/17) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	16629	5111	5029	5029
q2	2107	307	245	245
q3	9910	1360	824	824
q4	4554	466	337	337
q5	7327	795	528	528
q6	186	181	150	150
q7	748	786	599	599
q8	9441	1333	1050	1050
q9	5551	4215	4154	4154
q10	6831	1294	1031	1031
q11	438	245	227	227
q12	639	393	279	279
q13	17923	3589	3038	3038
q14	282	274	248	248
q15	q16	713	711	667	667
q17	1183	748	564	564
q18	7050	6217	6152	6152
q19	1104	943	594	594
q20	385	342	228	228
q21	4996	2116	2240	2116
q22	345	296	253	253
Total cold run time: 98342 ms
Total hot run time: 28313 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5600	5593	5634	5593
q2	683	557	546	546
q3	5209	5387	5016	5016
q4	1990	2141	1575	1575
q5	5276	5171	5283	5171
q6	341	204	147	147
q7	2421	2065	1866	1866
q8	3007	2665	2658	2658
q9	8151	8077	8022	8022
q10	3729	3685	3451	3451
q11	603	447	409	409
q12	707	697	521	521
q13	3492	3844	3278	3278
q14	317	315	283	283
q15	q16	696	743	653	653
q17	8268	7277	6880	6880
q18	13074	12254	12877	12254
q19	895	767	782	767
q20	2203	2157	1932	1932
q21	5670	4548	4676	4548
q22	518	469	422	422
Total cold run time: 72850 ms
Total hot run time: 65992 ms

@hello-stephen

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

query5	4329	604	436	436
query6	435	208	195	195
query7	4815	438	234	234
query8	343	175	154	154
query9	8781	3139	3144	3139
query10	470	312	264	264
query11	5980	3844	3600	3600
query12	147	101	86	86
query13	1279	460	330	330
query14	6093	3911	3618	3618
query14_1	3441	3417	3393	3393
query15	208	199	182	182
query16	947	423	408	408
query17	842	668	532	532
query18	2422	427	312	312
query19	197	161	136	136
query20	83	85	82	82
query21	208	128	106	106
query22	12888	13175	12799	12799
query23	13500	12872	12378	12378
query23_1	12628	12629	12461	12461
query24	7230	821	475	475
query24_1	494	486	498	486
query25	535	419	369	369
query26	1266	255	144	144
query27	2780	432	272	272
query28	4531	2044	2057	2044
query29	1497	611	457	457
query30	300	221	184	184
query31	1018	930	816	816
query32	135	93	89	89
query33	528	311	244	244
query34	899	851	510	510
query35	730	747	639	639
query36	823	801	713	713
query37	130	99	82	82
query38	1767	1727	1651	1651
query39	797	814	748	748
query39_1	729	738	742	738
query40	215	116	101	101
query41	77	67	67	67
query42	88	85	86	85
query43	351	375	317	317
query44	1301	707	712	707
query45	181	189	164	164
query46	848	958	563	563
query47	2992	2787	2811	2787
query48	309	309	268	268
query49	560	385	287	287
query50	681	287	219	219
query51	10676	10433	10579	10433
query52	78	79	67	67
query53	181	215	156	156
query54	242	190	176	176
query55	68	66	60	60
query56	224	219	200	200
query57	1620	1626	1572	1572
query58	286	264	257	257
query59	2197	2224	2035	2035
query60	295	238	211	211
query61	153	147	137	137
query62	381	332	306	306
query63	190	161	170	161
query64	2678	964	785	785
query65	3319	3283	3262	3262
query66	1743	412	296	296
query67	20157	20259	21602	20259
query68	3090	1006	608	608
query69	377	293	250	250
query70	889	780	771	771
query71	303	235	208	208
query72	2676	2575	2227	2227
query73	504	521	317	317
query74	4601	4499	4345	4345
query75	2306	2308	1928	1928
query76	2143	1003	603	603
query77	345	361	274	274
query78	9740	9645	9129	9129
query79	1039	860	531	531
query80	1226	423	360	360
query81	567	332	272	272
query82	572	132	111	111
query83	299	193	186	186
query84	310	127	105	105
query85	855	431	375	375
query86	416	238	236	236
query87	1983	1959	1804	1804
query88	3827	2778	2772	2772
query89	329	281	242	242
query90	1841	168	165	165
query91	159	153	132	132
query92	110	89	85	85
query93	1090	997	576	576
query94	633	312	270	270
query95	585	324	366	324
query96	681	490	236	236
query97	2461	2458	2306	2306
query98	159	151	152	151
query99	766	756	654	654
Total cold run time: 234945 ms
Total hot run time: 151400 ms

@hello-stephen

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

query1	0.00	0.00	0.01
query2	0.14	0.08	0.08
query3	0.34	0.13	0.13
query4	1.61	0.13	0.14
query5	0.28	0.26	0.25
query6	1.15	0.65	0.64
query7	0.04	0.01	0.01
query8	0.09	0.07	0.08
query9	0.46	0.39	0.37
query10	0.58	0.60	0.58
query11	0.31	0.18	0.17
query12	0.32	0.19	0.21
query13	0.51	0.52	0.51
query14	0.94	0.93	0.92
query15	0.66	0.58	0.57
query16	0.36	0.38	0.37
query17	1.04	1.03	1.05
query18	0.28	0.28	0.27
query19	1.96	1.82	1.90
query20	0.02	0.02	0.01
query21	15.39	0.36	0.30
query22	4.93	0.12	0.12
query23	15.88	0.49	0.30
query24	1.99	0.58	0.39
query25	0.14	0.10	0.10
query26	0.79	0.27	0.21
query27	0.10	0.10	0.10
query28	3.46	0.83	0.39
query29	12.59	4.43	3.39
query30	0.35	0.18	0.14
query31	2.76	0.57	0.32
query32	3.23	0.61	0.49
query33	2.94	3.00	3.04
query34	15.90	4.09	3.44
query35	3.40	3.41	3.38
query36	0.64	0.49	0.47
query37	0.12	0.09	0.09
query38	0.07	0.07	0.07
query39	0.06	0.06	0.05
query40	0.19	0.17	0.17
query41	0.11	0.05	0.06
query42	0.06	0.06	0.06
query43	0.06	0.06	0.05
Total cold run time: 96.25 s
Total hot run time: 25.2 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 82.35% (28/34) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.70% (35894/46198)
Line Coverage 63.04% (403760/640441)
Region Coverage 59.67% (341911/572969)
Branch Coverage 60.74% (158134/260349)

xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Nov 3, 2026
### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: File scans always use FileScannerV2. The basic and features
Delta suites still exercised the same reader twice for both filesystem and
HMS catalogs. Run them with enable_file_scanner_v2=true and preserve the
retained query tags. The dedicated Hive gateway and native reader dispatch
checks still exercise the deprecated false setting.

### Release note

None

### Check List (For Author)

- Test: Regenerated expected outputs with run-regression-test.sh and reran
  test_deltalake_basic and test_deltalake_features in comparison mode.
  Both suites passed both runs. All 146 retained query output blocks were
  byte-identical. Removed 32 redundant blocks (526 lines).
- Behavior changed: No
- Does this need documentation: No
@xylaaaaa

xylaaaaa commented Nov 3, 2026

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 76.65% (2101/2741)
Line Coverage 66.07% (38830/58772)
Region Coverage 53.84% (36475/67743)
Branch Coverage 57.28% (11870/20722)

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17392	5197	5076	5076
q2	2118	313	251	251
q3	10161	1386	838	838
q4	4672	462	333	333
q5	7439	801	524	524
q6	182	185	154	154
q7	733	797	605	605
q8	9253	1375	1095	1095
q9	5597	4213	4197	4197
q10	6831	1293	1022	1022
q11	424	244	223	223
q12	638	407	291	291
q13	18105	3695	3038	3038
q14	272	277	259	259
q15	q16	721	714	663	663
q17	1213	750	569	569
q18	7004	6177	6116	6116
q19	1105	970	579	579
q20	382	336	231	231
q21	4797	2128	2247	2128
q22	348	294	256	256
Total cold run time: 99387 ms
Total hot run time: 28448 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5643	5584	5621	5584
q2	688	581	533	533
q3	5183	5372	4929	4929
q4	1997	2141	1561	1561
q5	5242	5177	5553	5177
q6	268	210	150	150
q7	2350	2022	1836	1836
q8	3009	2682	2730	2682
q9	8094	8005	7934	7934
q10	3761	3910	3205	3205
q11	618	462	406	406
q12	680	704	525	525
q13	3668	3894	3291	3291
q14	345	325	283	283
q15	q16	672	716	642	642
q17	8230	7187	6842	6842
q18	12967	12156	12976	12156
q19	908	787	786	786
q20	2157	2151	1942	1942
q21	5564	4560	4636	4560
q22	496	454	391	391
Total cold run time: 72540 ms
Total hot run time: 65415 ms

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17608	5156	5027	5027
q2	2120	320	257	257
q3	10230	1398	844	844
q4	4675	461	346	346
q5	7435	793	531	531
q6	184	188	152	152
q7	738	814	604	604
q8	9253	1310	1089	1089
q9	5453	4196	4179	4179
q10	6822	1294	1035	1035
q11	430	248	226	226
q12	653	411	277	277
q13	18117	3665	3052	3052
q14	280	272	249	249
q15	q16	704	712	658	658
q17	1196	753	578	578
q18	7116	6180	6124	6124
q19	1104	971	594	594
q20	384	338	223	223
q21	5634	2496	2425	2425
q22	392	330	283	283
Total cold run time: 100528 ms
Total hot run time: 28753 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5981	5871	6024	5871
q2	741	619	590	590
q3	5685	5787	5265	5265
q4	2022	2169	1571	1571
q5	5698	5917	5694	5694
q6	246	189	148	148
q7	2264	2015	1789	1789
q8	2965	2596	2607	2596
q9	7929	7535	7492	7492
q10	3649	3587	3125	3125
q11	575	406	410	406
q12	663	663	517	517
q13	3373	3637	3055	3055
q14	284	299	261	261
q15	q16	658	695	612	612
q17	7743	7051	6814	6814
q18	12877	12223	12874	12223
q19	901	787	791	787
q20	2113	2122	1928	1928
q21	5633	4543	4644	4543
q22	482	451	404	404
Total cold run time: 72482 ms
Total hot run time: 65691 ms

@hello-stephen

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

query5	4305	617	451	451
query6	428	217	199	199
query7	4806	453	229	229
query8	326	170	153	153
query9	8791	3262	3255	3255
query10	482	304	275	275
query11	6066	3891	3576	3576
query12	151	91	86	86
query13	1270	444	326	326
query14	6143	3920	3730	3730
query14_1	3443	3411	3422	3411
query15	204	213	183	183
query16	956	425	404	404
query17	846	659	531	531
query18	2416	423	308	308
query19	200	171	136	136
query20	86	85	84	84
query21	210	134	112	112
query22	12909	13000	12795	12795
query23	13484	12902	12483	12483
query23_1	12578	12614	12680	12614
query24	7363	843	468	468
query24_1	480	499	502	499
query25	504	391	338	338
query26	1250	254	133	133
query27	2778	437	282	282
query28	4612	2048	2061	2048
query29	1543	589	439	439
query30	299	221	190	190
query31	1000	929	810	810
query32	151	90	87	87
query33	519	285	234	234
query34	896	853	502	502
query35	720	747	625	625
query36	816	802	736	736
query37	129	106	82	82
query38	1784	1717	1713	1713
query39	788	786	771	771
query39_1	737	740	739	739
query40	229	115	92	92
query41	65	64	64	64
query42	89	82	81	81
query43	348	368	323	323
query44	1308	705	718	705
query45	177	180	162	162
query46	837	960	567	567
query47	3019	2897	2785	2785
query48	298	318	228	228
query49	571	416	290	290
query50	700	268	220	220
query51	10672	10689	10542	10542
query52	76	81	71	71
query53	184	213	151	151
query54	266	199	177	177
query55	70	68	67	67
query56	241	219	196	196
query57	1640	1643	1560	1560
query58	292	259	254	254
query59	2161	2132	1956	1956
query60	283	227	225	225
query61	152	154	147	147
query62	385	334	281	281
query63	189	159	163	159
query64	2836	1080	883	883
query65	3367	3314	3283	3283
query66	1796	428	314	314
query67	20563	20303	20160	20160
query68	3307	1029	621	621
query69	416	309	254	254
query70	824	796	773	773
query71	308	242	221	221
query72	2932	2662	2329	2329
query73	531	531	307	307
query74	4607	4516	4367	4367
query75	2357	2296	1907	1907
query76	2402	1008	589	589
query77	359	355	281	281
query78	9865	9809	9131	9131
query79	996	863	539	539
query80	1215	416	350	350
query81	598	333	275	275
query82	620	127	103	103
query83	305	194	183	183
query84	313	128	95	95
query85	889	459	379	379
query86	396	238	235	235
query87	2005	1962	1806	1806
query88	3841	2790	2785	2785
query89	360	285	240	240
query90	1901	169	170	169
query91	165	149	132	132
query92	102	96	96	96
query93	1079	1010	581	581
query94	653	289	266	266
query95	578	333	377	333
query96	699	486	243	243
query97	2430	2422	2313	2313
query98	166	158	148	148
query99	773	759	641	641
Total cold run time: 236972 ms
Total hot run time: 152082 ms

@hello-stephen

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

query1	0.01	0.01	0.01
query2	0.09	0.05	0.04
query3	0.26	0.08	0.09
query4	1.61	0.12	0.11
query5	0.27	0.24	0.24
query6	1.17	0.68	0.68
query7	0.04	0.01	0.01
query8	0.05	0.04	0.04
query9	0.39	0.35	0.35
query10	0.57	0.57	0.57
query11	0.19	0.14	0.15
query12	0.17	0.14	0.15
query13	0.49	0.51	0.48
query14	1.02	1.03	1.01
query15	0.62	0.61	0.60
query16	0.36	0.36	0.35
query17	1.12	1.12	1.15
query18	0.20	0.19	0.20
query19	2.12	2.05	2.02
query20	0.02	0.02	0.01
query21	15.51	0.20	0.13
query22	4.89	0.06	0.05
query23	16.26	0.33	0.13
query24	2.86	0.52	0.37
query25	0.12	0.06	0.05
query26	1.23	0.21	0.17
query27	0.04	0.04	0.05
query28	3.40	0.69	0.35
query29	12.49	4.15	3.23
query30	0.29	0.13	0.09
query31	2.77	0.55	0.33
query32	3.22	0.60	0.50
query33	3.25	3.21	3.23
query34	15.33	4.09	3.37
query35	3.35	3.36	3.31
query36	0.55	0.45	0.45
query37	0.13	0.08	0.08
query38	0.05	0.05	0.03
query39	0.04	0.04	0.03
query40	0.16	0.15	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: 96.88 s
Total hot run time: 24.35 s

xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Nov 3, 2026
### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: Commit 598756e made ordinary plugin table reads resolve
their pinned snapshot statistics on the planning thread. This changed the
row-count path for Iceberg, Paimon and Hive as part of a Delta feature.
Revert that commit's FE table and Hive statistics changes. Delta still
collects logical rows asynchronously per version and supplies same-version
CRC bytes when its count is unavailable. Exercise cold estimates in p0
and wait for the standard FE cache refresh before timing the p2 benchmark.

### Release note

Ordinary catalog queries use the standard FE external-table row-count cache.
Delta estimates in EXPLAIN may retain their initial value until an access
triggers a refresh (10 minutes by default). Exact COUNT is independent.

### Check List (For Author)

- Test: Full FE build and Checkstyle. All 102 targeted FE tests passed.
  test_deltalake_statistics passed for filesystem, HMS and Hive. With the
  default refresh interval, all 24 TPC-DS manifest counts matched and Q1
  passed for both readers in test_deltalake_benchmark.
- Behavior changed: Yes. Restore master's row-count policy for ordinary
  plugin table reads and its original Hive statistics delegation.
- Does this need documentation: Yes (connector README and benchmark guide
  updated in this PR; website documentation is tracked in apache#69884).
@xylaaaaa

xylaaaaa commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request Nov 3, 2026
### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: Merging master 7acfd9b left two Delta gaps. First,
apache#69717 replaced table_reader.h's full ShardedKVCache definition with a
forward declaration, but deltalake_reader_test.cpp constructs a
ShardedKVCache and relied on the transitive include. Include
format/format_common.h directly, as hudi_reader_test.cpp does. Second,
apache#69300 made Parquet readers in one scan share their profile counters
through TableReader's parquet profile cache. Hudi, Iceberg and the base
reader pass that cache, but DeltaReader still built its ParquetReader
without it, so every Delta file created its own set of counters. Pass
the cache, and keep binary-UUID preservation disabled as before.

### Release note

None

### Check List (For Author)

- Test: No local build. The merge was conflict-free. Both changes follow
  the matching master code. COMPILE and BE UT are left to CI.
- Behavior changed: No. Delta scan profiles reuse Parquet counters across files, as other formats do.
- Does this need documentation: No
@xylaaaaa

xylaaaaa commented Nov 3, 2026

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 76.65% (2101/2741)
Line Coverage 66.03% (38808/58772)
Region Coverage 53.78% (36430/67743)
Branch Coverage 57.23% (11859/20722)

xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request Nov 5, 2026
### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: Extracting decode_portable_deletion_vector_payload for
inline Delta DVs left the framed Iceberg/Delta decoder checking the
portable magic twice. Its first check runs before the CRC, and the
payload function checked it again. The magic constant was also defined
twice. Move the constant, the magic check and the Roaring decode into
file-local helpers. The framed decoder again validates magic, then
CRC, then decodes the bitmap once, with the same offsets and length it
used before this PR. The inline payload decoder keeps its own size
check and uses the same helpers.

### Release note

None

### Check List (For Author)

- Test: No local build. Existing Iceberg DV unit tests cover the magic
  and CRC rejection order. The Delta reader unit tests compare inline
  and on-disk decoding. Both are left to CI.
- Behavior changed: No. Iceberg DV decoding is again identical to master's.
- Does this need documentation: No
xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request Nov 5, 2026
…n validation

### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: validate_file_scan_support is the shared range gate for
table markers that are no longer supported. The Delta integration also
added a rule there that rejects non-Parquet Delta ranges. That state
cannot occur. The Delta protocol stores data only as Parquet, and
DeltaLakeScanRange always sends FORMAT_PARQUET. DeltaReader also asserts
Parquet in create_file_reader. That runs for every data file, after
prepare_split resets the reader format from the current range.
Remove the shared rule and its unit test, so validate_file_scan_support
is identical to master again. Keep the Delta entry in
can_ignore_not_found_file. A missing file in a committed Delta snapshot
must still fail the scan, as for Iceberg.

### Release note

None

### Check List (For Author)

- Test: No local build. The remaining Delta dispatch and missing-file
  unit tests are left to CI.
- Behavior changed: No for FE-generated plans. A malformed non-Parquet
  Delta range now fails the DeltaReader assertion instead of returning
  NotSupported.
- Does this need documentation: No
xylaaaaa added a commit to xylaaaaa/doris that referenced this pull request Nov 5, 2026
… the Delta PR

### What problem does this PR solve?

Issue Number: close apache#69884

Related PR: apache#69904

Problem Summary: The Delta integration widened two fe-core catch blocks
to Error. One is in executeWithProfileFinalization, on the batch planning
path. The other is in the streaming profile finalizer. A lazily loaded
plugin dependency then reported NoClassDefFoundError like any other
failure.

These are general hardening changes for every plugin connector, and
Delta does not depend on them. Master's SplitProducer already catches
Throwable while it iterates, closes the source and runs completion. The
scan still fails without hanging and still calls finishSchedule. Of the
four streaming tests added with the change, three cover existing master
behavior. Only the profile-phase Error case needs the widened catch.
Restore PluginDrivenScanNode and its scan profile test to master so the
Delta PR leaves fe-core unchanged. The hardening can be proposed on its
own.

### Release note

None

### Check List (For Author)

- Test: No local build. Both files are identical to master; left to CI.
- Behavior changed: No relative to master. A Delta-only branch would have
  reported a profile-phase Error as a UserException.
- Does this need documentation: No
@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 76.65% (2101/2741)
Line Coverage 65.98% (38780/58772)
Region Coverage 53.81% (36451/67743)
Branch Coverage 57.25% (11864/20722)

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17413	5157	5067	5067
q2	2118	312	253	253
q3	10113	1371	814	814
q4	4677	465	333	333
q5	7458	820	533	533
q6	180	187	152	152
q7	753	807	585	585
q8	9296	1351	1093	1093
q9	5560	4218	4170	4170
q10	6809	1298	1020	1020
q11	448	239	226	226
q12	630	398	275	275
q13	18138	3635	3047	3047
q14	276	276	257	257
q15	q16	717	718	655	655
q17	1191	776	585	585
q18	7011	6194	6119	6119
q19	1121	944	569	569
q20	373	330	220	220
q21	5683	2402	2477	2402
q22	413	343	263	263
Total cold run time: 100378 ms
Total hot run time: 28638 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5977	5947	5947	5947
q2	696	622	608	608
q3	5694	5666	5312	5312
q4	2344	2172	1573	1573
q5	5863	5606	5687	5606
q6	246	193	144	144
q7	2261	2022	1827	1827
q8	3047	2571	2496	2496
q9	7554	7477	7453	7453
q10	3631	3590	3193	3193
q11	589	402	380	380
q12	667	683	510	510
q13	3332	3684	3075	3075
q14	289	293	257	257
q15	q16	699	675	623	623
q17	7732	7042	6983	6983
q18	12960	12158	12824	12158
q19	889	757	776	757
q20	2163	2167	1913	1913
q21	5547	4612	4700	4612
q22	491	454	396	396
Total cold run time: 72671 ms
Total hot run time: 65823 ms

@hello-stephen

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

query5	4304	595	416	416
query6	432	214	192	192
query7	4810	453	226	226
query8	319	170	149	149
query9	8804	3147	3144	3144
query10	480	303	253	253
query11	6017	3854	3561	3561
query12	146	96	88	88
query13	1247	441	329	329
query14	6115	3914	3640	3640
query14_1	3430	3420	3396	3396
query15	204	205	196	196
query16	953	448	446	446
query17	837	650	542	542
query18	2421	432	315	315
query19	201	164	168	164
query20	92	80	78	78
query21	207	126	103	103
query22	13100	12954	12778	12778
query23	13403	12746	12406	12406
query23_1	12514	12547	12577	12547
query24	7343	812	463	463
query24_1	467	475	468	468
query25	504	388	332	332
query26	1274	253	135	135
query27	2793	435	269	269
query28	4623	1990	1999	1990
query29	1557	578	446	446
query30	296	215	178	178
query31	1021	916	811	811
query32	147	92	85	85
query33	511	290	229	229
query34	893	846	511	511
query35	714	749	646	646
query36	795	804	738	738
query37	129	94	78	78
query38	1781	1688	1677	1677
query39	783	781	738	738
query39_1	739	721	747	721
query40	210	113	95	95
query41	66	64	61	61
query42	86	80	79	79
query43	343	360	308	308
query44	1302	684	695	684
query45	175	175	166	166
query46	831	953	556	556
query47	2946	3023	2650	2650
query48	315	310	233	233
query49	576	392	288	288
query50	686	282	216	216
query51	10477	10696	10675	10675
query52	77	77	74	74
query53	185	207	157	157
query54	236	189	182	182
query55	69	68	62	62
query56	238	236	259	236
query57	1690	1602	1558	1558
query58	289	260	277	260
query59	2116	2176	1982	1982
query60	268	245	224	224
query61	149	136	137	136
query62	386	326	286	286
query63	188	156	157	156
query64	2723	926	748	748
query65	3322	3300	3261	3261
query66	1781	430	293	293
query67	22672	22747	22462	22462
query68	2935	990	617	617
query69	372	273	240	240
query70	847	764	765	764
query71	292	235	195	195
query72	2791	2595	2278	2278
query73	517	515	297	297
query74	4609	4475	4356	4356
query75	2317	2311	1910	1910
query76	2284	1002	636	636
query77	343	371	249	249
query78	9844	9665	9156	9156
query79	888	833	531	531
query80	461	418	321	321
query81	517	317	262	262
query82	201	127	102	102
query83	185	192	184	184
query84	282	128	108	108
query85	770	412	361	361
query86	253	239	227	227
query87	1975	1953	1837	1837
query88	3675	2750	2739	2739
query89	322	278	241	241
query90	2071	162	162	162
query91	160	159	130	130
query92	100	85	87	85
query93	981	973	577	577
query94	438	321	281	281
query95	586	391	293	293
query96	677	492	236	236
query97	2449	2448	2319	2319
query98	157	151	148	148
query99	761	762	645	645
Total cold run time: 235634 ms
Total hot run time: 153387 ms

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.14	0.08	0.08
query3	0.33	0.13	0.13
query4	1.61	0.13	0.13
query5	0.28	0.26	0.25
query6	1.15	0.65	0.64
query7	0.04	0.01	0.01
query8	0.09	0.07	0.07
query9	0.45	0.36	0.35
query10	0.56	0.56	0.59
query11	0.32	0.19	0.17
query12	0.32	0.18	0.20
query13	0.51	0.52	0.53
query14	0.94	0.93	0.92
query15	0.66	0.59	0.58
query16	0.34	0.34	0.37
query17	1.01	1.01	0.97
query18	0.29	0.26	0.26
query19	1.96	1.79	1.89
query20	0.02	0.01	0.01
query21	15.40	0.34	0.30
query22	4.91	0.13	0.12
query23	15.88	0.47	0.28
query24	2.15	0.53	0.36
query25	0.15	0.10	0.09
query26	0.74	0.26	0.21
query27	0.10	0.10	0.10
query28	3.52	0.78	0.38
query29	12.61	4.29	3.34
query30	0.33	0.16	0.14
query31	2.76	0.62	0.33
query32	3.23	0.60	0.48
query33	2.95	3.02	3.03
query34	15.89	4.05	3.46
query35	3.38	3.37	3.38
query36	0.61	0.50	0.46
query37	0.11	0.09	0.10
query38	0.07	0.06	0.06
query39	0.05	0.05	0.06
query40	0.19	0.17	0.16
query41	0.12	0.05	0.05
query42	0.06	0.06	0.06
query43	0.06	0.06	0.06
Total cold run time: 96.3 s
Total hot run time: 24.93 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage `` 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 88.89% (32/36) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 67.41% (32179/47738)
Line Coverage 52.29% (338995/648320)
Region Coverage 47.78% (275473/576581)
Branch Coverage 49.62% (129933/261830)

### Background

A Delta deletion vector uses positions in the entire Parquet file. Page
pruning can skip the first candidate page, and a scan split can start
after earlier row groups. The id and its projected payload must stay
aligned across both boundaries.

### What problem does this PR solve?

Issue Number: apache#69884
Related PR: apache#69904 (Delta Lake reader)
PR Type: Test

Problem Summary: The existing range queries retained a contiguous set of
pages in one split. An incorrect payload could also have the expected
length because every row in the fixture had the same value.

### Details

- **Scenarios:** Store a distinct 64-character payload derived from each
  id. Check rows and profiles for disjoint selected pages, predicates
  matching only deleted rows, and file-global deletion positions during
  a 32 KiB split scan. Check COUNT, MIN and MAX on the empty selection.
- **What existing tests miss:** Scanning one retained range does not
  require resuming after a fully rejected page. The previous projection
  could not distinguish payloads from different rows.
- **Fails when broken:** Reviving a deleted row, omitting a live row or
  pairing an id with its neighbour's payload changes the golden result.
  The profile and plan checks require the intended pruning and splits.

### Testing

Regenerated the Spark Delta fixtures on local MinIO and HMS. Ran the
existing basic and Parquet baselines, generated this suite's golden file
with the Doris regression runner, and reran it without -genOut. Both
catalogs passed all 16 expected blocks each. An independent comparison
verified all 9,990 surviving (id, payload) pairs per catalog. Both scan
plans used five splits and the cross-split profiles read two row groups.

### Release note

None

### Check List (For Author)

- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: OpenAI Codex (GPT-6)
- Generated: Codex updated the fixture and regression suite and ran the
  independent checks. The Doris regression runner generated the golden.
- Human review: Pending review of the changes in PR apache#69904.
@xylaaaaa

xylaaaaa commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

chenjunwei added 2 commits November 5, 2026 22:24
### Background

Delta Kernel uses file-level statistics to decide which Parquet files
to schedule. Doris evaluates the original SQL predicates on the rows
of the files that reach BE. A Hive catalog can dispatch Delta tables
to the same Delta scan provider as a dedicated catalog.

### What problem does this PR solve?

Issue Number: apache#69884
Related PR: apache#69904 (introduces the Delta reader)
PR Type: Bugfix

Problem Summary: A two-file Delta table containing 123.45 returned no
rows for CAST(decimal_column AS BIGINT) = 123. Kernel skipped both
files before Doris could evaluate the cast. Let the selected table's
scan provider veto cast predicates while preserving independent
conjuncts for file pruning.

### Details

- **Frequency:** Reproducible with filesystem, dedicated HMS and Hive
  gateway catalogs in synchronous and streaming scans.
- **Root cause:** FE unwraps CastExpr when converting a residual to a
  connector expression. Kernel compared the original decimal with 123.
  The catalog's default accepted the conversion even when its gateway
  routed a table to Delta.
- **Why existing tests missed it:** Widening tests projected casts.
  Skipping tests compared columns directly. Neither used a decimal
  cast in WHERE that changes which files can contain matching rows.
- **Fix:** Consult the selected provider's existing ConnectorPushdownOps
  capability while the original expression still contains its cast.
  Delta declines these predicates for pruning. BE retains the SQL
  predicate and an independent decimal conjunct can still prune.
- **Other paths and branches:** The catalog's existing veto still takes
  precedence. Native Hive, Iceberg and Paimon readers use their existing
  policies. The connector API signatures and version stay the same.
- **Behavior change:** Queries that previously skipped matching rows
  return those rows.

### Testing

Built FE locally with build.sh. All 106 targeted FE tests passed,
including Hive gateway routing, Iceberg, Paimon and JDBC controls.
Reproduced the bug on the old FE and checked 36 queries against the
same Parquet files on the fixed FE. Generated and reran the new
regression on all three catalogs in both planning modes. All 24 golden
blocks matched the fixture. All six mixed-predicate profiles selected
one of two files. The existing basic, skipping and Parquet deletion
vector regressions passed.

### Release note

Delta readers return matching rows when CAST or TRY_CAST changes the
value used in a filter, including when accessed through a Hive catalog.

### Check List (For Author)

- Test: FE unit tests and Delta regression tests, detailed above
- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: OpenAI Codex (GPT-6)
- Generated: Codex investigated the failure, prepared this change
  and its tests, and checked the regression-generated output.
- Human review: Pending.
…catalog

### Background

An HMS catalog can delegate different tables in one statement to the Delta and Iceberg connectors. Its scan nodes share catalog metadata, while Delta's scan provider rejects CAST-bearing file-pruning predicates and Iceberg retains its existing policy.

### What problem does this PR solve?

Issue Number: apache#69884
Related PR: None
PR Type: Test

Problem Summary:
The existing Delta CAST regression tested each catalog entrance separately and did not mix Delta and Iceberg scans in one statement. Add mixed HMS queries and shared-metadata unit coverage so a catalog-wide CAST opt-out or a policy leaking between table scans cannot pass unnoticed.

### Details

- **Scenarios:** UNION ALL and JOIN across Delta and Iceberg tables in one HMS catalog, both table orders, synchronous and streaming scans, and an independent ordinary Delta predicate. The FE test alternates two scan nodes sharing the same metadata instance in both orders.
- **What existing tests miss:** A blanket HMS CAST opt-out returns correct rows for these fixtures but changes Iceberg's file-pruning behavior. Separate-catalog queries do not exercise the shared metadata boundary.
- **Fails when broken:** Pushing the Delta CAST loses the matching 123.45 row. Disabling Iceberg's existing CAST pushdown removes its EXPLAIN predicate and makes the synchronous scan select both files instead of one. The ordinary Delta predicate must still prune one of its two files.

### Testing

- Local run-regression-test.sh: test_deltalake_hms_mixed_cast with -genOut and an ordinary rerun both passed. Independently checked all 14 generated result blocks; the golden SHA-256 stayed unchanged.
- Local run-regression-test.sh: test_deltalake_cast_pruning passed all 24 result blocks and test_deltalake_basic passed all 36 result blocks.
- Local run-fe-ut.sh: 108 tests across PluginDrivenScanNodeCastPredicateTest, Hive routing, Delta, Iceberg, Paimon, JDBC and SPI passed, with no failures, errors or skipped tests.
- Local FE Checkstyle reported zero violations; git diff --check passed.

### Notes for Reviewers

Iceberg fixtures use integral decimal values to test its existing policy without relying on the separately known lossy CAST bug. Iceberg publishes SDK file counters only for synchronous planning; both modes check its EXPLAIN predicate and actual query results. Production code is unchanged in this commit.

### Release note

None

### Check List (For Author)

- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: OpenAI Codex
- Generated: Tests, generated regression output, and this description
- Human review: Pending
@xylaaaaa

xylaaaaa commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

chenjunwei and others added 2 commits November 6, 2026 11:56
### Background

Delta's scan provider rejects CAST-bearing predicates before the shared converter strips their casts. The mixed HMS regression reads Delta and Iceberg tables in one statement, and originally asserted Iceberg's existing CAST pushdown behavior as well as query results.

### What problem does this PR solve?

Issue Number: apache#69884
Related PR: None
PR Type: Test

Problem Summary:
The Delta connector unit tests did not directly guard its scan provider's CAST rejection. Meanwhile, the mixed regression would reject a future Iceberg correctness fix that disables unsafe CAST pushdown. Add a real-provider unit assertion and keep the mixed regression focused on query results and Delta pruning.

### Details

- **Scenarios:** Obtain the real scan provider from the Delta connector and assert that it implements ConnectorPushdownOps and returns false for CAST pushdown. Keep the mixed HMS JOIN, UNION ALL, table-order and synchronous/streaming result checks.
- **What existing tests miss:** Shared FE tests use provider stubs, so removing the real Delta override could pass them. Iceberg's current CAST pushdown policy is not a permanent correctness contract for a Delta regression.
- **Fails when broken:** Removing Delta's interface opt-in or its false-returning override fails the connector unit test. Losing matching rows still fails the mixed golden results. Iceberg can change its own CAST policy without failing assertions about its plan text or selected file count.

### Testing

- run-fe-ut.sh: DeltaLakeScanPlanProviderTest and PluginDrivenScanNodeCastPredicateTest passed all 32 tests, with no failures, errors or skips.
- run-regression-test.sh: test_deltalake_hms_mixed_cast passed an ordinary rerun with all 14 result blocks. Its generated golden file is unchanged.
- Delta connector Checkstyle reported zero violations; git diff --check passed.

### Release note

None

### Check List (For Author)

- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: OpenAI Codex
- Generated: Unit test, regression revisions, and this description
- Human review: Pending
Resolve three conflicts with current master:

- be/src/format_v2/table_reader.cpp: keep master's comment on the existing
  format_common.h include.
- build.sh: keep master's MongoDB packaging step and the connector list that
  includes deltalake.
- docker/thirdparties/docker-compose/iceberg/README.md: keep master's encrypted
  fixture text, followed by the Delta Lake regression section.

Test: No local build. Build hygiene, git diff --check and bash -n build.sh
passed. Compilation and tests are left to CI.
@xylaaaaa

xylaaaaa commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

### Background

Delta chooses synchronous or streaming split planning from the current snapshot's file count. Writers without a current checksum leave that count unknown, so even a two-file table streams and can start far more scanners than the selected file needs.

### What problem does this PR solve?

Issue Number: apache#69884
Related PR: apache#69904 (Delta M1 reader)
PR Type: Performance

Problem Summary:

Reuse complete file counts already available in the statement or in Delta's user/table/version-scoped statistics cache when no current checksum is available. Existing statistics collection counts files, and exhaustive normal scans publish their already-observed total without submitting a statistics task. This lets subsequent small-table queries use synchronous planning while keeping large and unknown tables streaming. Changes are confined to the Delta plugin, its tests, and its README.

### Details

- **Why it was slow:** The streaming scanner path does not cap scanner creation by the actual split count. On the retained two-file fixture, the automatic path started 144 scanners to read one selected file and one row; forced synchronous planning started one.
- **Optimization:** Check the current CRC, then the statement's complete count, then the same user/table identity/version cache entry. The gate never enumerates files, starts statistics work, or waits for storage. A fully consumed scan without partition-pruned replay publishes its total into the entry captured before scanning, so late reports cannot repopulate invalidated entries. Background row-count sessions can have a different identity from SQL sessions, making normal-scan publication necessary without relaxing user isolation.
- **Results:** On local macOS ARM64 with the same ASAN BE and retained data, 16 alternating warm pairs per entrance reduced automatic median latency from 61.614 to 41.420 ms (filesystem), 66.370 to 38.509 ms (HMS), and 57.911 to 32.874 ms (HMS gateway). Scanner counts became one; all returned 123.45. Forced-sync controls were 35.978/41.056, 44.302/37.627, and 32.914/32.370 ms before/after. Million-file metadata enumeration medians were 1493.563/1451.023 ms with a 512 MiB heap; both scale tests passed.
- **Applicability and cost:** Warm snapshots with an already-known complete small file count benefit. Cold unknown counts still stream. Reuse existing cache capacity, TTL, invalidation and executor ownership; add one count, not a file list. These are small local ASAN measurements, not a TPC-DS claim. Sampled scan heap peaks increased from 133327520 to 238172480 bytes while remaining within 512 MiB; actual million-file data IO was not measured.
- **Behavior change:** Small Delta tables may select synchronous split planning after a complete count is available. Row results, public row-count cache behavior, BE scheduling, other connectors, and wire/storage formats are unchanged.

### Testing

- Local `./build.sh --fe -j4`: passed, including Checkstyle. Existing ASAN BE binary and local source configurations were unchanged by SHA-256.
- Official FE UT runner for `DeltaLake*Test,DeltaKernel*Test`: 92 actual tests passed, zero failures/errors; two optional classes skipped in that invocation. Separately enabled `DeltaLakePlanningScaleTest` with the retained million-file checkpoint and `-Xmx512m`: two tests passed. The diagnostic PlanningMetrics class remained disabled.
- Tests cover cached/unknown/current-CRC counts, threshold equality, missing row statistics, user/version/UUID/path isolation, no work submission or IO wait, late invalidated reports, partial and partition-pruned scans, large-file splitting, and large-table streaming after count reuse.
- Official regression runner: basic, statistics, cast_pruning, parquet_deletion_vector, hms_mixed_cast, and planning passed: six suites, 129 result blocks. Existing golden files were unchanged. The planning suite initially targeted the wrong local MinIO; using the retained fixture's endpoint resolved the missing-database error without changing the test or data.
- `git diff --check`: passed.

### Release note

Delta Lake queries can avoid excessive scanner startup for small tables without a checksum once a complete file count is available. Large tables and snapshots with unknown file counts continue to use streaming planning.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes; the Delta connector README documents selection, cache reuse and cold-query limitations. No new user configuration is introduced.
- Pre-submission status: Partially verified: local tests and targeted performance checks passed; full TPC-DS and large-table data IO performance were not rerun.

### AI Disclosure

- Tool: Codex (GPT-6)
- Generated: Implementation, tests, README, local evidence report and this description.
- Human review: Pending.
@xylaaaaa

xylaaaaa commented Nov 6, 2026

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 76.51% (2101/2746)
Line Coverage 65.88% (38770/58848)
Region Coverage 53.62% (36353/67797)
Branch Coverage 57.11% (11851/20750)

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17591	5223	5122	5122
q2	2165	315	254	254
q3	10234	1455	843	843
q4	4686	479	340	340
q5	7438	809	541	541
q6	181	185	152	152
q7	764	812	612	612
q8	9264	1364	1064	1064
q9	5724	4251	4215	4215
q10	6850	1307	1019	1019
q11	435	245	234	234
q12	638	403	283	283
q13	18106	3684	3051	3051
q14	283	266	245	245
q15	q16	730	718	669	669
q17	1210	757	588	588
q18	7141	6216	6124	6124
q19	1111	981	607	607
q20	383	340	226	226
q21	4777	2141	2310	2141
q22	346	295	261	261
Total cold run time: 100057 ms
Total hot run time: 28591 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5644	5618	5622	5618
q2	700	570	562	562
q3	5190	5445	4971	4971
q4	2011	2177	1531	1531
q5	5304	5127	5867	5127
q6	253	198	149	149
q7	2379	2088	1922	1922
q8	3166	2946	2723	2723
q9	8208	8035	8117	8035
q10	3773	3670	3278	3278
q11	677	459	399	399
q12	703	722	511	511
q13	3489	4073	3235	3235
q14	323	301	296	296
q15	q16	708	717	661	661
q17	8439	7728	7143	7143
q18	12962	12136	12963	12136
q19	921	776	808	776
q20	2142	2151	1969	1969
q21	5869	4822	4887	4822
q22	507	456	399	399
Total cold run time: 73368 ms
Total hot run time: 66263 ms

@hello-stephen

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

query5	4313	528	411	411
query6	437	214	206	206
query7	4821	442	233	233
query8	327	175	158	158
query9	8802	3295	3273	3273
query10	486	320	260	260
query11	6032	3872	3578	3578
query12	152	91	94	91
query13	1286	447	337	337
query14	6142	3961	3679	3679
query14_1	3471	3410	3450	3410
query15	207	205	184	184
query16	945	425	413	413
query17	852	662	537	537
query18	2418	424	315	315
query19	199	169	145	145
query20	88	85	87	85
query21	213	124	110	110
query22	13029	13342	12808	12808
query23	13411	12894	12338	12338
query23_1	12620	12550	12686	12550
query24	7366	826	475	475
query24_1	493	485	490	485
query25	533	431	373	373
query26	1248	265	142	142
query27	2768	449	280	280
query28	4633	2065	2050	2050
query29	1546	614	473	473
query30	302	237	189	189
query31	1008	940	836	836
query32	149	99	97	97
query33	538	300	244	244
query34	900	852	504	504
query35	735	752	645	645
query36	818	801	734	734
query37	127	100	88	88
query38	1767	1713	1647	1647
query39	811	789	756	756
query39_1	740	728	724	724
query40	224	117	102	102
query41	74	69	66	66
query42	93	95	88	88
query43	341	376	313	313
query44	1352	722	746	722
query45	182	176	179	176
query46	836	964	564	564
query47	2744	2880	2629	2629
query48	308	310	228	228
query49	578	415	286	286
query50	674	306	214	214
query51	10522	10657	10543	10543
query52	87	79	72	72
query53	187	214	161	161
query54	232	192	187	187
query55	77	70	62	62
query56	229	220	212	212
query57	1667	1656	1549	1549
query58	288	266	267	266
query59	2135	2173	1972	1972
query60	296	250	236	236
query61	156	147	172	147
query62	388	333	281	281
query63	187	168	159	159
query64	2766	940	864	864
query65	3358	3274	3270	3270
query66	1746	428	302	302
query67	22726	22653	22581	22581
query68	3069	1015	625	625
query69	400	301	302	301
query70	841	778	760	760
query71	303	234	212	212
query72	2739	2663	2330	2330
query73	513	528	300	300
query74	4593	4529	4396	4396
query75	2359	2296	1947	1947
query76	2321	1032	629	629
query77	355	368	274	274
query78	9968	9764	9168	9168
query79	2104	865	551	551
query80	1505	430	353	353
query81	590	318	275	275
query82	588	135	107	107
query83	317	198	184	184
query84	308	120	99	99
query85	854	429	387	387
query86	378	241	231	231
query87	2002	1956	1825	1825
query88	3860	2798	2768	2768
query89	327	290	252	252
query90	1903	178	169	169
query91	157	153	136	136
query92	102	91	94	91
query93	1133	1017	593	593
query94	581	272	266	266
query95	571	401	302	302
query96	684	489	241	241
query97	2493	2483	2341	2341
query98	159	156	146	146
query99	783	762	658	658
Total cold run time: 239864 ms
Total hot run time: 154395 ms

@hello-stephen

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

query1	0.01	0.01	0.01
query2	0.09	0.05	0.05
query3	0.26	0.09	0.09
query4	1.61	0.10	0.10
query5	0.25	0.24	0.24
query6	1.17	0.68	0.68
query7	0.04	0.01	0.00
query8	0.06	0.04	0.04
query9	0.39	0.35	0.36
query10	0.57	0.57	0.58
query11	0.19	0.16	0.15
query12	0.19	0.16	0.15
query13	0.48	0.49	0.48
query14	1.04	1.01	0.99
query15	0.62	0.60	0.60
query16	0.35	0.34	0.36
query17	1.15	1.15	1.18
query18	0.21	0.18	0.19
query19	2.08	2.01	1.93
query20	0.02	0.02	0.01
query21	15.47	0.20	0.13
query22	4.90	0.05	0.05
query23	16.29	0.31	0.11
query24	1.05	0.23	0.17
query25	0.10	0.04	0.04
query26	0.75	0.21	0.14
query27	0.02	0.03	0.04
query28	3.69	0.79	0.36
query29	12.48	4.12	3.17
query30	0.28	0.14	0.10
query31	2.78	0.55	0.33
query32	3.23	0.59	0.50
query33	3.17	3.19	3.20
query34	15.30	4.03	3.39
query35	3.32	3.35	3.34
query36	0.57	0.45	0.42
query37	0.08	0.06	0.07
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.16	0.14	0.14
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 94.67 s
Total hot run time: 23.94 s

### Background

Delta fixes a snapshot for each statement, then enumerates its active files to
plan native Parquet ranges. Repeated scans currently reopen the same checkpoint
and reconstruct the same ranges. Other connectors already use the existing
statement planning scope and external scan task reuse session flag.

### What problem does this PR solve?

Issue Number: apache#69884
Related PR: apache#69904 (Delta M1 implementation)
PR Type: Performance

Problem Summary:

Repeated identical synchronous Delta scans redo checkpoint IO and planning.
Reuse completed immutable ranges and metrics within the existing planning scope,
with typed request keys, bounded retention and cancellable single-flight loading.
The change applies to dedicated Delta and HMS gateway reads. Production changes
are confined to the Delta plugin; most added lines are tests and generated output.

### Details

- **Change map:** Four production Java files (269 added / 50 removed lines), five test files (549 added / 4 removed), 244 generated expected-output lines and 33 README lines. The new memo owns keys, admission and concurrency; the existing scan body is extracted without changing its pruning semantics. Provider/scale tests and a three-route SQL suite cover reuse and bypass.
- **Why it was slow:** Each scan independently enumerated the pinned snapshot, including repeated checkpoint range GETs, decode and range construction.
- **Optimization:** Use the existing enable_external_scan_task_reuse flag and planning-only statement scope. Key by catalog/query/user, table coordinates/UUID/version, typed filter, partition selection, COUNT, split size and time zone. Coalesce identical loads outside scope/memo locks; publish only completed results and per-node metrics. Retry failed/cancelled loads; let waiters cancel independently. Retain at most 128 entries, 16,384 ranges and 16 MiB estimated range payload; oversized synchronous results are returned without retention. Streaming never enters the memo.
- **Results:** Same-build alternating local ASAN/SF1 A/B: Q88 EXPLAIN 323.616 to 152.279 ms and execution 2268.353 to 2050.009 ms (-9.6%); Q80 EXPLAIN -23.9%, execution -1.9%; Q4 EXPLAIN -49.4%, execution essentially flat; Q22 has no hits and execution is flat (+0.5%). Three independent traces each show checkpoint GETs 160 to 55 / 90 to 60 / 90 to 30 for Q88/Q80/Q4; Q22 stays at 15. A million-file streaming fixture remains bounded in a 512 MiB JVM: enumeration median 1493.940 to 1484.218 ms. Sampled heap peak 112.921 to 125.744 MB is recorded, not claimed unchanged.
- **Applicability and cost:** Helps identical synchronous scans within one statement. Does not share content across statements or change large-table streaming. The byte budget covers retained range payload, not whole-query or in-flight heap. Query results and FE/BE wire formats are unchanged; all four targeted queries match Hive reference results. This is not a full TPC-DS or RELEASE measurement.
- **Behavior change:** Repeated Delta plans may share immutable ranges until planning ends when the existing flag is enabled. PlanningReuseHit identifies each reuse. Disable the session flag to bypass the memo. Shared FE/SPI/BE and other connectors are unchanged.

### Testing

Local macOS ARM64:
- build.sh --fe -j4: full FE build and Checkstyle passed; final test-only refinements also passed reactor validate/Checkstyle.
- run-fe-ut.sh --run 'DeltaLake*Test,DeltaKernel*Test', with follow-up memo/provider and opt-in scale runs: 102 distinct executed tests passed; the optional PlanningMetrics diagnostic class was not run.
- Official regression runner: test_deltalake_basic (36 blocks), test_deltalake_scan_reuse (27), test_deltalake_parquet_deletion_vector (32), test_deltalake_hms_mixed_cast (14), all passed. The new .out was script-generated, independently audited, then compared without -genOut; existing .out files are unchanged.
- Retained-data A/B: 10 alternating EXPLAIN pairs and 7 execution pairs per query, after three warmups per flag and readiness of all 24 table counts. All 88 Delta executions (including warmups/profiles) matched four Hive references. Separate three-sample storage traces verified requests and bytes.
- Million-file streaming before/after: independent 512 MiB JVMs, three complete enumerations each, with FE/BE/Docker stopped for the matched comparison.
- All 96 retained TPC-DS objects matched path/size/SHA-256 before and after. Temporary services were stopped and fixtures/volumes retained.

### Release note

Repeated identical Delta Lake scans within one statement can plan faster,
including Delta tables queried through an HMS catalog. The optimization uses
the existing external scan task reuse setting and preserves streaming for large tables.

### Check List (For Author)

- Behavior changed: Yes (see Details)
- Does this need documentation: Yes; the connector README and local design/tasklist are updated. The broader Delta website documentation remains tracked by apache#69884.
- Pre-submission status: Partially verified: local build, relevant tests and targeted ASAN measurements passed; Linux CI, RELEASE and a full TPC-DS rerun are not claimed for this commit.

### AI Disclosure

- Tool: Codex
- Generated: Implementation, tests, documentation and this description.
- Human review: Pending review of this change.
@xylaaaaa

xylaaaaa commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@xylaaaaa

xylaaaaa commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@xylaaaaa xylaaaaa changed the title [feature](fe) Add native Delta Lake M1 reader [feature](external) Support reading Delta Lake tables natively with Delta Kernel Nov 10, 2026
Master added `16: optional TMongoScanDesc mongodb_params` to
TTableFormatFileDesc (apache#70327), so `deltalake_params` moves to field 17.
Field 17 is unused on master, branch-4.2, branch-4.1, branch-4.0 and
branch-3.1. Generated code accesses the field by name, so no Java or C++
code changes. build.sh keeps master's mongodb plugin entries and adds
deltalake to both connector lists.
@xylaaaaa

Copy link
Copy Markdown
Contributor Author

run buildall

### Background

The Delta reader can stream file enumeration. While enumeration is in progress, EXPLAIN can show a file-count estimate for scan scheduling. The completed query profile records the selected files and generated splits.

### What problem does this PR solve?

Issue Number: apache#69884
Related PR: apache#69904 (Delta reader)
PR Type: Test

Problem Summary: The basic partition-pruning and Parquet deletion-vector regressions treated the streaming EXPLAIN estimate as the final split count. Read the counters from the completed profile of the query whose rows are checked.

### Details

- **Failure:** With the default streaming threshold of 1, the estimate for the basic query was 3 when one split was generated. For the DV byte-range scan the estimate was 1 when five splits were generated.
- **Cause:** Split scheduling uses a file-count hint before enumeration, including when one file generates multiple ranges.
- **Stability evidence:** The basic check retains the partition fraction. The DV check retains the deletion-vector, row group, page-pruning, payload and row checks. Each scan is located by its unique SQL token and waits for complete Delta enumeration.

### Testing

- Built the PR1 FE and regression framework and ran the existing golden outputs for test_deltalake_basic and test_deltalake_parquet_deletion_vector on local ASAN Doris, Hive Metastore and MinIO.
- Both suites passed with default batch scheduling and threshold 1, and passed again with only session batch scheduling disabled.
- Filesystem and HMS each reported one selected file for both queries, one generated split for the filtered basic query and five for the DV cross-split query.

### Release note

None

### Check List (For Author)

- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: OpenAI Codex (GPT-6)
- Generated: Test changes and commit description
- Human review: Pending
xylaaaaa pushed a commit to xylaaaaa/doris that referenced this pull request Nov 12, 2026
### Background

Apache Doris PR apache#69904 adds the Delta Lake reader for the latest table state. Delta records each committed change as a numbered version of its transaction log. Reading an older version requires using that version for column binding, file selection and deletion vectors.

### What problem does this PR solve?

Issue Number: apache#69884  
Related PR: apache#69904 (required base, merge first)  
PR Type: Feature

Problem Summary: Allow an ordinary Delta table reference to select a numeric version using `FOR VERSION AS OF`. This is a stacked draft based on `8ba8e67f29` from apache#69904. GitHub's Files changed tab includes the base PR until it merges. [Review only the changes for version reads](8ba8e67...codex/delta-version-as-of).

### Details

- **Change map:** The Delta FE connector accounts for 65 added and 8 removed production lines. Unit tests and fixtures add 136 lines and remove 2. The Spark comparison adds 172 test lines and the framework generated 91 output lines.
- **Scope:** Numeric versions, including zero, through Delta filesystem, Delta HMS and the HMS gateway.
- **Design:** Load the requested Kernel snapshot, verify the target table UUID and reader features, and retain its schema. Reuse the checked handle for that table and version within the query. The file scan, projected columns and exact COUNT operate on the same version.
- **Usage:** `SELECT * FROM catalog.db.t FOR VERSION AS OF 3`.
- **Default behavior:** Ordinary reads continue to use the latest snapshot and the configured latest cache.
- **Compatibility:** The table's current protocol must be readable when opening its handle. An unavailable log version fails explicitly. Timestamp selection and the history system table remain open in apache#69884. The HMS gateway still uses its existing statistics delegation for CBO estimates. Kernel reads a version while its required log and data files are available. Spark Delta 4.4.1 adds a separate, default-on age guard based on deleted-file retention, which can reject readable data. [Spark implementation](https://github.com/delta-io/delta/blob/v4.4.1/spark/src/main/scala/org/apache/spark/sql/delta/SnapshotManagement.scala#L1656-L1689)

### Testing

- Full local macOS arm64 ASAN build with `FE_MAVEN_THREADS=4 ./build.sh --fe --be -j10`. Started the resulting FE and BE and verified a distributed query.
- `bash run-fe-ut.sh --run 'DeltaLake*Test,DeltaKernel*Test'` passed. The Delta connector and Delta metastore report 106 tests executed with zero failures, including all six new history tests. Two opt-in diagnostics were skipped.
- Generated the golden output for `test_deltalake_version_as_of` via `run-regression-test.sh` and reran the unchanged suite without `-genOut`. Both runs passed with Spark 4.0.0, Delta 4.4.1, Hive Metastore and MinIO. All three catalog routes matched Spark on historical columns, types, ordered rows, counts, column mapping by name/ID, a physical deletion vector and multi-version joins. The new test exercises synchronous and streaming scheduling with the existing default threshold of 1.
- The existing `test_deltalake_hive` passed. After rebasing on the split-profile test fix from apache#69904, reran `test_deltalake_basic`, `test_deltalake_parquet_deletion_vector` and `test_deltalake_version_as_of` with default streaming scheduling and `num_files_in_batch_mode=1`. All three passed against their existing golden outputs.

### Release note

Delta Lake tables can be queried at a numeric version with `FOR VERSION AS OF`, including the schema and deletion vectors recorded at that version.

### Check List (For Author)

- Behavior changed: Yes (see Details).
- Does this need documentation: Yes, to accompany the Delta reader website documentation tracked in apache#69884.
- Pre-submission status: Locally verified. Draft pending apache#69904.

### AI Disclosure

- Tool: OpenAI Codex (GPT-6).
- Generated: Implementation, tests and PR description with AI assistance.
- Human review: Pending.
@xylaaaaa

Copy link
Copy Markdown
Contributor Author

run buildall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants