[fix](be) Count complex Parquet structs safely#65495
Conversation
### What problem does this PR solve?
Issue Number: N/A
Related PR: N/A
Problem Summary: Parquet COUNT pushdown used a STRUCT root repetition level to identify top-level rows when a representative leaf was repeated. Because the STRUCT repetition level is zero, all level entries were skipped and a correctness check aborted the BE. The non-null threshold also used the repeated leaf definition level and could count NULL structs. Identify top-level rows with repetition level zero and use the root nullable definition level so STRUCT columns containing ARRAY or MAP children are counted correctly.
### Release note
Fix BE aborts and incorrect COUNT results for Parquet STRUCT columns containing repeated children.
### Check List (For Author)
- Test: Unit Test
- NewParquetReaderTest targeted complex STRUCT and existing complex COUNT tests
- Behavior changed: Yes, COUNT pushdown handles repeated descendants using top-level row semantics.
- Does this need documentation: No
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
/review |
There was a problem hiding this comment.
I reviewed the two-file Parquet COUNT pushdown change and did not find a blocking issue that needs an inline comment.
Critical checkpoint conclusions:
- Goal/test: The patch targets COUNT(col) over Parquet STRUCT columns whose representative shape leaf is under a repeated descendant. The implementation now counts top-level rows by
rep_level == 0and uses the root nullable definition level; the added BE unit test covers nullable STRUCT rows with a repeated LIST child in both child orders. - Scope: The change is small and limited to the level-counting helper plus a focused test fixture.
- Parallel paths: COUNT(*) still uses the empty-column row-count path, MIN/MAX is unchanged, and the COUNT(col) request contract still passes a top-level complex column only when exactly one directly mapped complex scan column is projected. I traced the shape-reader path through scalar/list/map/struct nested readers.
- Concurrency/lifecycle/config/persistence: No new concurrency, lifecycle ownership, config, edit-log, transaction, or persistence behavior is introduced.
- Compatibility: No Thrift, storage-format, or mixed-version protocol change is introduced.
- Error handling/data correctness: Existing status/DORIS_CHECK handling remains in place; the new comparison matches the file-reader contract that COUNT(col) should count top-level nullness.
- Performance/observability: The levels-only path still avoids value materialization for heavy nested leaves; no new observability appears necessary for this narrow fix.
- Test coverage: The new unit test is deterministic and reaches
get_aggregate_result()for the changed path. I could not run BE UTs in this runner because.worktree_initialized,thirdparty/installed, andthirdparty/installed/bin/protocare absent, so validation here was static plusgit diff --checkafter fetching the exact base commit.
User focus: No additional user-provided focus points were present.
Subagent conclusions: The optimizer-rewrite lane found no semantic-equivalence or reader row-boundary issue. The tests-session-config lane found no test/session/config/style candidate. After the final ledger update, both live subagents reviewed the same no-inline-comments ledger/comment set and replied NO_NEW_VALUABLE_FINDINGS.
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-H: Total hot run time: 29280 ms |
TPC-DS: Total hot run time: 180787 ms |
ClickBench: Total hot run time: 24.99 s |
What problem does this PR solve?
Issue Number: N/A
Related PR: N/A
Problem Summary:
Parquet COUNT pushdown uses one representative leaf to count the top-level null state of a complex column. When a STRUCT contains an ARRAY or MAP descendant, the representative levels are repeated. The previous code compared repetition levels with the STRUCT root repetition level, which is zero, skipped every level entry, and triggered a
DORIS_CHECKthat aborted the BE. It also derived the non-null threshold from the repeated leaf definition level and could count a NULL struct as non-null.This change identifies top-level rows with repetition level zero and uses the root schema's nullable definition level to determine whether the top-level complex value is non-null. Empty and NULL collections inside a non-null STRUCT remain valid STRUCT rows.
Release note
Fix BE aborts and incorrect COUNT results for Parquet STRUCT columns containing ARRAY or MAP descendants.
Check List (For Author)
NewParquetReaderTest.CountStructWithRepeatedChildUsesTopLevelRowBoundariesValidation on the designated Linux build host:
build-support/check-format.shrun-clang-tidy.sh: test file has no warnings; production analysis reports pre-existing full-file diagnostics andjni-util.htoolchain static assertions unrelated to this change.