-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(hogql): JSON property access #14976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Awesome! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
try: | ||
from ee.clickhouse.materialized_columns.analyze import materialize | ||
except: | ||
# EE not available? Assume we're good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit hacky to check for EE availability like this. The test could become a noop when we move things around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, EE tests just need to be in ee/
rather than posthog/
. Hard to trust a test that self-parametrizes itself this way.
Co-authored-by: Thomas Obermüller <thomas.obermueller@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome, just not sure about that EE-dependent test either
try: | ||
from ee.clickhouse.materialized_columns.analyze import materialize | ||
except: | ||
# EE not available? Assume we're good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, EE tests just need to be in ee/
rather than posthog/
. Hard to trust a test that self-parametrizes itself this way.
Ugh, that test is indeed funny. I split out the materialized part into its own test, to make sure the non-materialized part runs always. This way at least we know JSON parsing works. There's probably an even bigger bug: while I'm not that sure I'd like to move just these materialised tests into the |
Problem
Deeper JSON access is one of the most requested feature for HogQL
Changes
Implements it, but without property type autodetection --> all deeply accessed properties will be string and you need a manual
toInt()
around them.How did you test this code?
Wrote tests, tested in the browser: