mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
The query obfuscator (`clickhouse format --obfuscate`) was producing unparseable SQL for many queries. This fixes several categories of issues: 1. Add missing keywords for SYSTEM commands (`FLUSH`, `LOGS`, `DNS`, `CACHE`, `RELOAD`, etc.), dictionary definitions (`FLAT`, `HASHED`, `CLICKHOUSE`, etc.), special SQL constructs (`EXTRACT`, `TRIM`, `DECIMAL`), multi-word data types (`NATIONAL`, `NCHAR`, `BINARY`, `LARGE`, `OBJECT`), and substitution syntax (`Identifier`). 2. Fix hex/binary number prefix corruption: `0x1234` was becoming `0p1234` because the `x` was treated as alphabetical and obfuscated. Now preserves `0x`/`0b` prefixes and handles hex float literals like `0xD.5p-6`. 3. Fix hex/binary string literal content corruption: `x'ABCD'` was producing invalid hex like `x'WXYZ'`. Now replaces hex digits with random hex digits and binary digits with random binary digits. 4. Make known identifier lookup case-insensitive: `DECIMAL` and `decimal` are now recognized as known types like `Decimal`. Co-Authored-By: Claude Opus 4.6 <[email protected]>