:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(hogql): say computed flag keys fail on events_json (#112302)
Sandy Spicerf2fe805a3518
diff --git a/docs/internal/clickhouse-utility-udfs.md b/docs/internal/clickhouse-utility-udfs.mdindex e6bc468d0152..cb9b432254f4 100644--- a/docs/internal/clickhouse-utility-udfs.md+++ b/docs/internal/clickhouse-utility-udfs.md@@ -115,7 +115,8 @@ becomes `"control"` through `toJSONString`, and `JSONExtractString` returns `conA HogQL JSON function on `events_json` whose first key is `$feature/<key>`, `$active_feature_flags` or `$feature_flags` reads the flags map directly instead of the rebuilt document, also when the document is `toString(properties)`.The result is the same as reading the rebuilt document, because the value is serialized the way the SDK sent it: a boolean flag as JSON `true` or `false`, a variant as a JSON string, with the sentinels mapped back.The original function still determines the return type, the missing-value default and any deeper keys.-Key listings of the whole document, JSON functions with a computed key, `properties` selected through a subquery, and `JSON_VALUE` (whose second argument is a JSONPath, not a key) keep reading the rebuilt document.+Key listings of the whole document, `properties` selected through a subquery, and `JSON_VALUE` (whose second argument is a JSONPath, not a key) keep reading the rebuilt document.+A JSON function with a key computed per row fails the query when the key names `$feature/<key>` or `$active_feature_flags`, because no stored document holds those keys.The legacy table stores flags as sent, so HogQL reads every flag property there as stored, `$feature_flags` included.### Benchmarking the cleaner