[fix](be) Avoid materializing complex columns for external count#65560
[fix](be) Avoid materializing complex columns for external count#65560xylaaaaa wants to merge 1 commit into
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
7a26fef to
994746b
Compare
|
run buildall |
TPC-H: Total hot run time: 29626 ms |
TPC-DS: Total hot run time: 179358 ms |
ClickBench: Total hot run time: 25.49 s |
FE Regression Coverage ReportIncrement line coverage |
|
/review |
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: COUNT(nullable complex column) over Parquet or ORC file TVFs cannot use COUNT(*) row metadata because top-level NULL values must be excluded. With FileScannerV2, the query therefore decoded the full complex column through Arrow and then materialized Doris columns, retaining decoded binary chunks and causing excessive peak memory or intermittent OOM. This change introduces an explicit COUNT_NON_NULL operation and target slot from FE to BE. Parquet counts top-level shape from bounded definition/repetition-level batches without Arrow builders or Doris value columns, while ORC uses non-null stripe statistics. It also emits valid non-NULL synthetic target rows and releases file-block ownership before mutable output conversion to avoid unnecessary COW copies.
### Release note
Reduce memory usage for COUNT on nullable columns read from Parquet and ORC file TVFs with FileScannerV2.
### Check List (For Author)
- Test: Unit Test
- FE PhysicalStorageLayerAggregateTest: 4 tests passed
- BE targeted Parquet, ORC, and TableReader tests: 14 tests passed
- HDFS TVF regression assertion added but not run locally because this worktree has no Doris cluster or external HDFS test environment
- Behavior changed: Yes. Eligible nullable file-column counts use explicit COUNT_NON_NULL pushdown instead of materializing the full column.
- Does this need documentation: No
994746b to
ef14917
Compare
|
run buildall |
There was a problem hiding this comment.
I found one correctness issue in the new COUNT_NON_NULL pushdown path. The PR head moved after the review snapshot, so I fetched and rechecked live head ef14917; the issue still exists at the submitted anchor.
Checkpoint summary:
- Correctness: COUNT_NON_NULL currently fails valid count(col) queries when the per-split mapping or file reader cannot serve the optimization, instead of falling back to a normal scan.
- Lifecycle/concurrency: runtime-filter, conjunct, delete, condition-cache, close, and finalize ownership paths were checked; no separate issue remained.
- Compatibility/config: TVF format gating, session-variable gates, thrift propagation, and SlotId-to-GlobalIndex mapping were checked.
- Tests: existing tests cover successful direct Parquet/ORC paths, but not fallback for missing/defaulted split columns or unsupported reader metadata/layouts. No tests were run in this review environment.
| FileAggregateResult file_result; | ||
| const auto status = _data_reader.reader->get_aggregate_result(file_request, &file_result); | ||
| if (status.is<ErrorCode::NOT_IMPLEMENTED_ERROR>()) { | ||
| if (_push_down_agg_type == TPushAggOp::type::COUNT_NON_NULL) { |
There was a problem hiding this comment.
This makes an optional pushdown miss fail the query. Status::NotSupported is NOT_IMPLEMENTED_ERROR, and the Parquet/ORC aggregate readers still return it for cases they cannot answer from metadata or levels, such as unsupported Parquet nested layouts or missing ORC stripe/column statistics. The per-split mapper can also reject the target when a TVF glob contains a later file where the column is missing/defaulted; the normal scan path can synthesize those values. Since the scan still has the real count column projected, COUNT_NON_NULL needs the same fallback behavior as COUNT/MINMAX: leave pushed_down=false and scan rows normally instead of returning an error for valid count(col) queries.
|
Codex automated review failed and did not complete. Error: Codex completed, but no new pull request review was submitted for the current head SHA. Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-H: Total hot run time: 29139 ms |
TPC-DS: Total hot run time: 177574 ms |
ClickBench: Total hot run time: 25.54 s |
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
FE Regression Coverage ReportIncrement line coverage |
What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: COUNT(nullable complex column) over Parquet or ORC file TVFs cannot use COUNT(*) row metadata because top-level NULL values must be excluded. With FileScannerV2, the query therefore decoded the full complex column through Arrow and then materialized Doris columns, retaining decoded binary chunks and causing excessive peak memory or intermittent OOM. This change introduces an explicit COUNT_NON_NULL operation and target slot from FE to BE. Parquet counts top-level shape from bounded definition/repetition-level batches without Arrow builders or Doris value columns, while ORC uses non-null stripe statistics. It also emits valid non-NULL synthetic target rows and releases file-block ownership before mutable output conversion to avoid unnecessary COW copies.
Release note
Reduce memory usage for COUNT on nullable columns read from Parquet and ORC file TVFs with FileScannerV2.
Check List (For Author)