Skip to content

[fix](be) Fix ORC condition-cache seeks past filtered stripe suffixes - #70079

Merged
Gabriel39 merged 2 commits into
apache:masterfrom
Gabriel39:fix/orc-condition-cache-seek
Nov 4, 2026
Merged

Gabriel39 merged 2 commits into
apache:masterfrom
Gabriel39:fix/orc-condition-cache-seek

Conversation

@Gabriel39

@Gabriel39 Gabriel39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Related PR: apache/doris-thirdparty#431 (merge the ORC dependency fix first)

A condition-cache granule can start in a stripe's SARG-filtered suffix while containing a matching row in the next stripe. On an initialized stripe, ORC's seekToRow() uses the stripe-end sentinel as a row-group index. This can access past the index when the stripe ends on an index boundary, or prematurely return EOF when the last row group is partial.

The same-stripe fast path originates in Apache ORC ORC-1170; the same missing stripe-end handling remains in the current upstream C++ reader.

Pin the ORC fix that initializes the next selected stripe before positioning its column readers. Preserve SARG pruning, lazy reads and split boundaries.

Add a Doris reader regression and a 1.5 KB synthetic ORC fixture with its generator. The fixture has two 20,000-row stripes, a 10,000-row index stride, and one matching row at the start of each stripe. A cache hit seeks to row 18,432 in the first stripe's filtered suffix. The SQL regression compares cache-disabled and cached results with lazy reads and min/max pruning enabled or disabled, and checks the profile for actual cache hits and skipped rows.

Release note

Fix potential crashes and missing rows when ORC condition-cache seeks reach a SARG-filtered stripe suffix.

Check List (For Author)

  • Test:
    • Unit Test: 247 ORC-related BE tests passed under AddressSanitizer, including the new Doris condition-cache case and 32 dependency boundary cases.
    • Unit Test: 56 focused standalone ORC tests passed under AddressSanitizer. Reverting the fix makes all 16 initialized-stripe boundary cases fail.
    • Regression test: SQL suite added; Groovy compilation checked. The external SQL suite has not been executed locally.
    • clang-format 16 and BE build-hygiene checks passed.
    • Local full-file clang-tidy analysis did not complete within ten minutes; no completed result is available.
  • Behavior changed:
    • Yes. Safely advance to the next matching stripe or EOF.
  • Does this need documentation?
    • No.

### What problem does this PR solve?

Related PR: apache/doris-thirdparty#431

Problem Summary: A condition-cache granule can start inside a stripe's
SARG-filtered suffix while containing matching rows in the next stripe.
ORC seekToRow treated the stripe-end sentinel as a valid row-group index,
causing an out-of-bounds index access or premature EOF.

Pin the ORC fix that initializes the next selected stripe before positioning
column readers. Add a Doris reader regression, a synthetic two-stripe ORC
fixture with its generator, and a SQL regression covering cache hits with
lazy reads and min/max pruning enabled or disabled.

### Release note

Fix potential crashes and missing rows when ORC condition-cache seeks reach
a SARG-filtered stripe suffix.

### Check List (For Author)

- Test: 247 ORC-related BE unit tests passed under AddressSanitizer; 56
  focused standalone ORC tests passed. SQL regression added and Groovy
  compilation checked; external SQL suite has not been executed locally.
- Behavior changed: Yes, safely advance to matching rows or EOF.
- Does this need documentation: No.
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

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

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

@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 77.76% (35943/46221)
Line Coverage 63.13% (404591/640838)
Region Coverage 59.78% (342801/573464)
Branch Coverage 60.89% (158693/260642)

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17622	5123	5039	5039
q2	2098	341	247	247
q3	10248	1452	798	798
q4	4686	478	337	337
q5	7437	805	531	531
q6	176	179	151	151
q7	744	791	604	604
q8	9259	1460	1066	1066
q9	5471	4212	4184	4184
q10	6815	1276	1018	1018
q11	438	247	232	232
q12	646	396	277	277
q13	18109	3601	3053	3053
q14	274	273	248	248
q15	q16	718	724	681	681
q17	1203	761	591	591
q18	6931	6166	6098	6098
q19	1125	957	581	581
q20	397	343	226	226
q21	6003	2530	2409	2409
q22	388	330	281	281
Total cold run time: 100788 ms
Total hot run time: 28652 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5939	5949	6146	5949
q2	715	606	598	598
q3	5645	5816	5210	5210
q4	2063	2163	1563	1563
q5	5744	5868	5592	5592
q6	245	193	146	146
q7	2245	1998	1767	1767
q8	2957	2620	2625	2620
q9	7949	7609	7441	7441
q10	3635	3569	3143	3143
q11	580	412	392	392
q12	652	674	508	508
q13	3278	3587	3062	3062
q14	290	289	262	262
q15	q16	693	667	613	613
q17	7730	7063	6834	6834
q18	13035	12124	12938	12124
q19	906	831	759	759
q20	2133	2121	1935	1935
q21	5717	4592	4629	4592
q22	512	438	404	404
Total cold run time: 72663 ms
Total hot run time: 65514 ms

@hello-stephen

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

query5	4324	608	458	458
query6	424	218	191	191
query7	4825	449	240	240
query8	316	173	156	156
query9	8803	3205	3212	3205
query10	479	313	254	254
query11	5843	3877	3578	3578
query12	144	93	90	90
query13	1247	460	336	336
query14	6156	3925	3676	3676
query14_1	3402	3360	3447	3360
query15	204	200	184	184
query16	964	426	401	401
query17	838	635	512	512
query18	2410	411	305	305
query19	194	156	131	131
query20	85	85	81	81
query21	206	138	112	112
query22	13026	12934	12717	12717
query23	13452	12879	12380	12380
query23_1	12520	12572	12427	12427
query24	7373	854	480	480
query24_1	479	483	471	471
query25	514	395	341	341
query26	1258	251	136	136
query27	2790	435	270	270
query28	4657	2040	2075	2040
query29	1563	581	439	439
query30	284	217	186	186
query31	996	926	808	808
query32	136	89	89	89
query33	523	296	247	247
query34	914	867	506	506
query35	732	764	649	649
query36	804	844	747	747
query37	125	102	86	86
query38	1782	1728	1690	1690
query39	793	813	752	752
query39_1	731	740	751	740
query40	227	121	98	98
query41	74	70	70	70
query42	90	85	86	85
query43	351	367	312	312
query44	1370	719	722	719
query45	184	184	171	171
query46	876	990	594	594
query47	2876	2981	2803	2803
query48	332	323	229	229
query49	579	397	296	296
query50	704	295	222	222
query51	10305	10297	10285	10285
query52	82	81	75	75
query53	194	218	157	157
query54	240	200	208	200
query55	76	67	69	67
query56	263	228	235	228
query57	1639	1604	1597	1597
query58	300	274	260	260
query59	2148	2125	1991	1991
query60	302	258	241	241
query61	173	170	167	167
query62	398	340	287	287
query63	202	186	172	172
query64	2880	1117	757	757
query65	3331	3288	3242	3242
query66	1770	432	313	313
query67	20386	20094	20120	20094
query68	3011	1046	618	618
query69	389	287	250	250
query70	858	781	744	744
query71	305	230	211	211
query72	2700	2585	2319	2319
query73	545	548	303	303
query74	4589	4495	4361	4361
query75	2338	2304	1919	1919
query76	2326	1037	641	641
query77	347	376	296	296
query78	9748	9648	9152	9152
query79	1017	875	533	533
query80	1210	429	337	337
query81	601	331	264	264
query82	618	137	105	105
query83	306	200	189	189
query84	317	122	101	101
query85	856	425	365	365
query86	403	240	234	234
query87	2024	1947	1825	1825
query88	3865	2783	2771	2771
query89	328	292	242	242
query90	1934	174	177	174
query91	165	153	124	124
query92	104	81	94	81
query93	1071	1026	587	587
query94	629	321	296	296
query95	591	397	304	304
query96	681	503	236	236
query97	2464	2419	2301	2301
query98	167	155	144	144
query99	764	767	649	649
Total cold run time: 235691 ms
Total hot run time: 151278 ms

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.10	0.05	0.04
query3	0.27	0.10	0.09
query4	1.61	0.10	0.11
query5	0.24	0.26	0.24
query6	1.18	0.68	0.69
query7	0.04	0.01	0.01
query8	0.06	0.04	0.03
query9	0.39	0.34	0.33
query10	0.58	0.57	0.57
query11	0.21	0.14	0.15
query12	0.18	0.16	0.14
query13	0.49	0.48	0.49
query14	1.02	1.00	1.01
query15	0.65	0.61	0.62
query16	0.34	0.36	0.35
query17	1.17	1.16	1.16
query18	0.20	0.19	0.18
query19	2.11	2.01	2.00
query20	0.01	0.01	0.01
query21	15.49	0.21	0.13
query22	4.71	0.06	0.05
query23	16.28	0.32	0.12
query24	3.00	0.43	0.30
query25	0.11	0.07	0.05
query26	0.85	0.22	0.14
query27	0.04	0.04	0.04
query28	3.01	0.74	0.36
query29	12.52	4.07	3.24
query30	0.29	0.14	0.09
query31	2.77	0.56	0.33
query32	3.23	0.59	0.50
query33	3.14	3.18	3.20
query34	15.45	4.01	3.38
query35	3.33	3.38	3.34
query36	0.55	0.46	0.44
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.15	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: 96.14 s
Total hot run time: 24.21 s

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

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

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

@morningman

Copy link
Copy Markdown
Contributor

Title: fix Fix condition-cache seeks past SARG-filtered stripe suffixes

Background

With the condition cache (enable_condition_cache, on by default), Doris records which 2048-row granules of a file may hold rows that match a filter, and a later scan with the same filter skips the other granules (condition cache). The format-v2 ORC reader skips them by calling the ORC library's seekToRow. An ORC file consists of stripes, each split into row groups of rowIndexStride rows (10,000 by default) with min/max statistics, which the search argument (SARG) uses to skip row groups that cannot match.

What problem does this PR solve?

Issue Number: None
Related PR: apache/doris-thirdparty#431 (the ORC fix this PR pins; merged), #60897 (condition cache for external tables, which first seeks ORC readers to cached granules), #65183 (format-v2 ORC reader, whose condition-cache seek triggers the bug), #67141 (earlier fix to the same seek), #69591 (disabled the LOCAL TVF, which turned off the existing ORC condition-cache suite), #68593 (Doris side of the ORC libdeflate commits that a 4.x pick also brings in)
PR Type: Bugfix

Problem Summary:

A condition-cache hit on an ORC file can crash the BE or silently drop rows. The granule it seeks to can start in row groups at the end of a stripe that the SARG skipped, while its matching row sits in the next stripe, and ORC's seekToRow then uses the stripe end as a row-group index. The condition cache is on by default, so repeating a filter on such a file is enough. The fix is in the ORC library (apache/doris-thirdparty#431): seekToRow now starts the next selected stripe, as a fresh seek does. This PR moves contrib/apache-orc to that fix; the rest of the diff is tests.

Details

Testing

  • New BE unit test NewOrcReaderTest.ConditionCacheHitSeeksPastSargFilteredStripeSuffix: a cache hit on granules 0 and 9 of the fixture, with lazy reads and min/max filtering each on and off, returns both matching rows with their payloads and skips rows by seeking. Passed in this PR's BE UT run at 79b0eb0d7ba; the author reports 247 ORC-related BE tests passing under AddressSanitizer. TODO(author): whether it fails with the old ORC commit, and how.
  • New regression suite external_table_p0/tvf/test_orc_condition_cache_seek.groovy: the same four combinations through the S3 TVF on the fixture uploaded to the test object store, with and without the cache, requiring the two expected rows and non-zero ConditionCacheHit and ConditionCacheFilteredRows. Passed in this PR's External Regression run at 79b0eb0d7ba; the author did not run it locally.
  • Add RowsetMeta Manager #431 adds 32 ORC seek tests for both stripe endings; the author reports that the 16 on an initialized stripe fail on the original reader, that all 32 pass with the fix, and that 56 focused ORC tests pass under AddressSanitizer.

Notes for Reviewers

Release note

Fix BE crashes and missing rows in repeated ORC queries with the condition cache on (the default), when a cached range started inside the skipped end of a stripe.

Check List (For Author)

  • Behavior changed: No
  • Does this need documentation: No
  • Pre-submission status: Partially verified: the new BE test and regression suite have not been shown to fail with the old ORC commit

AI Disclosure

  • Tool: Claude Code (Claude Opus 5.5) for this description; not stated for the code
  • Generated: this description; whether the code was generated is not stated
  • Human review: not stated

morningman
morningman previously approved these changes Nov 4, 2026
@Gabriel39

Copy link
Copy Markdown
Contributor Author

Local pipeline review — ✅ PASS

schema: doris-repo-review/v1
status: PASS
pr: apache/doris#70079
commit: 79b0eb0d7ba93ca9a2801b47a2ed68d59a6a2a11
base: c8a75b273e999370e354ed39ae65db2c483c0ad0
reviewed_at: 2026-11-04T10:17+08:00
reviewer: Gabriel39
model: gpt-6-astra
effort: xhigh
findings: {blocker: 0, major: 0, minor: 1, nit: 0}
rounds: 1
converged: true

Notes for maintainers

  • F-01 (test-coverage, Regression: yes, Minor) regression-test/suites/external_table_p0/tvf/test_orc_condition_cache_seek.groovy:66: the new N+1 scan limit can falsely fail a correct reader when a full condition-cache shard needs two LRU-K admission misses before a hit. With one backend, scans 1 and 2 miss and scan 3 hits; allow two admission visits per backend (2*N+1 with stable cache contents). This affects test reliability, with no demonstrated production correctness regression.
  • The ORC pin's exact/partial stripe-suffix transition, split bounds, EOF and lazy follower state were reviewed against the previous pin. All five changed files were covered. This was a static review; builds, BE/ORC/SQL tests and benchmarks were not executed.

Reviewed locally with the doris-repo-review pipeline. Repository policy may accept this receipt for the matching commit; it is not a human Apache approval.

### What problem does this PR solve?

Related PR: apache#70079

Problem Summary: A full condition-cache shard first records a new key in
LRU-K ghost history and admits it after the second scan. The old backend
count plus one retry bound can fail before any backend receives a third
scan. Allow twice the backend count plus one attempts, retaining early
exit on a cache hit, and document the admission requirement.

### Release note

None

### Check List (For Author)

- Test: Groovy 4.0.19 syntax conversion and git diff --check passed;
  reviewed the LRU-K insertion and reader-finalization paths. The full SQL
  regression was not run locally because no built test cluster is available.
- Behavior changed: No production behavior changes; regression warmup only.
- Does this need documentation: No
@Gabriel39

Copy link
Copy Markdown
Contributor Author

run buildall

@Gabriel39

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Static review of PR #70079 at 176aa32d4717a008166804a0fd5ed52d652a13dc: no actionable new defect found. All five changed paths and the complete pinned ORC dependency delta were reviewed. There are no existing inline findings to retain and no additional user focus points were supplied.

The ORC change recognizes the filtered-suffix stripe-end sentinel before row-index positioning, initializes the next selected stripe, and returns at the configured range end. Static tracing supports correct file-global row positions and aligned predicate/payload columns for eager and lazy reads.

Critical checkpoint Conclusion
Goal and supporting tests The fix addresses the stated invalid-index/premature-EOF path. The BE regression exercises granules 0/9 and seek row 18432 with lazy reads and min/max pruning independently toggled.
Scope and reuse Focused dependency update plus tests, fixture and generator; existing stripe initialization and reader helpers are reused.
Concurrency and locking No new threads, shared production state, locks or lock-order changes; reader state remains per RowReader.
Lifecycle and static initialization Transition releases old column readers and clears index, bloom and follower state; scoped test resources and callbacks have appropriate lifetimes. No new static initialization dependency.
Configuration No configuration added. Tests set existing session/query options and restore SQL settings in finally.
Compatibility No storage format, public API or wire change. The dependency prerequisite is merged. No new glibc-facing call is introduced; release ELF compatibility was not audited in this static review.
Thrift/protobuf IDs No gensrc definition changes.
Parallel and special paths Inspected initialized/fresh and backward seeks, exact/partial final groups, skipped intermediate stripes, split limits, EOF, and lazy follower positioning including a nonzero first selected group.
Conditional checks The new sentinel branch has a concrete failure example and precedes index access; it reuses the existing bounded stripe-selection path.
Functional and negative coverage Inspected the four-way BE/SQL option matrix and 32 dependency cases covering initialization, exact/partial groups, stripe count, range restriction and lazy/eager reads, plus EOF and backward-seek assertions.
Expected results Independently parsed fixture metadata: 1458 bytes, 40000 rows, two 20000-row stripes, stride 10000. IDs/payloads agree with the generator and ordered SQL expectations. The two-SQL quickTest overload needs no golden .out file.
Observability Tests require actual seek/skipped-row evidence; SQL profiles must show positive ConditionCacheHit and ConditionCacheFilteredRows. Existing reader counters remain in use.
Transactions and persistence No production commit, EditLog, replay, failover or persistent-write path changes; version and delete-bitmap invariants are unaffected.
Data writes and crash behavior Production change is read-only; exception/cancellation conversion remains in the existing Doris seek/next boundary. No new production write atomicity requirement.
FE-BE variables No variables added or newly transmitted. Existing lazy/min/max options reach the reader.
Performance and memory No new per-row work or allocation; pruning and lazy reads are retained. Stripe initialization frees the old reader before rebuilding; test allocations are bounded. No performance measurements were executed.
Additional checks UUID profile markers do not enter predicate cache digests; EOF gates cache publication. Fixture discovery, S3/Azure upload/cleanup, result comparison and settings restoration follow the existing harness.

Review converged after two rounds, including final independent review of the frozen payload. All risk questions and candidates are resolved with evidence; no source scope remains unreviewed.

Validation limits: this invocation performed static inspection only. No builds, tests, generator execution, benchmarks, external SQL/S3/Azure runs, submodule initialization or source edits were performed. The author's reported test passes were not independently reproduced. The next stripe starting at a nonzero selected group was checked by control-flow analysis rather than a newly executed case.

Review converged after 2 round(s).

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17593	5098	5020	5020
q2	2163	311	245	245
q3	10252	1407	811	811
q4	4682	463	352	352
q5	7434	794	535	535
q6	189	184	150	150
q7	744	801	582	582
q8	9263	1336	1089	1089
q9	5479	4186	4168	4168
q10	6813	1295	1014	1014
q11	436	250	222	222
q12	631	399	275	275
q13	18115	3645	3018	3018
q14	278	277	245	245
q15	q16	742	712	647	647
q17	1220	753	574	574
q18	7035	6172	6140	6140
q19	1109	948	576	576
q20	390	337	228	228
q21	5498	2499	2394	2394
q22	385	337	270	270
Total cold run time: 100451 ms
Total hot run time: 28555 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5965	5939	6037	5939
q2	746	601	578	578
q3	5718	5817	5328	5328
q4	2006	2192	1622	1622
q5	5780	5833	5627	5627
q6	247	194	153	153
q7	2180	2126	1814	1814
q8	2946	2595	2635	2595
q9	7918	7565	7483	7483
q10	3648	3555	3119	3119
q11	578	423	377	377
q12	665	669	505	505
q13	3209	3574	3033	3033
q14	285	291	263	263
q15	q16	671	673	611	611
q17	7748	6990	6832	6832
q18	12959	12254	12948	12254
q19	882	758	760	758
q20	2131	2143	1903	1903
q21	5624	4547	4682	4547
q22	510	441	406	406
Total cold run time: 72416 ms
Total hot run time: 65747 ms

@hello-stephen

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

query5	4304	589	461	461
query6	418	215	202	202
query7	4799	479	227	227
query8	325	168	153	153
query9	8795	3162	3179	3162
query10	480	307	263	263
query11	5987	3858	3558	3558
query12	146	103	87	87
query13	1246	439	351	351
query14	6181	3896	3654	3654
query14_1	3413	3452	3420	3420
query15	214	205	184	184
query16	946	426	412	412
query17	850	660	543	543
query18	2446	410	302	302
query19	188	151	127	127
query20	83	82	79	79
query21	207	127	105	105
query22	12935	12884	12734	12734
query23	13416	12789	12440	12440
query23_1	12520	12469	12461	12461
query24	7355	808	466	466
query24_1	466	468	474	468
query25	515	401	338	338
query26	1251	251	139	139
query27	2763	435	274	274
query28	4621	2016	2025	2016
query29	1545	587	427	427
query30	301	222	181	181
query31	1013	922	810	810
query32	145	94	92	92
query33	505	297	220	220
query34	902	888	491	491
query35	727	735	637	637
query36	791	809	716	716
query37	124	90	77	77
query38	1785	1735	1659	1659
query39	781	777	741	741
query39_1	737	721	733	721
query40	215	111	96	96
query41	68	64	63	63
query42	88	81	80	80
query43	340	364	308	308
query44	1313	705	706	705
query45	178	178	164	164
query46	821	966	565	565
query47	2943	2775	2904	2775
query48	304	308	220	220
query49	584	418	310	310
query50	673	282	215	215
query51	10680	10577	10585	10577
query52	89	79	74	74
query53	203	216	161	161
query54	283	188	203	188
query55	67	72	61	61
query56	224	237	198	198
query57	1624	1590	1557	1557
query58	288	258	267	258
query59	2171	2192	1994	1994
query60	282	239	224	224
query61	152	149	149	149
query62	392	325	283	283
query63	187	164	161	161
query64	2752	990	760	760
query65	3323	3271	3232	3232
query66	1776	413	295	295
query67	20128	20260	20237	20237
query68	3054	1006	620	620
query69	387	285	256	256
query70	852	786	782	782
query71	287	228	207	207
query72	2819	2714	2504	2504
query73	521	520	299	299
query74	4674	4514	4340	4340
query75	2351	2307	1930	1930
query76	2321	1004	580	580
query77	352	401	280	280
query78	9923	9677	9193	9193
query79	1006	839	542	542
query80	591	467	360	360
query81	537	323	277	277
query82	572	146	108	108
query83	309	203	246	203
query84	322	124	101	101
query85	797	428	367	367
query86	314	229	233	229
query87	2016	1941	1812	1812
query88	3730	2746	2747	2746
query89	330	279	245	245
query90	1882	167	166	166
query91	165	152	123	123
query92	98	89	83	83
query93	991	972	576	576
query94	452	294	276	276
query95	585	341	364	341
query96	674	483	242	242
query97	2452	2430	2320	2320
query98	162	155	146	146
query99	762	762	652	652
Total cold run time: 234444 ms
Total hot run time: 151569 ms

@hello-stephen

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

query1	0.01	0.01	0.01
query2	0.09	0.06	0.05
query3	0.26	0.09	0.08
query4	1.61	0.10	0.09
query5	0.22	0.24	0.25
query6	1.17	0.69	0.68
query7	0.04	0.01	0.00
query8	0.06	0.04	0.04
query9	0.40	0.36	0.35
query10	0.58	0.57	0.60
query11	0.20	0.14	0.15
query12	0.18	0.14	0.15
query13	0.50	0.49	0.50
query14	1.02	1.02	1.00
query15	0.63	0.62	0.60
query16	0.35	0.31	0.35
query17	1.18	1.17	1.17
query18	0.20	0.18	0.19
query19	2.09	2.02	1.99
query20	0.02	0.02	0.01
query21	15.52	0.20	0.14
query22	4.84	0.06	0.06
query23	16.29	0.33	0.11
query24	2.73	0.42	0.59
query25	0.12	0.05	0.05
query26	1.27	0.22	0.15
query27	0.05	0.04	0.04
query28	3.75	0.78	0.36
query29	12.49	4.14	3.26
query30	0.30	0.13	0.09
query31	2.77	0.56	0.33
query32	3.22	0.60	0.51
query33	3.15	3.16	3.23
query34	15.36	4.03	3.41
query35	3.35	3.34	3.32
query36	0.57	0.44	0.43
query37	0.09	0.07	0.06
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.15	0.16
query41	0.08	0.03	0.03
query42	0.03	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 97.1 s
Total hot run time: 24.34 s

@Gabriel39
Gabriel39 merged commit 75ab5ba into apache:master Nov 4, 2026
36 of 37 checks passed
@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 77.75% (35953/46239)
Line Coverage 63.13% (404682/640996)
Region Coverage 59.73% (342593/573593)
Branch Coverage 60.84% (158627/260721)

yiguolei pushed a commit that referenced this pull request Nov 5, 2026
…/JSON/WAL fixes (#70185)

### What problem does this PR solve?

Backport the following master PRs to `branch-4.2`, in master merge
order:

1. #69672 — Preserve source values and alias semantics in ES scans.
2. #69971 — Add session controls for Parquet page indexes and data-page
size.
3. #70155 — Repair ES source predicate regression cases.
4. #70079 — Fix ORC condition-cache seeks past filtered stripe suffixes.
5. #70154 — Preserve JSON and WAL rows with empty file projections.

The ES changes are adapted to the existing 4.2 FE planner and BE source
locations. Mapping safety, scan-wide read mode, local residuals, native
`esquery` handling and alias routing retain the upstream behavior
without introducing the master connector framework. Added adapter tests
cover both scan protocols, aliases, missing-value negations and native
residual rejection.

Preserve existing branch-specific ES regression coverage. Bring in the
previously absent predicate suite, adapting its plan assertions to 4.2's
`LOCAL_PREDICATES` output and retaining LIMIT result checks. Parquet
variables use the 4.2 annotation interface and the original optional
Thrift field IDs. The ORC dependency is pinned to the same fixed commit
as #70079.

The ES implementation also preserves source numeric and JSONB predicate
semantics after scan-wide fallback. Numeric-token rounding must not make
a remote predicate discard a row matching the value Doris materializes;
empty JSONB objects remain nonnull even when ES indexes no leaf.
Docvalue eligibility and pushdown are retained.

Mapped date formats and their order are carried per concrete backing
index through the existing property map to both scan protocols.
Calendar/epoch alternatives now distinguish basic_date from
epoch_millis, for strings and source numeric tokens. Numeric docvalues
and older FE numeric requests retain their epoch decoder. Typed alias
selection consistently uses the requested mapping type in schema
inference and planning. The pinned ORC decoder's libdeflate dependency
is included on ARM, matching master.

### Release note

Fix ES source-value filtering, mapped dates and typed alias query
correctness, ORC condition-cache seek crashes/missing rows and its ARM
link dependency, and JSON/WAL row counts for empty file projections. Add
Parquet output page-index and data-page-size session controls.

### Validation

- FE compilation and Checkstyle passed. ES validation: 81 tests (48
datasource/planner tests and 33 legacy ES tests), 0 failures/errors, 1
external-environment skip. The 9 Parquet session-variable tests passed.
- Rebuilt the pinned ORC dependency under AddressSanitizer: 56 focused
tests passed, including 32 filtered-stripe-suffix seek cases.
- Compiled all 10 affected Doris C++ implementation/test translation
units and the ORC fixture generator. The regenerated fixture is
byte-for-byte identical to the committed fixture.
- clang-format 16 checks passed for all affected Doris C++ sources and
headers. Modified Groovy suites compiled successfully.
- The ES reader/parser implementations and test translation units
compiled. The shared DATETIMEV2 date-format algorithm passed 21
standalone ASAN checks. CMake dependency checks passed for aarch64,
arm64 and x86_64; an actual ARM link was not run locally.
- Added `test_es_source_review_cases.groovy` with SQL-to-SQL checks
against an internal reference table for numeric/JSONB source predicates,
LIMIT, epoch-only formats, and explicit legacy DATETIMEV2 basic_date
columns. It covers both scanners and parallel-scroll settings, waits for
legacy metadata readiness, and restores session settings. The suite
compiled; no golden files were handwritten.
- The applicable ES fixes are synchronized to master in #70205. Master
already links libdeflate on every architecture.
- Full Doris BE unit-test execution and live external SQL regression
were not performed locally; CI validation is requested.

### Check List (For Author)

- Test
  - [x] Unit Test
  - [x] Regression tests included
- Behavior changed:
  - [x] Yes; the upstream behavior is backported to 4.2.
- Does this need documentation?
- [x] Parquet controls are documented by the upstream documentation PR:
apache/doris-website#4581

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
Gabriel39 added a commit that referenced this pull request Nov 9, 2026
)

### What problem does this PR solve?

Backport three master fixes to `branch-4.1`: avoid unnecessary
database-object loading for SCHEMATA scans, prevent ORC condition-cache
seek crashes or missing rows, and preserve JSON/WAL row counts when no
file columns are projected.

The commits retain their original authors and are applied in master
merge order:

1. #70010 — Avoid database-object
enumeration when SCHEMATA only needs names.
2. #70079 — Advance safely past
SARG-filtered ORC stripe suffixes during condition-cache seeks.
3. #70154 — Track logical JSON
records independently of projected columns and capture WAL row counts
before column ownership is transferred.

Branch adaptations:

- Keep Thrift field 7 reserved and add the optional `include_db_ids`
flag at upstream field 8 with its default `true`. Preserve existing
privilege checks, pattern matching and schema-name formatting for both
enumeration paths.
- Use the upstream fixed ORC dependency revision
`5962bb071d6345cc29c5353d64d85a203525e4d9`, which descends from the
branch's existing revision.
- Resolve the JSON reader conflicts by retaining 4.1's error handling
and adding logical row accounting without importing unrelated
missing-field/load-rejection changes. Remove the rooted-array pre-count
that consumes the ondemand cursor before JSON-path materialization;
retain the upstream rooted-array coverage.

### Validation

- The branch's FE production and test sources compiled with the existing
Java 8 target settings. All **7 targeted FE tests passed**, including
the existing `FrontendServiceImplTest#testGetDBNames`, the
100,000-namespace case, filtering and legacy-request compatibility. FE
Checkstyle passed.
- A fresh ASAN build of the exact pinned ORC dependency passed **56
focused tests**, including **32 filtered-stripe-suffix boundary cases**.
- All **7 affected C++ implementation/test/generator translation units
compiled**. Clang-format 16 passed for all **8 affected C++
source/header files**.
- The ORC fixture generator reproduced the committed fixture byte for
byte. All **3 added Groovy suites compiled**.
- Full Doris BE unit-test execution and external SQL regression
execution remain for CI; they were not run locally for this backport.

### Release note

Improve SCHEMATA enumeration for large catalogs. Fix potential crashes
or missing rows during ORC condition-cache seeks and incorrect JSON/WAL
row counts with empty file projections.

### Check List (For Author)

- Test
  - [x] Unit tests and focused dependency tests
- [x] Regression tests included and compiled; full SQL execution pending
CI
- Behavior changed:
- [x] Yes. Apply the upstream fixes while preserving branch-specific
validation and protocol compatibility.
- Does this need documentation?
  - [x] No.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Add branch pick label

### ARM64 link dependency follow-up

The ORC revision enables libdeflate ZLIB decoding on every architecture.
Remove the old x86-only guard around `add_thirdparty(deflate)` so ARM64
BE links also receive the required library, matching master. An adjacent
comment records this dependency invariant.

Validation: probes include each branch's actual
`be/cmake/thirdparty.cmake` and select `aarch64`, `arm64`, `x86` and
`x86_64` dependency configurations. Before the fix, both ARM
configurations fail to link with missing libdeflate symbols while both
x86 controls pass. After the fix, all eight repository/configuration
combinations link and pass a DEFLATE compression/decompression round
trip. These probes run natively on x86_64 and validate CMake dependency
selection; a native ARM64/full BE build remains for CI. Clang-format 16
passed for the PR-affected C++ files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants