-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(hogql): bytecode, local evaluation and action matching in plugin server #16189
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mariusandra
changed the title
feat(hogql): bytecode mode
feat(hogql): inline hogql action matcher in plugin server
Jun 22, 2023
This was referenced Jun 27, 2023
Closing and continuing in #16304 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Actions with HogQL can't trigger webhooks because HogQL can't be used for local evaluation.
Changes
Well now it is.
This PR :
bytecode
field on the actions table, which contains a condensed HogQL bytecode for all steps in the action=~
and!~
regex matching shorthand support into HogQLEnd result: Slack Webhooks on HogQL
See the readme for the bytecode format
(Technically this is not 8-bit "byte"-code, but just an array of instructions... I just didn't need to serialize it as a binary string yet, but it should serialize very nicely if we ever need to 🦐)
Questions
Should this be enabled for everyone, or just for us for testing? I did add a
try
block around the bytecode execution.I added
'_h'
as the first element of the instructions to specify what this is. Shall I add another version instruction, or will we go_h
->_ho
->_hog
when incrementing versions? :DThe only thing that is not working right now is a case when you have an action that simultaneously matches a cohort and a HogQL string. Both work if used independently, so there is no regression. The solution is to implement a
cohort_filters_to_hogql
function, at least for all cases that can work with local evaluation. I'd love to do this in another PR. This has gotten long enough.There are no indications on the frontend if any action/filter combo works with webhooks or not. I'd like to implement the cohort features first, and then make this clear.
How did you test this code?
Wrote tests. Recorded a screencast.
TODO
~
regex searchnull
in the spec