fix: account for ETS matching maps when comparing shapes#2824
Conversation
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
View the full list of 1 ❄️ flaky tests
To view more test analytics, go to the Test Analytics Dashboard |
| %Expr{} = expr -> Electric.Shapes.Shape.Comparable.comparable(expr) | ||
| statement when is_binary(statement) -> statement | ||
| end) | ||
| {:shape, {shape.root_table_id, shape.root_table}, shape.root_pk, |
There was a problem hiding this comment.
nit: this is the only thing I was slightly worried about - we need to make sure this tuple is kept up to date with any more fields/info we end up adding to the shape. Maybe a docstring with a little bit of an explanation might help here?
38b4dad to
7b8e560
Compare
| end) | ||
| {:shape, {shape.root_table_id, shape.root_table}, shape.root_pk, | ||
| Comparable.comparable(shape.where), shape.selected_columns, | ||
| Enum.flat_map(shape.flags, fn {k, v} -> if(v, do: [k], else: []) end) |> Enum.sort(), |
There was a problem hiding this comment.
Not in scope for this PR but it would be better to turn shape.flags into a keyword list that gets sorted and normalized whenever it is updated, instead of doing this mapping and sorting every time we do any lookups for the shape.
There was a problem hiding this comment.
if we don't open an issue for doing it, we'll never do it :)
No description provided.