fix: Rewrite predicate to remove _field from schema physical operations

Fixes #19488
pull/19446/head
Stuart Carnie 2020-09-02 11:10:40 -07:00
parent b3138d2ead
commit 7f94b0d5db
No known key found for this signature in database
GPG Key ID: 848D9C9718D78B4F
1 changed files with 9 additions and 3 deletions

View File

@ -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
}
@ -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
}
@ -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
}