Skip to content

fix(clickhouse): resolve 21.8 -> 21.9 test issues (again)#8846

Merged
hazzadous merged 4 commits intomasterfrom
chore/fix-clickhouse-21-9-tests
Mar 3, 2022
Merged

fix(clickhouse): resolve 21.8 -> 21.9 test issues (again)#8846
hazzadous merged 4 commits intomasterfrom
chore/fix-clickhouse-21-9-tests

Conversation

@hazzadous
Copy link
Copy Markdown
Contributor

@hazzadous hazzadous commented Mar 3, 2022

NOTE: this is https://github.com/PostHog/posthog/pull/8838/files again. I accidentally merged into #8831 but should have waited for that one to be merged into master.

This is the minimum change to make
ee/clickhouse/queries/funnels/test/test_funnel_unordered.py::TestFunnelUnorderedStepsBreakdown::test_funnel_aggregate_by_groups_breakdown_group
pass. There may be other tests still failing.

The issue was introduced with the addition of heredocs into the clickhouse syntax. heredocs use $ as delimiters. We're using $ for column identifiers in quite a few places, so now we need to ensure that we have quoted these before rendering into SQL.

NOTE: this PR is best viewed commit by commit

NOTE: not all affected queries are highlighted, as there are cases where we have a valid query even with $ not escaped e.g. e.$session AS $session is going to end up being e.session. I assume that actual test assertions will catch these 🤞

NOTE: this does not update all places this quoting is needed, this is just the minimum to get tests passing. I'll follow up separately for the rest, to avoid making this PR too large.

Changes

Please describe. If this affects the frontend, include screenshots.

Stay up-to-date with our coding conventions for a smoother review.

How did you test this code?

Updated existing tests

Harry Waye added 4 commits March 3, 2022 14:53
This is the minimum change to make
ee/clickhouse/queries/funnels/test/test_funnel_unordered.py::TestFunnelUnorderedStepsBreakdown::test_funnel_aggregate_by_groups_breakdown_group
pass. There may be other tests still failing.

The issue was introduced with the [addition of
heredocs](ClickHouse/ClickHouse#26671) into the
clickhouse syntax. heredocs use `$` as delimiters. We're using `$` for
column identifiers in quite a few places, so now we need to ensure that
we have quoted these before rendering into SQL.
@hazzadous hazzadous force-pushed the chore/fix-clickhouse-21-9-tests branch from 42324b6 to 1067075 Compare March 3, 2022 14:53
@hazzadous hazzadous merged commit 446cb48 into master Mar 3, 2022
@hazzadous hazzadous deleted the chore/fix-clickhouse-21-9-tests branch March 3, 2022 15:53
@macobo
Copy link
Copy Markdown
Contributor

macobo commented Mar 3, 2022

Let's discuss this one tomorrow at standup. We should change rules for column materialization specifically and rename existing columns, it will 100% cause issues

@macobo
Copy link
Copy Markdown
Contributor

macobo commented Mar 4, 2022

Q: Why did this change remove some snapshots?

@hazzadous
Copy link
Copy Markdown
Contributor Author

Q: Why did this change remove some snapshots?

I assumed that they were stale, but I'll check that out. I also assume that pytest would complain in CI but I'll check of that's true also.

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.

3 participants