Skip to content

Feat: A SQL function obfuscateQuery - #98305

Merged
alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
Sallery-X:master
Mar 25, 2026
Merged

alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
Sallery-X:master

Conversation

@Sallery-X

@Sallery-X Sallery-X commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • New Feature

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

A SQL function obfuscateQuery. Closes #98010.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Note

Medium Risk
Adds new user-facing SQL functions with custom determinism/LowCardinality execution behavior and per-row randomness, which could affect query planning (CSE) and reproducibility if the determinism flags are incorrect.

Overview
Adds new SQL functions obfuscateQuery(query[, tag]) and deterministic obfuscateQueryWithSeed(query, seed) that obfuscate SQL text via Parsers::obfuscateQueries, with seed selection supporting integer or string inputs and handling both string and constant string columns.

Registers both functions with full FunctionDocumentation, and introduces stateless tests validating per-row randomness vs seed determinism, argument validation errors, tag type checking, column/LowCardinality behavior, and structure-preservation expectations.

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

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Feb 28, 2026
@clickhouse-gh

clickhouse-gh Bot commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [06a79fa]

Summary: ✅


AI Review

Summary

This PR adds obfuscateQuery and obfuscateQueryWithSeed (with tests) to obfuscate SQL text while preserving structure, including deterministic behavior for seed-based calls. After reviewing the current PR head and test expectations, I did not find new blocker/major issues that are not already addressed in the latest revision.

Missing context

  • ⚠️ No CI run results/log links were provided in the review request context, so this review is static-analysis only.

ClickHouse Rules

Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ✅
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
Safe rollout ✅
Compilation time ✅

Final Verdict

  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Feb 28, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

@Sallery-X, thank you! Check the CI.

@Sallery-X

Copy link
Copy Markdown
Contributor Author

@Sallery-X, thank you! Check the CI.
👌

@Sallery-X
Sallery-X force-pushed the master branch 5 times, most recently from e49af7e to f7db67e Compare March 3, 2026 09:34
Comment thread src/Functions/FunctionObfuscateQuery.h Resolved
Comment thread src/Functions/FunctionObfuscateQuery.h Resolved
Comment thread src/Functions/obfuscateQuery.cpp Resolved
Comment thread src/Functions/obfuscateQuery.cpp Resolved
Comment thread src/Functions/obfuscateQuery.cpp Resolved
Comment thread src/Functions/obfuscateQuery.cpp Resolved

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread src/Functions/obfuscateQuery.cpp Resolved
Comment thread src/Functions/obfuscateQuery.cpp Resolved
@alexey-milovidov alexey-milovidov self-assigned this Mar 16, 2026
Comment thread src/Functions/obfuscateQuery.cpp Resolved
Comment thread src/Functions/obfuscateQuery.cpp Resolved
@alexey-milovidov
alexey-milovidov merged commit 07c1812 into ClickHouse:master Mar 25, 2026
148 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 25, 2026
@Algunenano

Copy link
Copy Markdown
Member

Asan found a crash here: #100711

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-feature Pull request with new product feature 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.

A SQL function obfuscateQuery

4 participants