Skip to content

AST fuzzer oracle: skip a non-deterministic function passed by name - #125728

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix/oracle-function-name-argument
Oct 15, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix/oracle-function-name-argument

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

A higher-order function accepts a function by its bare name instead of a lambda, e.g. arrayMap(generateUUIDv7, arr). The name is an ASTIdentifier, so hasNonDeterministicFunctionsImpl, which only checked ASTFunction nodes, did not see it. The DQP oracle then compared two runs of generateUUIDv7 and reported a false mismatch:

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=105541&sha=d5628da5fb3950280638fe2bb20b142ff124f6c9&name_0=PR&name_1=AST%20fuzzer%20%28amd_release%2C%20oracle%29

The gate now also checks an unqualified identifier against FunctionFactory and the user-defined function factories. A column that happens to share a name with a non-deterministic function only makes the oracle skip one more query, which is safe.

Verified on a local server with ast_fuzzer_runs = 1, ast_fuzzer_oracle = 1, ast_fuzzer_any_query = 1 and the query from the report: 6 of 60 runs reported DQP oracle mismatch without the change, and 0 of 60 with it. No stateless test is added, because the oracle only runs on randomly fuzzed queries and could not reproduce this reliably.

Related: #105541

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/125728]

Version info

  • Merged into: 26.10.1.2424-master (included in 26.10 and later)

A higher-order function accepts a function by its bare name instead of a lambda,
e.g. `arrayMap(generateUUIDv7, arr)`. The name is an `ASTIdentifier`, so
`hasNonDeterministicFunctionsImpl`, which only checked `ASTFunction` nodes, did not
see it, and the `DQP` oracle compared two runs of `generateUUIDv7` and reported a
false mismatch.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=105541&sha=d5628da5fb3950280638fe2bb20b142ff124f6c9&name_0=PR&name_1=AST%20fuzzer%20%28amd_release%2C%20oracle%29
PR: #105541

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c006238]

Summary: ✅


AI Review

Summary

The PR extends QueryOracleChecker to exclude non-deterministic functions passed as bare names, parameterized identifiers, or APPLY expressions, preventing false oracle mismatches. Reviewed head: c006238a1c8f328f8fcfb8c6cb28c0658f0b8ce8. Both prior findings are addressed in the current code and their bot-authored threads have been resolved. No new actionable findings remain.

Missing context / blind spots
  • ⚠️ Local tests were not run because this checkout has no ClickHouse binary or build directory. The PR reports a before/after reproduction of 6 mismatches in 60 runs versus 0 in 60; the current CI run is still in progress. A completed AST fuzzer (amd_release, oracle) report at the reviewed head would provide additional runtime confirmation.
Final Verdict

Status: ✅ Approve. No required code changes identified.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). labels Oct 14, 2026
Comment thread src/Interpreters/QueryOracleChecker.cpp Resolved
Comment thread src/Interpreters/QueryOracleChecker.cpp Resolved
…racle gate

The fuzzer can replace the bare function name argument with a `{fuzz_param_N:Identifier}`
placeholder. Its name part is empty in the AST that the oracle receives, and the value is
substituted only when the query text runs, so look it up in the query parameters of the
context. An unknown parameter skips the query.

`ASTColumnsApplyTransformer` keeps its function name, parameters and lambda outside of
`children`, so `* APPLY(generateUUIDv7)` and `* APPLY(x -> arrayMap(generateUUIDv7, x))`
were not screened. Check `func_name` and recurse into `parameters` and `lambda`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. and removed comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). labels Oct 14, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 15, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 15, 2026
Merged via the queue into master with commit 19ee686 Oct 15, 2026
177 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix/oracle-function-name-argument branch October 15, 2026 00:51
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 15, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 15, 2026
…sm-screen-apply-transformer

Conflict in `hasNonDeterministicFunctionsImpl`: ClickHouse#125728 added its own
`ASTColumnsApplyTransformer` branch there (checks `func_name`, recurses into
`parameters` and `lambda`). Take master's version of that function as is and
drop this branch's duplicate (`namesNonDeterministicFunction` and the
`hiddenApplyMembers` loop in that walker). `hiddenApplyMembers` stays for the
other nine eligibility gates; `hasAsofJoinAnywhere` is now
`hasNonDeterministicJoinAnywhere`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 15, 2026
ClickHouse#125003 removed the stateless tests of the AST fuzzer oracle: it is a testing
tool, and these `no-parallel` tests with retry loops over fuzzed queries are
expensive in the sequential job. This one is the same kind.

Validated locally instead, on the tree merged with master: with master's
`QueryOracleChecker.cpp` the seven probes for the gates this PR changes are
checked 4-14 times in each of 3 runs, so each of those gates still lets the
query through; with this PR all of them are skipped (3 of 3 runs). The four
determinism probes are skipped on both, since ClickHouse#125728 covers them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. pr-ci 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.

2 participants