mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Author FunctionDocumentation for the window functions (which previously had none) and convert their reference pages to be regenerated from system.functions, like the other component categories. The 12 window functions registered in WindowTransform.cpp (rank, denseRank, percentRank, cume_dist, row_number, ntile, nth_value, lagInFrame, lag, leadInFrame, lead, nonNegativeDerivative) get their reference-page body as the .description of the FunctionDocumentation passed at registerFunction time (the doc is the 2nd element of the aggregate-factory Value brace; category AggregateFunction, as there is no Window category). A new generate-window-functions.sql + window_function_generators emit that body, matched to the page basename case/separator-insensitively (dense_rank -> denseRank, percent_rank -> percentRank). first_value and last_value are left hand-written: they are registerAlias of any / anyLast and so cannot carry their own window-specific documentation. Verified against a from-master build: each function's system.functions.description matches its master page body byte-for-byte, and each regenerated page equals origin/master (body identical, only the AUTOGENERATED markers added) with zero broken links. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
21 lines
1.1 KiB
SQL
21 lines
1.1 KiB
SQL
-- Window-function documentation generator.
|
|
-- Usage: one page per window function, driven by the doc page's basename, e.g.:
|
|
-- clickhouse --param_fn='row_number' --queries-file generate-window-functions.sql
|
|
--
|
|
-- Window functions are registered in the aggregate-function factory and exposed
|
|
-- in system.functions; their description holds the full Markdown body of the
|
|
-- reference page (populated from the FunctionDocumentation attached at
|
|
-- registerFunction time). We emit that body verbatim; the Python port then
|
|
-- applies the same Docusaurus->Mintlify body transforms it runs on migrated
|
|
-- pages. The page basename is matched to the function name case- and
|
|
-- separator-insensitively (so dense_rank matches denseRank). Pages whose
|
|
-- function carries no description produce no output and are skipped.
|
|
SELECT description
|
|
FROM system.functions
|
|
WHERE lower(replaceRegexpAll(name, '[^0-9a-zA-Z]', ''))
|
|
= lower(replaceRegexpAll({fn:String}, '[^0-9a-zA-Z]', ''))
|
|
AND notEmpty(description)
|
|
ORDER BY name ASC
|
|
LIMIT 1
|
|
INTO OUTFILE 'temp-window-function.md' TRUNCATE FORMAT LineAsString
|