Skip to content

Commit

Permalink
fix(chstorage): do not offload new line filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Apr 26, 2024
1 parent 92805b0 commit b7a7e5a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/chstorage/querier_logs_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func entryMapper(r logstorage.Record) (logqlengine.Entry, error) {
return e, nil
}

// SamplingNode is a [MetricNode], which offloads sampling to Clickhouse
// SamplingNode is a [logqlengine.SampleNode], which offloads sampling to Clickhouse
type SamplingNode struct {
Sampling SamplingOp
GroupingLabels []logql.Label
Expand Down
13 changes: 12 additions & 1 deletion internal/chstorage/querier_logs_optimizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ stageLoop:
for _, stage := range pn.Pipeline {
switch stage := stage.(type) {
case *logql.LineFilter:
if stage.By.IP {
if !o.canOffloadLineFilter(stage) {
skippedStages++
continue
}
Expand Down Expand Up @@ -170,3 +170,14 @@ stageLoop:
}
return n
}

func (o *ClickhouseOptimizer) canOffloadLineFilter(lf *logql.LineFilter) bool {
switch lf.Op {
case logql.OpPattern, logql.OpNotPattern:
return false
}
if lf.By.IP || len(lf.Or) > 0 {
return false
}
return true
}

0 comments on commit b7a7e5a

Please sign in to comment.