Skip to content

Commit

Permalink
fix: Rewrite predicate to remove _field from schema physical operations
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartcarnie committed Sep 2, 2020
1 parent b3138d2 commit 7f94b0d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions v1/services/storage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ func (s *Store) TagKeys(ctx context.Context, req *datatypes.TagKeysRequest) (cur
if found := reads.HasFieldValueKey(expr); found {
return nil, errors.New("field values unsupported")
}
expr = influxql.Reduce(influxql.CloneExpr(expr), nil)
// this will remove any _field references, which are not indexed
// see https://github.com/influxdata/influxdb/issues/19488
expr = influxql.Reduce(RewriteExprRemoveFieldKeyAndValue(influxql.CloneExpr(expr)), nil)
if reads.IsTrueBooleanLiteral(expr) {
expr = nil
}
Expand Down Expand Up @@ -309,7 +311,9 @@ func (s *Store) TagValues(ctx context.Context, req *datatypes.TagValuesRequest)
if found := reads.HasFieldValueKey(expr); found {
return nil, errors.New("field values unsupported")
}
expr = influxql.Reduce(influxql.CloneExpr(expr), nil)
// this will remove any _field references, which are not indexed
// see https://github.com/influxdata/influxdb/issues/19488
expr = influxql.Reduce(RewriteExprRemoveFieldKeyAndValue(influxql.CloneExpr(expr)), nil)
if reads.IsTrueBooleanLiteral(expr) {
expr = nil
}
Expand Down Expand Up @@ -389,7 +393,9 @@ func (s *Store) MeasurementNames(ctx context.Context, req *MeasurementNamesReque
if found := reads.HasFieldValueKey(expr); found {
return nil, errors.New("field values unsupported")
}
expr = influxql.Reduce(influxql.CloneExpr(expr), nil)
// this will remove any _field references, which are not indexed
// see https://github.com/influxdata/influxdb/issues/19488
expr = influxql.Reduce(RewriteExprRemoveFieldKeyAndValue(influxql.CloneExpr(expr)), nil)
if reads.IsTrueBooleanLiteral(expr) {
expr = nil
}
Expand Down

0 comments on commit 7f94b0d

Please sign in to comment.