Repository navigation
Add embedded documentation for data types - #106180
Conversation
Attach the shared `Documentation` struct (introduced for table engines) to data type families via the `DataTypeFactory::register*` methods, store it in a per-family map, and expose `description`, `syntax`, `examples`, `introduced_in`, and `related` columns on `system.data_type_families`. For data types that have a dedicated documentation page under `docs/en/sql-reference/data-types/`, the complete Markdown body of that page is embedded verbatim into the `description` field, so the standalone Markdown files can later be dropped and regenerated from the embedded documentation. Several pages document a whole group of families at once (e.g. `int-uint.md` covers all integer types); in that case the full page is embedded into one representative family (`Int32`, `Float64`, `Decimal`, `IntervalDay`, `Point`) and the other families in the group get a concise description that references it. The `JSON` documentation exceeds the 65536-byte string literal length that C++ compilers are required to support, so its `description` is concatenated at runtime from several smaller string literals. This is a follow-up to the same change for table engines and database engines and reuses the `Documentation` struct from `src/Common/Documentation.h`. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Workflow [PR], commit [8caa7f7] Summary: ✅
AI ReviewSummaryThis PR embeds data type documentation into Findings
Final VerdictStatus: Minimum required action: fix the malformed |
The embedded Markdown for several data types contained trailing whitespace and a double space after a comma in a JSON example, which the `whitespace_check` and `cpp` style checks reject. Additionally, the `JSON` description embedded Docusaurus-only MDX (`import` statements, `<Link>`, `<CardSecondary>`, and `<WhenToUseJson />`) that renders as noise when introspected through `system.data_type_families.description` and tripped the abbreviation check on the `WhenToUseJson` token. Replaced the "Looking for a guide?" card with a plain `:::tip` admonition that keeps the link, and dropped the website-only components. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The example queried `SELECT *` but its rendered output only shows the three pre-existing columns `name`, `case_insensitive`, and `alias_to`. With the new `description`, `syntax`, `examples`, `introduced_in`, and `related` columns the displayed result shape would be stale, so the query now selects those three columns explicitly. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The `Style check` (`cpp`) was failing on the embedded data type documentation, and the AI/Bugbot review flagged several malformed or inaccurate embedded Markdown fragments now exposed through `system.data_type_families.description`. Style fixes: - De-indent embedded Markdown code fences and ASCII-art tables to column 0 (matching the established `FunctionDocumentation` convention, e.g. `FunctionChar.cpp`). The original `.md` pages used list-attached 2-3 space indentation, which the C++ indentation check rejects. - Remove non-idiomatic whitespace immediately inside parentheses in a few prose/SQL lines (e.g. `Nullable( Enum8(...) )` -> `Nullable(Enum8(...))`, `( -1 * 10^(P - S), ... )` -> `(-1 * 10^(P - S), ...)`), which tripped the parenthesis-spacing check. - Drop the exclamation mark in the `JSON` example values (`"Hello, World!"` -> `"Hello, World"`), which tripped the `!",` check. Content-accuracy fixes (review feedback): - `DataTypeDynamic`: move the stray closing code fence off the `SELECT` line, and fix the result-table header `v`/`dynamicType(v)` to match the query's `d`/`dynamicType(d)`. - `DataTypeVariant`: remove the stray leading-space closing fence. - `DataTypeCustomSimpleAggregateFunction`: de-duplicate the blog bullet in `Related Content`. - `DataTypeInterval`: make the comparison example reproducible by aligning the query with the shown response (`toIntervalMicrosecond(179999999) < toIntervalMinute(3)`). - `DataTypeCustomGeo`: fix the `LineString` response header to use `l`/`toTypeName(l)` instead of the `Ring` columns `r`/`toTypeName(r)`. - `DataTypesNumber`: align the integer alias table with the registered aliases (`TIME` is not an `Int64` alias; `YEAR` is a `UInt16` alias). - Remove the spurious `1.`/`2.`/`3.` numbered-list prefixes that had leaked into the embedded table output rows, which left the tables misaligned once the surrounding indentation was removed. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106180&sha=793416006029d4058aa8525b151e46fb271c32f3&name_0=PR&name_1=Style%20check PR: #106180 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The embedded documentation for the `Dynamic` and `Variant` data types had a closing Markdown fence appended directly to the end of a `SELECT` query line, so the SQL exposed verbatim through `system.data_type_families.description` was copy-paste-invalid and the rendered code block was malformed. Move the closing fence onto its own line (a correct standalone fence already followed each query line). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Continued this PR:
CI failures on the previous commit are unrelated to this documentation-only change:
|
|
Continued this PR:
No unresolved review threads remain; the AI review is The only red CI signal is the Performance Comparison, and it is noise unrelated to this documentation-only change: all flagged queries ( |
|
Continued this PR:
No unresolved review threads remain; the AI review is |
…d collisions Master gained other 04301_* tests, so the test from this PR is renamed to the next free number. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Merged The single red check on the previous head, AST fuzzer (amd_tsan) — |
| - If equality operator `=` or `==` or `equals` function used, ClickHouse _doesn't_ take `\0` char into consideration, i.e. queries `SELECT * FROM FixedStringTable WHERE name = 'a';` and `SELECT * FROM FixedStringTable WHERE name = 'a\0';` return the same result. | ||
| - If `LIKE` clause is used, ClickHouse _does_ take `\0` char into consideration, so one may need to explicitly specify `\0` char in the filter condition. | ||
|
|
||
| ```sql |
There was a problem hiding this comment.
This FixedString description is now returned verbatim through system.data_type_families.description, but the block opened as sql includes response payloads and client transcript lines ({"name":"a\u0000"}, Query id: c32cec28-bb9e-4650-86ce-d74a1694d79e, 0 rows in set.). Renderers and users copying the block will treat that output as SQL. Please split the transcript into separate sql query and text response fences, or mark the whole block as plain text if it is intended as a transcript.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 4687/4687 (100.00%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 7 line(s) · Uncovered code |
Third PR in the series that adds embedded, runtime-introspectable documentation to ClickHouse component registries (after table engines #106177 and database engines #106178). This one does it for data types.
What it does:
Documentationstruct (src/Common/Documentation.h, introduced in Add embedded documentation for table engines #106177) through the fourDataTypeFactory::register*methods, stores it in a per-family map, and adds agetDocumentationaccessor.system.data_type_familiesnow exposesdescription,syntax,examples,introduced_in, andrelatedcolumns (previously onlyname,case_insensitive,alias_to).docs/en/sql-reference/data-types/, the complete Markdown body is embedded verbatim intodescription, so the standalone Markdown files can later be dropped and regenerated.int-uint.mdcovers all integer types,float.mdthe floats,decimal.mdthe decimals,geo.mdthe geo types,interval.mdthe intervals). In that case the full page is embedded into one representative family —Int32,Float64,Decimal,IntervalDay,Point— and the other families in the group get a concise description that references the representative. This keeps one page per file for later regeneration.Implementation note: the
JSONdocumentation exceeds the 65536-byte string literal length that C++ compilers are required to support, so itsdescriptionis concatenated at runtime from several smaller string literals.Note: this PR shares
src/Common/Documentation.h/.cppwith #106177 and #106178 (trivial add/add on merge).Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Data types now carry embedded documentation, introspectable via the new
description,syntax,examples,introduced_in, andrelatedcolumns of thesystem.data_type_familiestable.Documentation entry for user-facing changes
system.data_type_familiesand an updatedsystem.data_type_familiessystem-table page).Version info
26.6.1.710