Skip to content

Add error-path tests for functions refactored in PR #97672 - #98997

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
zlareb1:fix/pr97672-validation-error-tests
Mar 16, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
zlareb1:fix/pr97672-validation-error-tests

Conversation

@zlareb1

@zlareb1 zlareb1 commented Mar 8, 2026 •

Copy link
Copy Markdown
Member

PR #97672 mechanically replaced manual argument validation with the validateFunctionArguments / validateFunctionArgumentsWithVariadics framework across 21 function files. While the behavior is unchanged, the following functions had no existing tests verifying their error paths (wrong argument types → ILLEGAL_TYPE_OF_ARGUMENT or BAD_ARGUMENTS):

  • appendTrailingCharIfAbsent
  • monthName
  • conv
  • lowCardinalityIndices / lowCardinalityKeys
  • randomPrintableASCII
  • randomString
  • ngrams (throws BAD_ARGUMENTS, not ILLEGAL_TYPE_OF_ARGUMENT)
  • dynamicType

This adds a single test file covering both happy-path and error-path queries for each of these functions, preventing future regressions if the validation framework or these functions are changed.

Functions already covered by existing tests (tupleConcat, substringIndex, randomStringUTF8) are intentionally excluded.

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):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Note

Low Risk
Adds only stateless SQL tests and expected outputs, with no production code changes; risk is limited to potential test flakiness or incorrect expected error codes.

Overview
Adds a new stateless query test (03930_pr97672_validation_error_paths.sql + .reference) that exercises both success and wrong-argument-type error paths for several functions whose argument validation was recently refactored (e.g., appendTrailingCharIfAbsent, monthName, conv, lowCardinalityIndices/Keys, randomPrintableASCII, randomString, ngrams, dynamicType).

The test asserts expected failures via serverError ILLEGAL_TYPE_OF_ARGUMENT to prevent regressions in validation behavior.

Written by Cursor Bugbot for commit 3cb6ebc. This will update automatically on new commits. Configure here.

Version info

  • Merged into: 26.3.1.709

@clickhouse-gh

clickhouse-gh Bot commented Mar 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3cb6ebc]

Summary: ✅


AI Review

1) Summary

This PR adds a new stateless test pair (03930_pr97672_validation_error_paths.sql/.reference) to cover happy paths and wrong-type error paths for functions refactored in #97672 (appendTrailingCharIfAbsent, monthName, conv, lowCardinalityIndices, lowCardinalityKeys, randomPrintableASCII, randomString, ngrams, dynamicType). Based on the diff, this is a test-only change with no correctness/safety regressions in production code, and the selected assertions are aligned with the intended validation behavior.

2) Missing context (if any)

  • CI is still in progress for this head SHA; full green CI evidence is not yet available.
  • No benchmark/perf evidence was provided (not expected for this test-only change).

3) Findings (by severity)

No Blockers or Majors found; the PR looks good.

4) Tests & Evidence

  • Coverage assessment: positive and negative paths are both present for all listed target functions in this PR.
  • Negative/error-handling tests: present via { serverError ILLEGAL_TYPE_OF_ARGUMENT } checks on wrong-type arguments.
  • Additional tests to consider (optional follow-up): add one extra conv invalid-argument semantic case (e.g., out-of-range base) to ensure non-type validation paths remain covered too.

5) ClickHouse Compliance Checklist (Yes/No + short note)

  • Data deletions logged? Yes (N/A) — no deletion logic touched.
  • Serialization formats versioned? Yes (N/A) — no serialization/protocol changes.
  • Experimental setting gate present? Yes (N/A) — no feature behavior change.
  • Settings exposed for constants/thresholds? Yes (N/A) — no new constants in runtime code.
  • Backward compatibility preserved? Yes — test-only change.
  • SettingsHistory.cpp updated for new/changed settings? Yes (N/A) — no settings changed.
  • Existing tests untouched (only additions)? Yes — only new test files added.
  • Docs/user-facing notes updated? Yes (N/A) — no user-facing runtime behavior added.
  • Core-area change got extra scrutiny? Yes (N/A) — no core runtime code changed.

6) Performance & Safety Notes

No hot-path or memory/concurrency impact: this PR only adds stateless SQL test coverage. No performance benchmark is required for this scope.

7) User-Lens Review

The added tests improve confidence that users receive stable, actionable type-validation exceptions after the #97672 refactor. Behavior is unsurprising and error expectations are explicit in test annotations.

8) Final Verdict

  • Status: Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 8, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

The LLVM Coverage job failure in this PR is caused by a bug introduced in #96738 — the job crashes when a PR has no C++ source code changes. The fix is in #99032. Since this branch is in a fork, I can't merge it directly — please merge master once #99032 lands, or cherry-pick the fix. cc @alexbakharew

@alexbakharew

Copy link
Copy Markdown
Contributor

The LLVM Coverage job is fixed in this PR: #99103
It is already in merge queue. Please update your PR

zlareb1 and others added 2 commits March 11, 2026 21:13
PR ClickHouse#97672 replaced manual argument validation with `validateFunctionArguments`
in 21 function files. The following functions had no existing tests for their
error paths (wrong argument types):

- `appendTrailingCharIfAbsent`
- `monthName`
- `conv`
- `lowCardinalityIndices` / `lowCardinalityKeys`
- `randomPrintableASCII`
- `randomString`
- `ngrams` (uses `BAD_ARGUMENTS` instead of `ILLEGAL_TYPE_OF_ARGUMENT`)
- `dynamicType`

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@zlareb1
zlareb1 force-pushed the fix/pr97672-validation-error-tests branch from dd94594 to 3cb6ebc Compare March 11, 2026 15:43
@zlareb1
zlareb1 marked this pull request as ready for review March 12, 2026 09:10
@zlareb1
zlareb1 requested a review from scanhex12 March 12, 2026 09:10
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Mar 16, 2026
@alexey-milovidov alexey-milovidov self-assigned this Mar 16, 2026
Merged via the queue into ClickHouse:master with commit 8291eac Mar 16, 2026
160 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants