Skip to content
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

chore(hogql): Use the C++ parser in local dev #18112

Merged
merged 2 commits into from
Oct 20, 2023
Merged

Conversation

Twixes
Copy link
Member

@Twixes Twixes commented Oct 19, 2023

Problem

It's time to actually start using the C++ parser.

Changes

Before we do that in production, I would prefer to add more NULL guards to parser.cpp (we don't want to run into the billion-dollar mistake), just so we're sure the production processes can't segfault (this should never happen in normal operation, but e.g. if a pod runs out of memory, there is currently a risk that the parser can't allocate a Python object, and currently the whole Python process crashes with no recourse, which would be very annoying).

But we were just hacking with @thmsobrmlr when suddenly we had to wait TWENTY seconds for Python to parse a statement (the actual query took 0.2s). Let's start using the new parser in local dev and we might also uncover some issue (or find that it's perfect).

@Twixes Twixes requested a review from mariusandra October 19, 2023 21:26
Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed in general. However will it be a lot of trouble to move the flag to change the parser into the HogQL modifiers system? See modifiers.py and HogQLDebug.tsx? This keeps all things that can affect a query neatly packed away... and we could use it to try faster queries in production as well. If too much hassle, then 👍 just for this regardless.

@Twixes
Copy link
Member Author

Twixes commented Oct 20, 2023

Only a bit more trouble – I think that makes sense, I will do that as the next step of rollout (where the default value of the modifier would depend on settings.DEBUG the same way as here).

@Twixes Twixes merged commit 85a0d3d into master Oct 20, 2023
@Twixes Twixes deleted the turbo-parser-in-dev branch October 20, 2023 09:44
daibhin pushed a commit that referenced this pull request Oct 23, 2023
* chore(hogql): Use the C++ parser in local dev

* Update all the parsing functions, not just `parse_select`
Justicea83 pushed a commit to Justicea83/posthog that referenced this pull request Oct 25, 2023
* chore(hogql): Use the C++ parser in local dev

* Update all the parsing functions, not just `parse_select`
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.

2 participants