Conversation
Ziinc
approved these changes
Apr 17, 2026
|
|
||
| query = from(l in "logs") | ||
| query_with_filter = where(query, ^result) | ||
| assert %Ecto.Query{wheres: [_where_clause]} = query_with_filter |
Contributor
There was a problem hiding this comment.
can assert on the where clause for comprehensiveness
| ) | ||
|
|
||
| result = ClickHouse.apply_filter_rules_to_query(query, [filter_rule], []) | ||
| assert %Ecto.Query{wheres: [_where_clause]} = result |
Contributor
There was a problem hiding this comment.
as above, can verify the where clause.
| result = ClickHouse.apply_select_rules_to_query(query, [select_rule], []) | ||
|
|
||
| assert %Ecto.Query{select: %{expr: expr}} = result | ||
| assert Macro.to_string(expr) =~ "log_attributes_parsed_backend_type" |
Contributor
There was a problem hiding this comment.
side note: select rules would need to support aliases in future, like s:my.nested.field@my_alias or something like this.
…g-in-clickhouse-lql
…g-in-clickhouse-lql
This file contains hidden or 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
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.
Adds support for dot-key filtering on ClickHouse Map columns in LQL. Previously, a query like
log_attributes.parsed.backend_type:~"client"would fail because the ClickHouse transformer treated the entire dotted path as a column name (l0."log_attributes.parsed.backend_type") instead of using Map bracket access (l0."log_attributes"['parsed.backend_type']).Key Changes:
lib/logflare/lql/backend_transformer/clickhouse.ex— Addedsplit_map_path/1to detect when a field path starts with a known ClickHouse Map column and splits it into column + map key.test/logflare/lql/backend_transformer/clickhouse_test.exs— Added unit tests forsplit_map_path/1and dot-key filter/select rules (equality, range, negation, select with alias). Consolidated some old describe blocks. Fixed pipe-styleMacro.to_stringassertions throughout to improve readability.test/logflare/backends/adaptor/clickhouse_adaptor_test.exs— Added "LQL query integration" describe block with a round-trip test: inserts events with dotted map keys into ClickHouse, queries them back using an LQL filter rule, and validates correct row filtering.