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

fix: hogql tests should run through the query cleaning code to avoid flaps #25900

Merged
merged 19 commits into from
Oct 31, 2024

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Oct 30, 2024

this flapping test has bit me several times today e1220f0 (#25898)

and it's confusing to have sql snapshots that don't go through the sql snapshot cleaning code

we aren't using the query cleaning in hogql test sql snapshots, so we periodically flap the snapshots
flapping is slow
so we should avoid it

@pauldambra pauldambra changed the title fix: flappity take 3 fix: hogql tests should run through the query cleaning code to avoid flaps Oct 30, 2024
@@ -31,8 +31,8 @@
FROM events LEFT JOIN (
SELECT person_static_cohort.person_id AS cohort_person_id, 1 AS matched, person_static_cohort.cohort_id AS cohort_id
FROM person_static_cohort
WHERE and(equals(person_static_cohort.team_id, 420), in(person_static_cohort.cohort_id, [6]))) AS __in_cohort ON equals(__in_cohort.cohort_person_id, events.person_id)
Copy link
Member Author

Choose a reason for hiding this comment

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

this for example was flapping pretty frequently on cohort id on unrelated changes for me

@pauldambra pauldambra requested a review from a team October 30, 2024 17:28
Comment on lines 122 to 123
query = re.sub(r"(team|cohort)_id(\"?) = \d+", r"\1_id\2 = 2", query)
query = re.sub(r"\d+ as (team|cohort)_id(\"?)", r"2 as \1_id\2", query)
Copy link
Member

Choose a reason for hiding this comment

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

The only thing that feels weird here is that this replacement dummy value 2 look just like normal one 😅 whereas 0000000-0000-0000-0000-000000000000 seems obviously like a test placeholder. Something like 99999 would be more obvious (and 2 has been here before this PR, so I'm introducing scope creep)

Copy link
Member Author

Choose a reason for hiding this comment

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

only a tiny bit of creep though

your wish is my command

Copy link
Member Author

Choose a reason for hiding this comment

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

🤣 111 files changed 📈

Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

The large number of lines removed and added means this is extremely productive

@pauldambra pauldambra merged commit 8b4387c into master Oct 31, 2024
89 checks passed
@pauldambra pauldambra deleted the fix/flappity3 branch October 31, 2024 11:27
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