Skip to content

[fix](be) Preserve JSON and WAL rows with empty file projections - #70154

Merged
Gabriel39 merged 3 commits into
apache:masterfrom
Gabriel39:fix/json-empty-projection-row-count
Nov 4, 2026
Merged

Gabriel39 merged 3 commits into
apache:masterfrom
Gabriel39:fix/json-empty-projection-row-count

Conversation

@Gabriel39

@Gabriel39 Gabriel39 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #69926

Problem Summary:

Hive JSON queries that only need partition columns can return zero rows even when the selected files contain records. For example, SELECT * ... WHERE dt = 'p1' returns data while SELECT COUNT(*) ... WHERE dt = 'p1' returns zero. The V2 JSON reader derived its row count from the output block, which has no columns after physical field pruning. Writer-backed reader tests reproduce the same row-count loss for empty WAL projections.

Track accepted JSON records independently of materialized columns, including batch progress, array expansion, error rollback, and ignore-malformed NULL rows. Preserve JSON-path record selection for empty projections, and let the existing TableReader materialize partition values using the returned row count.

For WAL, save the deserialized source row count before materialization transfers column ownership, then pass it through the existing filter pipeline. This preserves the row count when no file columns are requested. The empty-projection reproduction is at the reader interface; production replay reachability of an empty projection remains unverified.

Add ten JSON BE tests covering empty file schemas and projections, arrays, JSON roots/paths, malformed input, batch boundaries, EOF, and actual TableReader partition materialization. Add eight writer-backed WAL cases covering empty, single-column, and reordered full projections across multiple blocks, with and without schema discovery, plus repeated EOF reads. Add a WAL SQL regression that forces two original async-load transactions to abort, then verifies row counts, NULLs, aggregates, filters, and actual values after replay. Add a Hive SQL regression using the existing partitioned JSON fixture for COUNT, partition projections, grouping, and file-column filters with external COUNT pushdown enabled and disabled.

Release note

Fix incorrect zero counts and missing rows when querying only partition columns of Hive JSON tables. Preserve logical row counts for empty WAL reader projections.

Check List (For Author)

  • Test
    • Unit Test: 166 ASAN tests passed, including JSON reader, TableReader, WAL V2 reader, WAL reader/writer, and CSV/Text empty-projection controls. Before the JSON fix, nine of ten new tests failed; before the WAL fix, both empty-projection cases failed while six projection controls passed.
    • WAL SQL regression: test_group_commit_wal_row_count passed twice on isolated Doris 4.1.5 with scanner V2 enabled. Generated the .out file with run-regression-test.sh, then reran for result comparison. Execution on master is pending CI.
    • Hive SQL regression: added test_hive_json_partition_only; Groovy compilation passed. Full execution against the external Hive fixture is pending CI.
  • Behavior changed:
    • Yes. Empty JSON and WAL file projections preserve logical row counts. Hive JSON partition-only queries produce the correct rows and aggregates.
  • Does this need documentation?
    • No.

### What problem does this PR solve?

Issue Number: close apache#69926

Problem Summary: Preserve accepted JSON record counts independently of output
columns so partition projections and aggregates receive the correct rows. Keep
batch progress, JSON paths, error rollback, and malformed-record handling
consistent, and add unit and Hive SQL regression coverage.

### Release note

Fix incorrect zero counts and missing rows in partition-only Hive JSON scans.

### Check List (For Author)

- Test: 151 ASAN unit tests passed; Hive SQL regression added and Groovy-compiled.
- Behavior changed: Yes, zero file-column projections retain valid records.
- Does this need documentation: No.
@Gabriel39
Gabriel39 requested a review from yiguolei as a code owner November 4, 2026 02:21
@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

### What problem does this PR solve?

Issue Number: close apache#69926

Related PR: apache#70154

Problem Summary: The WAL V2 reader counts rows from the projected output
block, so an empty projection reports zero despite a nonempty source block.
Save the source row count before materialization moves column ownership and
keep the existing filter pipeline. Add eight writer-backed cases covering
empty, single-column, and reordered full projections, multiple blocks,
schema discovery, and repeated EOF reads.

### Release note

Preserve logical row counts for empty WAL reader projections.

### Check List (For Author)

- Test: 166 ASAN tests passed across JSON, TableReader, WAL V2, WAL
  reader/writer, and CSV/Text empty-projection controls. Both new empty WAL
  projection cases failed before the fix; six projection controls passed.
- Behavior changed: Yes; empty WAL projections report source rows.
- Does this need documentation: No.
@Gabriel39 Gabriel39 changed the title [fix](be) Preserve JSON rows without projected file columns [fix](be) Preserve JSON and WAL rows with empty file projections Nov 4, 2026
@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.

No actionable defects found in the six changed files at head 3f6f6f3dd6d512d325fa6e4f5a4a6726777778eb. The changes address lost logical rows when JSON or WAL file projections contain no columns. There are no existing inline findings to retain or duplicate, and no additional user-provided focus points.

Applicable critical checkpoints:

  • Goal and evidence: JSON now counts accepted records independently of Block::rows(); WAL saves deserialized cardinality before moving columns. TableReader passes that explicit count into partition/default materialization. Added reader tests and a real TableReader partition test exercise this contract; test execution was not performed here.
  • Scope and reuse: production changes are limited to the JSON reader/header and WAL reader. They reuse the existing mapper, materialization, and shared filtering pipeline.
  • Concurrency: the new counter is reader-local and used by sequential scanner reads. No shared state, new threads, locks, lock-order changes, or work inside locks is introduced.
  • Lifecycle and ownership: the counter resets per batch, accepted appends increment once, error rollback restores it with the columns, and filtering receives the explicit count. WAL captures rows before ownership transfer; schema discovery, final batches, repeated EOF, and close retain their existing lifecycle. No new cross-translation-unit static initialization dependency was found.
  • Configuration: no configuration items or dynamic-update behavior are added.
  • Compatibility: no storage encoding, WAL header, version check, serialized metadata, or public protocol changes are introduced. Existing populated and reordered projections retain their cardinality.
  • Thrift/Protobuf: neither definition directory changes; field-ID compatibility checks are inapplicable.
  • Parallel paths: simple objects, arrays, JSON roots/paths, malformed-null rows, load rejection, and nonempty projections were traced. CSV/Text already use independent row counts and retain equivalent empty-projection controls.
  • Conditional checks: the new empty-request branch preserves JSON-path record selection; root and missing paths receive explicit handling. Ondemand cursor reuse and rollback were inspected. Unrequested-value validation remains projection-dependent, as in the existing reader.
  • Test coverage: ten added JSON tests cover empty schemas/projections, roots/paths/arrays, malformed modes, empty input, batch/EOF progression, and partition materialization. Eight writer-backed WAL combinations cover empty/partial/reordered projections with and without schema discovery across multiple blocks and repeated EOF. The Hive suite compares file-field reads with partition-only counts/projections/grouping under both external COUNT settings, including file predicates and an absent partition. Existing tests cover populated projections, filtering, rejection, and split boundaries.
  • Expected results: no generated result files change. WAL assertions check cardinality and projected values; Hive comparisons use the same fixture files as a differential oracle and do not depend on output ordering. The author-reported passing tests were not independently reproduced.
  • Observability: existing parse/materialize/filter/I/O timing paths remain intact; scan-row accounting now includes accepted zero-column rows. No new logging or metric family is needed for the scalar cardinality bookkeeping.
  • Transactions and persistence: WAL reads change, but write/replay serialization, transaction state, EditLog behavior, and failover protocols do not. Visible-version and delete-bitmap rules are unaffected; the existing delete/predicate filtering path remains in place.
  • Data writes and atomicity: no new production data-write path or commit boundary is introduced.
  • FE/BE variables: no new transmitted variables or send paths are added.
  • Performance and memory: the added normal-path bookkeeping is scalar; JSON-path existence checks run only for empty projections. No new payload copies, large allocations, retained ownership, or pruning loss were identified. No benchmark was run.
  • Other concerns: no further actionable issue remained after the complete and risk-focused reviews and final rechecks.

Validation limits: this was a static review; no builds, tests, benchmarks, or external Hive queries were executed. The WAL empty-projection guarantee is covered at the reader interface; production replay reaching an empty projection remains unverified, consistent with the PR description. These limits do not leave an unresolved defect candidate in the reviewed code.

Review converged after 1 round(s).

### What problem does this PR solve?

Issue Number: close apache#69926

Related PR: apache#70154

Problem Summary: Add SQL-level integration coverage for the WAL reader
row-count fix. Force two original async group-commit transactions to abort,
then verify counts, NULLs, aggregates, filtering and field values after WAL
replay. Keep the reader-level empty-projection regression cases as the
precise defect reproduction.

### Release note

None

### Check List (For Author)

- Test: Run the new suite twice on isolated Doris 4.1.5 with scanner V2
  enabled, using run-regression-test.sh to generate the output file and
  then compare results. Execution on master remains pending CI.
- Behavior changed: No; regression coverage 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 commented Nov 4, 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/41765255516

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

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17600	5214	5085	5085
q2	2160	309	256	256
q3	10232	1369	809	809
q4	4683	461	335	335
q5	7438	787	549	549
q6	182	181	153	153
q7	745	813	597	597
q8	9255	1286	1041	1041
q9	5496	4241	4164	4164
q10	6842	1292	1047	1047
q11	435	242	226	226
q12	638	394	274	274
q13	18123	3662	3059	3059
q14	276	273	243	243
q15	q16	753	714	675	675
q17	1196	755	574	574
q18	6988	6242	6185	6185
q19	1623	966	609	609
q20	396	345	231	231
q21	5743	2443	2454	2443
q22	393	346	290	290
Total cold run time: 101197 ms
Total hot run time: 28845 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6124	5983	6207	5983
q2	746	648	593	593
q3	5659	5793	5439	5439
q4	2007	2134	1557	1557
q5	5777	5946	5554	5554
q6	244	186	141	141
q7	2365	2013	1768	1768
q8	3016	2601	2653	2601
q9	7946	7455	7536	7455
q10	3629	3547	3148	3148
q11	576	404	375	375
q12	670	660	502	502
q13	3238	3575	3013	3013
q14	288	288	268	268
q15	q16	650	684	612	612
q17	7696	7002	6830	6830
q18	13007	12245	12878	12245
q19	908	766	767	766
q20	2151	2135	1957	1957
q21	5563	4546	4640	4546
q22	490	460	388	388
Total cold run time: 72750 ms
Total hot run time: 65741 ms

@hello-stephen

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

query5	4311	570	459	459
query6	419	213	192	192
query7	4807	437	228	228
query8	321	164	153	153
query9	8771	3138	3134	3134
query10	477	295	253	253
query11	5952	3871	3562	3562
query12	153	91	87	87
query13	1244	446	328	328
query14	6057	3874	3645	3645
query14_1	3378	3342	3311	3311
query15	206	197	184	184
query16	963	411	393	393
query17	822	638	520	520
query18	2406	407	294	294
query19	205	157	126	126
query20	82	82	81	81
query21	205	128	103	103
query22	12988	12932	12723	12723
query23	13404	12852	12609	12609
query23_1	12638	12677	12446	12446
query24	7341	816	486	486
query24_1	467	471	493	471
query25	512	421	363	363
query26	1242	258	140	140
query27	2777	440	277	277
query28	4613	2023	2028	2023
query29	1568	611	479	479
query30	305	223	194	194
query31	1010	932	835	835
query32	149	95	94	94
query33	529	309	245	245
query34	948	850	519	519
query35	739	767	656	656
query36	824	833	737	737
query37	120	94	81	81
query38	1775	1754	1648	1648
query39	788	811	746	746
query39_1	736	720	733	720
query40	224	119	101	101
query41	74	68	68	68
query42	89	91	97	91
query43	345	370	312	312
query44	1308	707	710	707
query45	179	179	176	176
query46	839	959	568	568
query47	2975	3006	2854	2854
query48	308	325	227	227
query49	585	406	301	301
query50	677	278	236	236
query51	10536	10511	10693	10511
query52	78	87	73	73
query53	186	210	149	149
query54	251	207	210	207
query55	75	68	62	62
query56	255	243	236	236
query57	1666	1629	1563	1563
query58	301	277	268	268
query59	2164	2294	2053	2053
query60	303	262	236	236
query61	172	169	171	169
query62	392	356	300	300
query63	189	162	164	162
query64	2892	950	739	739
query65	3318	3246	3236	3236
query66	1781	424	306	306
query67	20273	20307	20050	20050
query68	2893	990	619	619
query69	374	276	237	237
query70	830	761	778	761
query71	288	240	199	199
query72	2695	2604	2227	2227
query73	509	538	304	304
query74	4628	4501	4334	4334
query75	2322	2284	1894	1894
query76	2315	1009	569	569
query77	345	413	271	271
query78	9750	9763	9219	9219
query79	1006	854	566	566
query80	817	422	347	347
query81	592	317	267	267
query82	572	132	103	103
query83	318	194	183	183
query84	313	121	96	96
query85	905	426	377	377
query86	356	235	234	234
query87	1983	1936	1814	1814
query88	3741	2792	2735	2735
query89	332	276	247	247
query90	1787	167	166	166
query91	165	151	129	129
query92	101	92	86	86
query93	994	994	575	575
query94	503	284	265	265
query95	573	334	354	334
query96	688	477	242	242
query97	2450	2436	2314	2314
query98	169	152	146	146
query99	774	768	673	673
Total cold run time: 234564 ms
Total hot run time: 151335 ms

@Gabriel39

Copy link
Copy Markdown
Contributor Author

Local pipeline review — ✅ PASS

schema: doris-repo-review/v1
status: PASS
pr: apache/doris#70154
commit: 8009387671d3ebcf51afedca65a6c252715e4f6d
base: 30ce25dc1f9579130cba38f5a9baed7c96187e12
reviewed_at: 2026-11-04T13:22+08:00
reviewer: Gabriel39
model: gpt-6-astra
effort: xhigh
findings: {blocker: 0, major: 0, minor: 0, nit: 0}
rounds: 1
converged: true

Notes for maintainers

  • Static source review only; no builds or tests were run for this review. Full Hive fixture execution and the WAL SQL regression on master still need CI validation as described in the PR.
  • be/src/format_v2/wal/wal_reader.cpp:198 — the empty-projection contract is directly covered by writer-backed reader tests; production reachability of an empty WAL projection remains unverified. The SQL regression validates replay with populated projections.

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.

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.09	0.05	0.05
query3	0.26	0.09	0.09
query4	1.61	0.09	0.10
query5	0.23	0.24	0.24
query6	1.17	0.67	0.68
query7	0.04	0.01	0.01
query8	0.05	0.04	0.04
query9	0.40	0.35	0.35
query10	0.55	0.61	0.59
query11	0.20	0.16	0.15
query12	0.19	0.15	0.15
query13	0.48	0.49	0.48
query14	1.04	1.02	1.02
query15	0.63	0.61	0.61
query16	0.35	0.36	0.35
query17	1.13	1.14	1.10
query18	0.19	0.19	0.20
query19	2.04	1.99	2.03
query20	0.02	0.01	0.01
query21	15.49	0.20	0.13
query22	4.80	0.06	0.05
query23	16.28	0.33	0.13
query24	3.02	0.54	0.42
query25	0.09	0.06	0.05
query26	1.42	0.21	0.15
query27	0.05	0.03	0.05
query28	3.91	0.76	0.37
query29	12.48	4.13	3.24
query30	0.30	0.13	0.10
query31	2.77	0.57	0.33
query32	3.22	0.59	0.50
query33	3.11	3.23	3.19
query34	15.38	3.99	3.37
query35	3.36	3.37	3.33
query36	0.56	0.46	0.44
query37	0.09	0.06	0.07
query38	0.05	0.04	0.03
query39	0.04	0.03	0.03
query40	0.18	0.15	0.15
query41	0.08	0.03	0.03
query42	0.03	0.03	0.04
query43	0.04	0.04	0.03
Total cold run time: 97.43 s
Total hot run time: 24.37 s

@Gabriel39
Gabriel39 merged commit 4bde8d0 into apache:master Nov 4, 2026
41 of 43 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 4, 2026
)

### What problem does this PR solve?

Issue Number: close #69926

Problem Summary:

Hive JSON queries that only need partition columns can return zero rows
even when the selected files contain records. For example, `SELECT * ...
WHERE dt = 'p1'` returns data while `SELECT COUNT(*) ... WHERE dt =
'p1'` returns zero. The V2 JSON reader derived its row count from the
output block, which has no columns after physical field pruning.
Writer-backed reader tests reproduce the same row-count loss for empty
WAL projections.

Track accepted JSON records independently of materialized columns,
including batch progress, array expansion, error rollback, and
ignore-malformed NULL rows. Preserve JSON-path record selection for
empty projections, and let the existing TableReader materialize
partition values using the returned row count.

For WAL, save the deserialized source row count before materialization
transfers column ownership, then pass it through the existing filter
pipeline. This preserves the row count when no file columns are
requested. The empty-projection reproduction is at the reader interface;
production replay reachability of an empty projection remains
unverified.

Add ten JSON BE tests covering empty file schemas and projections,
arrays, JSON roots/paths, malformed input, batch boundaries, EOF, and
actual TableReader partition materialization. Add eight writer-backed
WAL cases covering empty, single-column, and reordered full projections
across multiple blocks, with and without schema discovery, plus repeated
EOF reads. Add a WAL SQL regression that forces two original async-load
transactions to abort, then verifies row counts, NULLs, aggregates,
filters, and actual values after replay. Add a Hive SQL regression using
the existing partitioned JSON fixture for COUNT, partition projections,
grouping, and file-column filters with external COUNT pushdown enabled
and disabled.

### Release note

Fix incorrect zero counts and missing rows when querying only partition
columns of Hive JSON tables. Preserve logical row counts for empty WAL
reader projections.

### Check List (For Author)

- Test
- [x] Unit Test: 166 ASAN tests passed, including JSON reader,
TableReader, WAL V2 reader, WAL reader/writer, and CSV/Text
empty-projection controls. Before the JSON fix, nine of ten new tests
failed; before the WAL fix, both empty-projection cases failed while six
projection controls passed.
- [x] WAL SQL regression: `test_group_commit_wal_row_count` passed twice
on isolated Doris 4.1.5 with scanner V2 enabled. Generated the `.out`
file with `run-regression-test.sh`, then reran for result comparison.
Execution on master is pending CI.
- [x] Hive SQL regression: added `test_hive_json_partition_only`; Groovy
compilation passed. Full execution against the external Hive fixture is
pending CI.
- Behavior changed:
- [x] Yes. Empty JSON and WAL file projections preserve logical row
counts. Hive JSON partition-only queries produce the correct rows and
aggregates.
- Does this need documentation?
    - [x] No.
@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.74% (35948/46240)
Line Coverage 63.12% (404591/641021)
Region Coverage 59.74% (342673/573632)
Branch Coverage 60.83% (158614/260744)

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
yiguolei pushed a commit that referenced this pull request Nov 5, 2026
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.

[Bug] 对 Hive textfile + JsonSerDe 分区表,count(*) + 分区列过滤 恒为 0,而 select * 有数据

3 participants