Skip to content

Sync the supported ClickHouse functions page with mapping.py#17095

Open
ivannhadz wants to merge 1 commit into
PostHog:masterfrom
ivannhadz:docs/sync-clickhouse-functions
Open

Sync the supported ClickHouse functions page with mapping.py#17095
ivannhadz wants to merge 1 commit into
PostHog:masterfrom
ivannhadz:docs/sync-clickhouse-functions

Conversation

@ivannhadz
Copy link
Copy Markdown

Changes

The Supported ClickHouse functions page describes itself as the list of "enabled ClickHouse functions" and links to mapping.py as its source of truth — but it had drifted from the engine. (posthog/hogql/functions/clickhouse/strings.py even carries the comment "Keep in sync with the posthog.com repository: contents/docs/sql/clickhouse-functions.mdx".)

This reconciles the page with the functions HogQL actually enables.

Added 17 enabled-but-undocumented functions, each in its existing section:

  • Type conversions: toNullableString, toUUIDOrDefault
  • Dates and times: timezone, fromUnixTimestamp64Milli, make_date, to_char, to_date, to_timestamp
  • JSON: JSONExtract, JSONExtractKeysAndValues
  • Conditional: throwIf
  • Mathematical: rand
  • Splitting strings: split_part
  • Geo: geohashEncode
  • Other: greatest, least, languageCodeToName

Fixed 2 errors:

  • make_timestampzmake_timestamptz (typo)
  • Removed JSONExtractKey — not a registered function (the engine rejects it); JSONExtractKeys is the real one and was already listed.

How this was verified

  • Cross-checked the page against the function registry in posthog/hogql/functions/ (the file the page already cites as its source).
  • Ran all 17 added functions in a single HogQL query against a live PostHog instance — each returned the expected result (e.g. greatest(1, 2)2, languageCodeToName('en')English, split_part('a,b,c', ',', 2)b).
  • Confirmed the removed JSONExtractKey is rejected by the engine as an "Unsupported function call."

Scope is intentionally limited to clearly-missing, user-facing functions; internal UDFs (e.g. aggregate_funnel*) are excluded.

Agent context

Drafted with help from Claude (Claude Code). I've reviewed every change, understand each function, and verified them against the engine and a live instance as above.

Checklist

  • I've read the docs and/or content style guides.
  • Words are spelled using American English
  • Use relative URLs for internal links
  • I've checked the pages added or changed in the Vercel preview build
  • If I moved a page, I added a redirect in vercel.json (N/A — no page moved)

The page describes itself as the list of "enabled ClickHouse functions" and
cites mapping.py as its source, but it had drifted from the engine.

- Add 17 enabled-but-undocumented functions to their existing sections
  (greatest, least, rand, throwIf, JSONExtract, JSONExtractKeysAndValues,
  geohashEncode, split_part, to_char, to_date, to_timestamp, make_date,
  timezone, fromUnixTimestamp64Milli, toNullableString, toUUIDOrDefault,
  languageCodeToName)
- Fix typo: make_timestampz -> make_timestamptz
- Remove JSONExtractKey, which is not a registered function (the engine
  rejects it; JSONExtractKeys is the real one and was already listed)

Verified each added function executes against a live PostHog instance, and
confirmed the engine rejects the removed JSONExtractKey.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ivannhadz ivannhadz marked this pull request as ready for review May 28, 2026 15:29
@ivannhadz
Copy link
Copy Markdown
Author

Small docs-only change: syncs the Supported ClickHouse functions page with the functions actually enabled in mapping.py (17 missing functions added, 2 errors fixed). Each added function was verified to execute against a live PostHog instance. CI is blocked on first-run workflow approval. cc @PostHog/hogql - would appreciate a look when you have a moment. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant