Skip to content

Add test: arrayNorm over Array(BFloat16) (widen-to-Float32 kernel path) is untested across the whole suite - #106644

Merged
nickitat merged 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr106211
Jun 10, 2026
Merged

nickitat merged 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr106211

Conversation

@clickgapai

@clickgapai clickgapai commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.

Adds test coverage for 1 untested code path(s), found during automated review of PR #106211.
That PR The PR rewrites the row loop of arrayNorm (L1Norm/L2Norm/L2SquaredNorm/LinfNorm/LpNorm) into a single batched, manually-unrolled kernel normBatchImpl (unroll_count=16) with runtime CPU dispatch to an x86_64_v4 (AVX-512) specialisation via MULTITARGET_FUNCTION_X86_V4 / `isArchSuppor

1. arrayNorm over Array(BFloat16) (widen-to-Float32 kernel path) is untested across the whole suite
src/Functions/array/arrayNorm.cpp:202, src/Functions/array/arrayNorm.cpp:270
Risk: getReturnTypeImpl maps TypeIndex::BFloat16->DataTypeFloat32 (arrayNorm.cpp:202-204), and executeWithResultType dispatches to executeWithTypes<Float32, BFloat16> which calls the new normBatchImpl kernel that widens each element via static_cast<ResultType>(row_data[i]) (arrayNorm.cpp:168/175). No stateless or integration test ever passes a BFloat16 array to these functions. Risk: a broken BFloat16->Float32 widening or a dropped BFloat16 switch case would silently return wrong norms …
What's unique vs PR tests: The PR ships no tests; the only existing norm test (02283_array_norm.sql) covers Array(UInt8)/Array(Int32)/Array(Float32)/Array(Float64). This test is the sole coverage of the Array(BFloat16) widening instantiation that the PR's new kernel explicitly handles.
Try it on ClickHouse Fiddle

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.6.1.613

@clickgapai

Copy link
Copy Markdown
Contributor Author

Pre-PR Validation Gate (per ClickGap pipeline):

a) Deterministic repro? ✅
Test deterministically exercises the previously-uncovered branch and passes (correct behaviour). Confirmed across runs.

b) Root cause explained? ✅
arrayNorm.cpp:202-204 (case TypeIndex::BFloat16: -> Float32) and the BFloat16 instantiation of executeWithTypes/normBatchImpl are correct but exercised by zero tests.

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 04319_array_norm_bfloat16.sql.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

@nickitat nickitat added the can be tested Allows running workflows for external contributors label Jun 6, 2026
@nickitat nickitat self-assigned this Jun 6, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9160411]

Summary: ✅


AI Review

Summary
  • This PR adds a stateless regression test for arrayNorm functions over Array(BFloat16), including the BFloat16 to Float32 return-type path and both short rows plus a 40-element row that reaches the unrolled normBatchImpl loop. I did not find a correctness issue that warrants an inline review comment.
Missing context / blind spots
  • ⚠️ The GitHub Fast test job was still in progress, and the linked Praktika report for commit 916041102a138c2488a1673dac76bdc9c7fbbe19 contained zero test rows at review time. A passing Fast test or focused run of 04319_array_norm_bfloat16 would close this gap.
  • ⚠️ This checkout has no local build* directory or clickhouse binary, so I could not execute the new stateless test locally.
Final Verdict
  • Status: ✅ Approve
  • No code-review findings. Merge should still wait for the already-running CI evidence for the added stateless test.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jun 6, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.50% 84.60% +0.10%
Functions 92.30% 92.30% +0.00%
Branches 77.10% 77.20% +0.10%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 546 line(s), 44 function(s) across 135 file(s) · Details

Top files
  • src/Common/Scheduler/Workload/WorkloadEntityStorageBase.cpp: 104 line(s), 7 function(s)
  • src/Storages/RabbitMQ/RabbitMQSource.cpp: 51 line(s), 2 function(s)
  • src/Common/Scheduler/Workload/WorkloadEntityKeeperStorage.cpp: 29 line(s), 1 function(s)
  • src/Storages/RabbitMQ/StorageRabbitMQ.cpp: 17 line(s), 2 function(s)
  • src/Interpreters/DeadLetterQueue.cpp: 13 line(s), 1 function(s)

Full report

@nickitat
nickitat added this pull request to the merge queue Jun 10, 2026
Merged via the queue into ClickHouse:master with commit a099632 Jun 10, 2026
327 of 328 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants