-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(hogql): add sampling support #14733
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
Co-authored-by: Marius Andra <marius.andra@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.
Found one thing that should be changed, the rest looks really good!
I'd also add a test where we have a join with multiple sampled tables in the query.
Co-authored-by: Marius Andra <marius.andra@gmail.com>
Co-authored-by: Marius Andra <marius.andra@gmail.com>
…o sample-hogql
@mariusandra all addressed! |
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.
Great work!
However I remembered now that I forgot one more thing 😅. To own my mistake of not thinking of it earlier, I made a quick commit instead of asking you to fix it again (though I know you would have happily done it).
Anyway, we have two visitor classes in hogql/visitor.py
that a lot of other visitors inherit from. These used when you want to write a quick visitor and just fill in one or two functions, such as the "field and property collector" I moved in this PR. These also need to know about the sampling clause.
It's a bit unfortunate we don't have anything automatic to catch that we didn't add these functions to the visitors, but I'm not sure what's a good way to check that. This might come back to bite us slightly one day 🤔
* master: (101 commits) feat: feedback tab - improve the UI and switch to HogQL (#14777) feat(experiments): cache experiment results (#14742) fix(empty-state): properly fix query timeout state (#14793) chore(feature-flag): release json payload flag (#14775) feat(hogql): make sure joins work with properties (#14790) test(frontend): Tune visual regression test failure threshold (#14766) feat(hogql): count distinct and count star (#14786) feat(perf): only load experiment results once (#14772) feat: allow new insight type choice from sidebar (#14759) fix(persons): hide persons in the future (#14308) feat: allow query cards in saved insights grid (#14784) fix(lemon-ui): Align padding for small/large buttons with icons (#14750) chore(deps): Upgrade TypeScript from 4.8 to 4.9 in the frontend (#14609) feat: rename insight query tab to json tab (#14781) feat: use same top heading for insight card and exported insight (#14780) feat: define new insight urls in one place (#14778) fix(hogql): person properties in a funnel breakdown (#14765) fix: hide query based insights in recently viewed list (#14774) feat: improve query summaries (#14768) feat(hogql): add sampling support (#14733) ...
Adds support for a
SAMPLE
clause to HogQL, withOFFSET
support as well.https://clickhouse.com/docs/en/sql-reference/statements/select/sample/